Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions fuzzers/baby/baby_fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ pub fn main() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down
24 changes: 15 additions & 9 deletions fuzzers/baby/baby_fuzzer_minimizing/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ pub fn main() -> Result<(), Error> {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down Expand Up @@ -132,7 +132,13 @@ pub fn main() -> Result<(), Error> {
let mut fuzzer = StdFuzzer::new(scheduler, (), ());

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(&mut harness, (), &mut fuzzer, &mut state, &mut mgr)?;
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(())
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()?;

state.load_initial_inputs_forced(&mut fuzzer, &mut executor, &mut mgr, &[solution_dir])?;

Expand Down
32 changes: 16 additions & 16 deletions fuzzers/baby/baby_fuzzer_swap_differential/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,22 @@ pub fn main() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let first_executor = InProcessExecutor::new(
&mut first_harness,
tuple_list!(first_map_observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the first executor");
let second_executor = InProcessExecutor::new(
&mut second_harness,
tuple_list!(second_map_observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the second executor");
let first_executor = InProcessExecutor::builder()
.harness(&mut first_harness)
.observers(tuple_list!(first_map_observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the first executor");
let second_executor = InProcessExecutor::builder()
.harness(&mut second_harness)
.observers(tuple_list!(second_map_observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the second executor");

// create the differential executor, providing both the map swapper (which will ensure the
// instrumentation picks the correct map to write to) and the map observer (which provides the
Expand Down
16 changes: 8 additions & 8 deletions fuzzers/baby/baby_fuzzer_unicode/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ pub fn main() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generate 8 initial inputs
fuzzer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ pub fn main() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer, bt_observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer, bt_observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ pub fn main() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer, bt_observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer, bt_observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down
42 changes: 21 additions & 21 deletions fuzzers/binary_only/frida_executable_libpng/src/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,13 @@ unsafe fn fuzz(
// Create the executor for an in-process function with just one observer for edge coverage
let mut executor = FridaInProcessExecutor::new(
&gum,
InProcessExecutor::new(
&mut frida_harness,
observers,
&mut fuzzer,
&mut state,
&mut mgr,
)?,
InProcessExecutor::builder()
.harness(&mut frida_harness)
.observers(observers)
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()?,
Rc::clone(&frida_helper),
);

Expand Down Expand Up @@ -349,13 +349,13 @@ unsafe fn fuzz(
// Create the executor for an in-process function with just one observer for edge coverage
let mut executor = FridaInProcessExecutor::new(
&gum,
InProcessExecutor::new(
&mut frida_harness,
observers,
&mut fuzzer,
&mut state,
&mut mgr,
)?,
InProcessExecutor::builder()
.harness(&mut frida_harness)
.observers(observers)
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()?,
Rc::clone(&frida_helper),
);

Expand Down Expand Up @@ -497,13 +497,13 @@ unsafe fn fuzz(
// Create the executor for an in-process function with just one observer for edge coverage
let mut executor = FridaInProcessExecutor::new(
&gum,
InProcessExecutor::new(
&mut frida_harness,
observers,
&mut fuzzer,
&mut state,
&mut mgr,
)?,
InProcessExecutor::builder()
.harness(&mut frida_harness)
.observers(observers)
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()?,
Rc::clone(&frida_helper),
);

Expand Down
16 changes: 8 additions & 8 deletions fuzzers/binary_only/frida_windows_gdiplus/src/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
// Create the executor for an in-process function with just one observer for edge coverage
let mut executor = FridaInProcessExecutor::new(
&gum,
InProcessExecutor::new(
&mut frida_harness,
observers,
&mut fuzzer,
&mut state,
&mut mgr,
)?,
InProcessExecutor::builder()
.harness(&mut frida_harness)
.observers(observers)
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()?,
Rc::clone(&frida_helper),
);

Expand Down Expand Up @@ -518,6 +518,6 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {

#[cfg(not(all(unix, feature = "std")))]
{
return builder.build().launch();
builder.build().launch()
}
}
16 changes: 8 additions & 8 deletions fuzzers/full_system/unicorn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,14 @@ fn fuzzer(should_emulate: bool, arch: Arch) {
// A fuzzer with feedbacks and a corpus scheduler
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(edges_observer, time_observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(edges_observer, time_observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandBytesGenerator::new(nonzero!(4));
Expand Down
16 changes: 8 additions & 8 deletions fuzzers/fuzz_anything/baby_fuzzer_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ pub fn fuzz() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down
15 changes: 3 additions & 12 deletions fuzzers/fuzz_anything/libafl_atheris/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use libafl::{
},
observers::{CanTrack, HitcountsMapObserver, StdMapObserver, TimeObserver},
schedulers::{IndexesLenTimeMinimizerScheduler, QueueScheduler},
stages::{ShadowTracingStage, StdMutationalStage, TracingStage},
stages::{ShadowTracingStage, StdMutationalStage},
state::{HasCorpus, StdState},
Error, HasMetadata,
};
Expand Down Expand Up @@ -206,13 +206,6 @@ pub extern "C" fn LLVMFuzzerRunDriver(
.event_mgr(&mut mgr)
.build()?;

// Secondary harness due to mut ownership
let mut harness = |input: &BytesInput| {
let target = input.target_bytes();
harness_fn(target.as_ptr(), target.len());
ExitKind::Ok
};

let mut executor = ShadowExecutor::new(executor, tuple_list!(cmplog_observer));
// Setup a tracing stage in which we log comparisons
let tracing = ShadowTracingStage::new();
Expand Down Expand Up @@ -250,14 +243,12 @@ pub extern "C" fn LLVMFuzzerRunDriver(
state.corpus().count()
);
} else {
println!("Loading from {:?}", &input_dirs);
println!("Loading from {input_dirs:?}");
// Load from disk
// we used _forced since some Atheris testcases don't touch the map at all, hence, would not load any data.
state
.load_initial_inputs_forced(&mut fuzzer, &mut executor, &mut mgr, &input_dirs)
.unwrap_or_else(|_| {
panic!("Failed to load initial corpus at {:?}", &input_dirs)
});
.unwrap_or_else(|_| panic!("Failed to load initial corpus at {input_dirs:?}"));
println!("We imported {} inputs from disk.", state.corpus().count());
}
}
Expand Down
16 changes: 8 additions & 8 deletions fuzzers/fuzz_anything/push_harness/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ fn input_generator() {
let mut fuzzer = StdFuzzer::new(scheduler, feedback, objective);

// Create the executor for an in-process function with just one observer
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(observer),
&mut fuzzer,
&mut state,
&mut mgr,
)
.expect("Failed to create the Executor");
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!(observer))
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.expect("Failed to create the Executor");

// Generator of printable bytearrays of max size 32
let mut generator = RandPrintablesGenerator::new(nonzero!(32));
Expand Down
16 changes: 8 additions & 8 deletions fuzzers/inprocess/fuzzbench_text/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ fn run_testcases(filenames: &[&str], _dump_coverage_dir: Option<PathBuf>) {
};

let mut mgr = NopEventManager::new();
let mut executor = InProcessExecutor::new(
&mut harness,
tuple_list!(),
&mut fuzzer,
&mut state,
&mut mgr,
)
.unwrap();
let mut executor = InProcessExecutor::builder()
.harness(&mut harness)
.observers(tuple_list!())
.fuzzer(&mut fuzzer)
.state(&mut state)
.event_mgr(&mut mgr)
.build()
.unwrap();

#[cfg(feature = "dump_cov")]
let mut stage = ReplayStage::with_hook(CoverageDumpHook::new(_dump_coverage_dir));
Expand Down
Loading
Loading