Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qemu launcher bugfix #2858

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
17 changes: 10 additions & 7 deletions fuzzers/binary_only/qemu_launcher/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ use libafl::{
Error,
};
use libafl_bolts::{rands::StdRand, tuples::tuple_list};
#[cfg(feature = "injections")]
use libafl_qemu::modules::injections::InjectionModule;
use libafl_qemu::modules::{
asan::AsanModule, asan_guest::AsanGuestModule, cmplog::CmpLogModule, DrCovModule,
InjectionModule,
};

use crate::{
Expand Down Expand Up @@ -75,7 +74,7 @@ impl Client<'_> {
}

#[cfg(not(feature = "injections"))]
let injection_module = None;
let injection_module = Option::<InjectionModule>::None;
tokatoka marked this conversation as resolved.
Show resolved Hide resolved

#[cfg(feature = "injections")]
let injection_module = self
Expand All @@ -95,10 +94,14 @@ impl Client<'_> {

let is_cmplog = self.options.is_cmplog_core(core_id);

let extra_tokens = injection_module
.as_ref()
.map(|h| h.tokens.clone())
.unwrap_or_default();
let extra_tokens = if cfg!(feature = "injections") {
injection_module
.as_ref()
.map(|h| h.tokens.clone())
.unwrap_or_default()
} else {
Vec::new()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmalmain is there a better option for this? .maybe_extra_token that takes a Some or so?
Also, we should find a way to add CI for this

};

let instance_builder = Instance::builder()
.options(self.options)
Expand Down
6 changes: 5 additions & 1 deletion fuzzers/binary_only/qemu_launcher/src/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ impl Fuzzer {
}

#[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.
#[cfg(not(feature = "simplemgr"))]
Expand Down
9 changes: 2 additions & 7 deletions fuzzers/binary_only/qemu_launcher/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub type ClientState =
StdState<BytesInput, InMemoryOnDiskCorpus<BytesInput>, StdRand, OnDiskCorpus<BytesInput>>;

#[cfg(feature = "simplemgr")]
pub type ClientMgr<M> = SimpleEventManager<M, ClientState>;
pub type ClientMgr<M> = SimpleEventManager<BytesInput, M, ClientState>;
#[cfg(not(feature = "simplemgr"))]
pub type ClientMgr<M> =
MonitorTypedEventManager<LlmpRestartingEventManager<(), ClientState, StdShMemProvider>, M>;
Expand Down Expand Up @@ -240,12 +240,7 @@ impl<M: Monitor> Instance<'_, M> {
)?;

executor
.run_target(
&mut NopFuzzer::new(),
&mut state,
&mut NopEventManager::new(),
&input,
)
.run_target(&mut fuzzer, &mut state, &mut self.mgr, &input)
.expect("Error running target");
// We're done :)
process::exit(0);
Expand Down
Loading