Skip to content

Commit

Permalink
small fixes and enhancements (AFLplusplus#1731)
Browse files Browse the repository at this point in the history
* nits

* first steps

* different approach

* fixes

* remove temps

* remove temp

---------

Co-authored-by: Dongjia "toka" Zhang <[email protected]>
  • Loading branch information
vanhauser-thc and tokatoka authored Dec 17, 2023
1 parent ef8ebd5 commit 63e1523
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion fuzzers/qemu_launcher/src/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ impl<'a> Harness<'a> {
self.emu
.write_function_argument(CallingConvention::Cdecl, 1, len)
.map_err(|e| Error::unknown(format!("Failed to write argument 1: {e:}")))?;
unsafe { self.emu.run() };
unsafe {
let _ = self.emu.run();
};
Ok(())
}
}
2 changes: 1 addition & 1 deletion fuzzers/qemu_launcher/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<'a> Instance<'a> {
let mut executor = TimeoutExecutor::new(executor, self.options.timeout);

// Setup an havoc mutator with a mutational stage
let mutator = StdScheduledMutator::new(havoc_mutations());
let mutator = StdScheduledMutator::new(havoc_mutations().merge(tokens_mutations()));
let mut stages = tuple_list!(StdMutationalStage::new(mutator));

self.fuzz(&mut state, &mut fuzzer, &mut executor, &mut stages)
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/qemu_launcher/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use crate::version::Version;
long_about = "Binary fuzzer using QEMU binary instrumentation"
)]
pub struct FuzzerOptions {
#[arg(long, help = "Input directory")]
#[arg(short, long, help = "Input directory")]
pub input: String,

#[arg(long, help = "Output directory")]
#[arg(short, long, help = "Output directory")]
pub output: String,

#[arg(long, help = "Tokens file")]
Expand Down
8 changes: 8 additions & 0 deletions libafl_qemu/src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ pub struct EasyElf<'a> {
}

impl<'a> EasyElf<'a> {
pub fn get_needed(&self) -> Result<Vec<&'a str>, Error> {
let mut v: Vec<&str> = Vec::new();
for dyn_lib in &self.elf.libraries {
v.push(dyn_lib);
}
Ok(v)
}

pub fn from_file<P>(path: P, buffer: &'a mut Vec<u8>) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand Down
2 changes: 1 addition & 1 deletion libafl_qemu/src/emu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ impl Emulator {
}

#[must_use]
pub(crate) fn new_empty() -> Emulator {
pub fn new_empty() -> Emulator {
Emulator { _private: () }
}

Expand Down
2 changes: 1 addition & 1 deletion libafl_qemu/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ where
QT: QemuHelperTuple<S>,
{
if hooks.match_helper::<QemuAsanHelper>().is_none() {
// The ASan helper, if present, will call the tracer hook for the snpahsot helper as opt
// The ASan helper, if present, will call the tracer hook for the snapshot helper as opt
hooks.writes(
Hook::Empty,
Hook::Function(trace_write1_snapshot::<QT, S>),
Expand Down

0 comments on commit 63e1523

Please sign in to comment.