Skip to content

Commit e565552

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 e565552

2 files changed

Lines changed: 11 additions & 1 deletion

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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use core::time::Duration;
22
use std::path::PathBuf;
33

44
use clap::Parser;
5+
use libafl::executors::forkserver::MAX_INPUT_SIZE_DEFAULT;
56
use libafl::{
67
corpus::{Corpus, InMemoryCorpus, OnDiskCorpus},
78
events::SimpleEventManager,
@@ -42,6 +43,14 @@ struct Opt {
4243
)]
4344
executable: String,
4445

46+
#[arg(
47+
help = "set max length of generated fuzz input",
48+
short = 'G',
49+
long = "maxlen",
50+
default_value_t = MAX_INPUT_SIZE_DEFAULT
51+
)]
52+
max_input_len: usize,
53+
4554
#[arg(
4655
help = "The directory to read initial inputs from ('seeds')",
4756
name = "INPUT_DIR",
@@ -180,6 +189,7 @@ pub fn main() {
180189
.parse_afl_cmdline(args)
181190
.coverage_map_size(MAP_SIZE)
182191
.timeout(Duration::from_millis(opt.timeout))
192+
.max_input_size(opt.max_input_len)
183193
.kill_signal(opt.signal)
184194
.build(tuple_list!(time_observer, edges_observer))
185195
.unwrap();

0 commit comments

Comments
 (0)