Qemu launcher bugfix (#2858)

* Fixed the issue where compilation failed under the simplemgr configuration.

* Fixed the issue where the crash handler would fail during rerun.

* update fmt

---------

Co-authored-by: h1k0 <h1k0naka@outlook.com>
This commit is contained in:
h1k0 2025-01-20 08:01:01 +08:00 committed by GitHub
parent a949452453
commit 9a64a53d12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 15 deletions

View File

@ -9,10 +9,9 @@ use libafl::{
Error, Error,
}; };
use libafl_bolts::{rands::StdRand, tuples::tuple_list}; use libafl_bolts::{rands::StdRand, tuples::tuple_list};
#[cfg(feature = "injections")]
use libafl_qemu::modules::injections::InjectionModule;
use libafl_qemu::modules::{ use libafl_qemu::modules::{
asan::AsanModule, asan_guest::AsanGuestModule, cmplog::CmpLogModule, DrCovModule, asan::AsanModule, asan_guest::AsanGuestModule, cmplog::CmpLogModule, DrCovModule,
InjectionModule,
}; };
use crate::{ use crate::{
@ -75,7 +74,7 @@ impl Client<'_> {
} }
#[cfg(not(feature = "injections"))] #[cfg(not(feature = "injections"))]
let injection_module = None; let injection_module = Option::<InjectionModule>::None;
#[cfg(feature = "injections")] #[cfg(feature = "injections")]
let injection_module = self let injection_module = self
@ -95,10 +94,14 @@ impl Client<'_> {
let is_cmplog = self.options.is_cmplog_core(core_id); let is_cmplog = self.options.is_cmplog_core(core_id);
let extra_tokens = injection_module let extra_tokens = if cfg!(feature = "injections") {
.as_ref() injection_module
.map(|h| h.tokens.clone()) .as_ref()
.unwrap_or_default(); .map(|h| h.tokens.clone())
.unwrap_or_default()
} else {
Vec::new()
};
let instance_builder = Instance::builder() let instance_builder = Instance::builder()
.options(self.options) .options(self.options)

View File

@ -129,7 +129,11 @@ impl Fuzzer {
} }
#[cfg(feature = "simplemgr")] #[cfg(feature = "simplemgr")]
return client.run(None, SimpleEventManager::new(monitor), CoreId(0)); return client.run(
None,
SimpleEventManager::new(monitor),
ClientDescription::new(0, 0, CoreId(0)),
);
// Build and run the Launcher / fuzzer. // Build and run the Launcher / fuzzer.
#[cfg(not(feature = "simplemgr"))] #[cfg(not(feature = "simplemgr"))]

View File

@ -55,7 +55,7 @@ pub type ClientState =
StdState<InMemoryOnDiskCorpus<BytesInput>, BytesInput, StdRand, OnDiskCorpus<BytesInput>>; StdState<InMemoryOnDiskCorpus<BytesInput>, BytesInput, StdRand, OnDiskCorpus<BytesInput>>;
#[cfg(feature = "simplemgr")] #[cfg(feature = "simplemgr")]
pub type ClientMgr<M> = SimpleEventManager<M, ClientState>; pub type ClientMgr<M> = SimpleEventManager<BytesInput, M, ClientState>;
#[cfg(not(feature = "simplemgr"))] #[cfg(not(feature = "simplemgr"))]
pub type ClientMgr<M> = MonitorTypedEventManager< pub type ClientMgr<M> = MonitorTypedEventManager<
LlmpRestartingEventManager<(), BytesInput, ClientState, StdShMemProvider>, LlmpRestartingEventManager<(), BytesInput, ClientState, StdShMemProvider>,
@ -242,12 +242,7 @@ impl<M: Monitor> Instance<'_, M> {
)?; )?;
executor executor
.run_target( .run_target(&mut fuzzer, &mut state, &mut self.mgr, &input)
&mut NopFuzzer::new(),
&mut state,
&mut NopEventManager::new(),
&input,
)
.expect("Error running target"); .expect("Error running target");
// We're done :) // We're done :)
process::exit(0); process::exit(0);