Skip to content

Commit be12516

Browse files
committed
[forkserver_libafl_cc] Adjust test fuzzer
* Remove 1 second per testcase timeout. The crashes are taking longer and are erroneously treated as a timeout * Add a max input length parameter akin to AFL++'s afl-fuzz CLI args so that the mutations are more likely to find the objective (crash) * Set the default test to length 10 as the two potential crashes can be found mutating the first 3 or 4 bytes
1 parent c4519de commit be12516

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

fuzzers/forkserver/forkserver_libafl_cc/Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ run: fuzzer
5656
[macos]
5757
test: fuzzer
5858
#!/bin/bash
59-
timeout 30s {{ FORKSERVER }} ./{{ FUZZER_NAME }} ./corpus/ -t 1000 | tee fuzz_stdout.log || true
59+
timeout 30s {{ FORKSERVER }} -G 10 ./{{ FUZZER_NAME }} ./corpus/ | tee fuzz_stdout.log || true
6060
if grep -qa "objectives: 1" fuzz_stdout.log; then
6161
echo "Fuzzer is working"
6262
else

fuzzers/forkserver/forkserver_libafl_cc/src/main.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ use clap::Parser;
55
use libafl::{
66
corpus::{Corpus, InMemoryCorpus, OnDiskCorpus},
77
events::SimpleEventManager,
8-
executors::{forkserver::ForkserverExecutor, HasObservers, StdChildArgs},
8+
executors::{
9+
forkserver::{ForkserverExecutor, MAX_INPUT_SIZE_DEFAULT},
10+
HasObservers, StdChildArgs,
11+
},
912
feedback_and_fast, feedback_or,
1013
feedbacks::{CrashFeedback, MaxMapFeedback, TimeFeedback},
1114
fuzzer::{Fuzzer, StdFuzzer},
@@ -42,6 +45,14 @@ struct Opt {
4245
)]
4346
executable: String,
4447

48+
#[arg(
49+
help = "set max length of generated fuzz input",
50+
short = 'G',
51+
long = "maxlen",
52+
default_value_t = MAX_INPUT_SIZE_DEFAULT
53+
)]
54+
max_input_len: usize,
55+
4556
#[arg(
4657
help = "The directory to read initial inputs from ('seeds')",
4758
name = "INPUT_DIR",
@@ -180,6 +191,7 @@ pub fn main() {
180191
.parse_afl_cmdline(args)
181192
.coverage_map_size(MAP_SIZE)
182193
.timeout(Duration::from_millis(opt.timeout))
194+
.max_input_size(opt.max_input_len)
183195
.kill_signal(opt.signal)
184196
.build(tuple_list!(time_observer, edges_observer))
185197
.unwrap();

0 commit comments

Comments
 (0)