Various fixes for CI (#423)

* Various fixes

* fix try_from for cores

* no_std
This commit is contained in:
Dominik Maier 2021-12-15 18:11:40 +01:00 committed by GitHub
parent a8845ccbe7
commit 304eda724f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 8 deletions

View File

@ -5,7 +5,7 @@ edition = "2021"
[dependencies] [dependencies]
pyo3 = { version = "0.15", features = ["extension-module"] } pyo3 = { version = "0.15", features = ["extension-module"] }
libafl_qemu = { path = "../../libafl_qemu", version = "0.7", features = ["python"] } libafl_qemu = { path = "../../libafl_qemu", version = "0.7", features = ["python"], features = ["x86_64"] }
libafl_sugar = { path = "../../libafl_sugar", version = "0.7", features = ["python"] } libafl_sugar = { path = "../../libafl_sugar", version = "0.7", features = ["python"] }
[build-dependencies] [build-dependencies]

View File

@ -4,7 +4,7 @@ Multiple fuzzer instances can be spawned using different ways.
## Manually, via a TCP port ## Manually, via a TCP port
The straightforward way to do Multi-Threading is to use the `LlmpRestartingEventManager`, and specifically to use `setup_restarting_mgr_std`. The straightforward way to do Multi-Threading is to use the `LlmpRestartingEventManager`, specifically to use `setup_restarting_mgr_std`.
It abstracts away all the pesky details about restarts on crash handling (for in-memory fuzzers) and multi-threading. It abstracts away all the pesky details about restarts on crash handling (for in-memory fuzzers) and multi-threading.
With it, every instance you launch manually tries to connect to a TCP port on the local machine. With it, every instance you launch manually tries to connect to a TCP port on the local machine.
@ -20,7 +20,7 @@ While it's called "restarting" manager, it uses `fork` on Unix operating systems
## Launcher ## Launcher
The Launcher is the lazy way to do multiprocessing. The Launcher is the lazy way to do multiprocessing.
You can use the Launcher builder to create a fuzzer that spawns multiple nodes, all using restaring event managers. You can use the Launcher builder to create a fuzzer that spawns multiple nodes, all using restarting event managers.
An example may look like this: An example may look like this:
```rust,ignore ```rust,ignore
@ -40,7 +40,7 @@ An example may look like this:
This first starts a broker, then spawns `n` clients, according to the value passed to `cores`. This first starts a broker, then spawns `n` clients, according to the value passed to `cores`.
The value is a string indicating the cores to bind to, for example, `0,2,5` or `0-3`. The value is a string indicating the cores to bind to, for example, `0,2,5` or `0-3`.
For each client, `run_client` will be called. For each client, `run_client` will be called.
On Windows, the Launcher will restart each client, while on Unix it will use `fork`. On Windows, the Launcher will restart each client, while on Unix, it will use `fork`.
## Other ways ## Other ways

View File

@ -13,6 +13,6 @@ debug = true
[dependencies] [dependencies]
libafl = { path = "../../libafl/" } libafl = { path = "../../libafl/" }
libafl_qemu = { path = "../../libafl_qemu/" } libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64"] }
clap = { version = "3.0.0-rc.4", features = ["default"] } clap = { version = "3.0.0-rc.4", features = ["default"] }
nix = "0.23.0" nix = "0.23.0"

View File

@ -18,13 +18,13 @@ pub fn main() {
fuzz( fuzz(
&[PathBuf::from("./input")], &[PathBuf::from("./input")],
PathBuf::from("./output"), PathBuf::from("./output"),
&[1], &Cores::all(),
1337, 1337,
); );
} }
/// The actual fuzzer /// The actual fuzzer
fn fuzz(input_dirs: &[PathBuf], output_dir: PathBuf, cores: &[usize], broker_port: u16) { fn fuzz(input_dirs: &[PathBuf], output_dir: PathBuf, cores: &Cores, broker_port: u16) {
// Call LLVMFUzzerInitialize() if present. // Call LLVMFUzzerInitialize() if present.
let args: Vec<String> = env::args().collect(); let args: Vec<String> = env::args().collect();
if libfuzzer_initialize(&args) == -1 { if libfuzzer_initialize(&args) == -1 {

View File

@ -232,6 +232,14 @@ impl From<Vec<usize>> for Cores {
} }
} }
#[cfg(feature = "std")]
impl TryFrom<&str> for Cores {
type Error = Error;
fn try_from(cores: &str) -> Result<Self, Self::Error> {
Self::from_cmdline(cores)
}
}
/// Parses core binding args from user input /// Parses core binding args from user input
/// Returns a Vec of CPU IDs. /// Returns a Vec of CPU IDs.
/// `./fuzzer --cores 1,2-4,6` -> clients run in cores 1,2,3,4,6 /// `./fuzzer --cores 1,2-4,6` -> clients run in cores 1,2,3,4,6

View File

@ -21,7 +21,7 @@ pyo3-build-config = { version = "0.14.5", optional = true }
[dependencies] [dependencies]
libafl = { path = "../libafl", version = "0.7.0" } libafl = { path = "../libafl", version = "0.7.0" }
libafl_targets = { path = "../libafl_targets", version = "0.7.0" } libafl_targets = { path = "../libafl_targets", version = "0.7.0" }
libafl_qemu = { path = "../libafl_qemu", version = "0.7.0" } libafl_qemu = { path = "../libafl_qemu", version = "0.7.0", features = ["x86_64"] }
typed-builder = "0.9.0" # Implement the builder pattern at compiletime typed-builder = "0.9.0" # Implement the builder pattern at compiletime
#pyo3 = { version = "0.15", features = ["extension-module"], optional = true } #pyo3 = { version = "0.15", features = ["extension-module"], optional = true }
pyo3 = { version = "0.15", optional = true } pyo3 = { version = "0.15", optional = true }