make multicore optional

This commit is contained in:
Alwin Berger 2022-02-27 22:16:55 +01:00
parent a6294af2c3
commit 5d08f3a9d7

View File

@ -302,7 +302,7 @@ fn fuzz(
});
//====== Child Function
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| -> std::result::Result<(), libafl::Error> {
//====== Set up Emu and termination-point
let emu = Emulator::new(&args, &env);
@ -467,6 +467,7 @@ fn fuzz(
#[cfg(unix)]
let file_null = File::open("/dev/null")?;
#[cfg(unix)]
#[cfg(feature = "multicore")]
{
let null_fd = file_null.as_raw_fd();
dup2(null_fd, io::stdout().as_raw_fd())?;
@ -482,6 +483,9 @@ fn fuzz(
};
// Multicore Variant
#[cfg(feature = "multicore")]
{
match Launcher::builder()
.shmem_provider(shmem_provider)
.configuration(EventConfig::AlwaysUnique)
@ -498,4 +502,13 @@ fn fuzz(
Err(e) => panic!("{:?}", e),
};
Ok(())
}
// Simple Variant
#[cfg(not(feature = "multicore"))]
{
let stats = SimpleStats::new(|s| println!("{}", s));
let mgr = SimpleEventManager::new(stats);
run_client(None, mgr, 0)
}
}