From 6d4f071eaa1827772e873f2a3ffb1d714fa3fd67 Mon Sep 17 00:00:00 2001 From: Aarnav Date: Wed, 31 Jul 2024 14:54:11 +0200 Subject: [PATCH] Misc libafl-fuzz improvements (#2463) * libafl-fuzz: ignore seeds that are not regular files * libafl-fuzz: remove 4 dict files limit * libafl-fuzz: clippy * libafl-fuzz: add -t option * libafl-fuzz: fix typo in seed feedback --- fuzzers/others/libafl-fuzz/src/corpus.rs | 11 +++++++++-- fuzzers/others/libafl-fuzz/src/feedback/seed.rs | 2 +- fuzzers/others/libafl-fuzz/src/main.rs | 11 +++++++---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fuzzers/others/libafl-fuzz/src/corpus.rs b/fuzzers/others/libafl-fuzz/src/corpus.rs index d6a862814d..cc95ff5106 100644 --- a/fuzzers/others/libafl-fuzz/src/corpus.rs +++ b/fuzzers/others/libafl-fuzz/src/corpus.rs @@ -144,13 +144,20 @@ pub fn check_autoresume( // Copy all our seeds to queue for file in std::fs::read_dir(intial_inputs)? { let path = file?.path(); - std::fs::copy( + let cpy_res = std::fs::copy( &path, queue_dir.join(path.file_name().ok_or(Error::illegal_state(format!( "file {} in input directory does not have a filename", path.display() )))?), - )?; + ); + if let Err(e) = cpy_res { + if matches!(e.kind(), io::ErrorKind::InvalidInput) { + println!("skipping {} since it is not a regular file", path.display()); + } else { + return Err(e.into()); + } + } } } Ok(file) diff --git a/fuzzers/others/libafl-fuzz/src/feedback/seed.rs b/fuzzers/others/libafl-fuzz/src/feedback/seed.rs index 6fd22d4b55..a3c2b82651 100644 --- a/fuzzers/others/libafl-fuzz/src/feedback/seed.rs +++ b/fuzzers/others/libafl-fuzz/src/feedback/seed.rs @@ -34,7 +34,7 @@ where pub fn new(inner: A, opt: &Opt) -> Self { Self { inner, - ignore_timeouts: opt.ignore_seed_issues, + ignore_timeouts: opt.ignore_timeouts, ignore_seed_issues: opt.ignore_seed_issues, exit_on_seed_issues: opt.exit_on_seed_issues, phantom: PhantomData, diff --git a/fuzzers/others/libafl-fuzz/src/main.rs b/fuzzers/others/libafl-fuzz/src/main.rs index 1991f14adc..4df2a894f7 100644 --- a/fuzzers/others/libafl-fuzz/src/main.rs +++ b/fuzzers/others/libafl-fuzz/src/main.rs @@ -134,8 +134,8 @@ struct Opt { /// sync to a foreign fuzzer queue directory (requires -M, can be specified up to 32 times) #[arg(short = 'F', num_args = 32)] foreign_sync_dirs: Vec, - /// fuzzer dictionary (see README.md, specify up to 4 times) - #[arg(short = 'x', num_args = 4)] + /// fuzzer dictionary (see README.md) + #[arg(short = 'x')] dicts: Vec, // Environment + CLI variables #[arg(short = 'G')] @@ -152,13 +152,16 @@ struct Opt { #[arg(short = 'V')] fuzz_for_seconds: Option, + /// timeout for each run + #[arg(short = 't', default_value_t = 1000)] + hang_timeout: u64, + // Environment Variables #[clap(skip)] bench_just_one: bool, #[clap(skip)] bench_until_crash: bool, - #[clap(skip)] - hang_timeout: u64, + #[clap(skip)] debug_child: bool, #[clap(skip)]