Skip to content

Commit 46ed908

Browse files
committed
fuzz: improve iteration strategy, logging, and corpus minimization
Replace the fixed 30s run_time with iteration counts scaled to 8x corpus size (plus a 1000 baseline) with a 10-minute hard cap. This ensures small targets finish quickly while large ones get adequate fuzzing time. Additional changes: - Use -q (quiet) to suppress per-iteration status output - Log corpus size before/after fuzzing with delta - Increase per-input timeout to 3s for chanmon_consistency_target - On main, run corpus minimization after each target and report the minimized corpus size AI tools were used in preparing this commit.
1 parent 99a7716 commit 46ed908

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

fuzz/ci-fuzz.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,34 @@ cargo --color always hfuzz build -j8
3333
for TARGET in src/bin/*.rs; do
3434
FILENAME=$(basename $TARGET)
3535
FILE="${FILENAME%.*}"
36-
HFUZZ_RUN_ARGS="--exit_upon_crash -v -n8 --run_time 30"
37-
if [ "$FILE" = "chanmon_consistency_target" -o "$FILE" = "fs_store_target" ]; then
36+
CORPUS_DIR="hfuzz_workspace/$FILE/input"
37+
CORPUS_COUNT=$(find "$CORPUS_DIR" -type f 2>/dev/null | wc -l)
38+
ITERATIONS=$((CORPUS_COUNT * 8 + 1000))
39+
HFUZZ_RUN_ARGS="--exit_upon_crash -q -n8 -N $ITERATIONS --run_time 600"
40+
if [ "$FILE" = "chanmon_consistency_target" ]; then
41+
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -F 64 -t 3"
42+
elif [ "$FILE" = "fs_store_target" ]; then
3843
HFUZZ_RUN_ARGS="$HFUZZ_RUN_ARGS -F 64"
3944
fi
4045
export HFUZZ_RUN_ARGS
4146
cargo --color always hfuzz run $FILE
47+
FUZZ_CORPUS_COUNT=$(find "$CORPUS_DIR" -type f 2>/dev/null | wc -l)
48+
FUZZ_DELTA=$((FUZZ_CORPUS_COUNT - CORPUS_COUNT))
4249
if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
4350
cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
4451
for CASE in hfuzz_workspace/$FILE/SIG*; do
4552
cat $CASE | xxd -p
4653
done
4754
exit 1
4855
fi
56+
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
57+
HFUZZ_RUN_ARGS="-M -q -n8 -t 3"
58+
export HFUZZ_RUN_ARGS
59+
cargo --color always hfuzz run $FILE
60+
MIN_CORPUS_COUNT=$(find "$CORPUS_DIR" -type f 2>/dev/null | wc -l)
61+
MIN_DELTA=$((MIN_CORPUS_COUNT - FUZZ_CORPUS_COUNT))
62+
echo "$FILE: original=$CORPUS_COUNT, after fuzz=$FUZZ_CORPUS_COUNT [+$FUZZ_DELTA], after minimize=$MIN_CORPUS_COUNT [$MIN_DELTA]"
63+
else
64+
echo "$FILE: original=$CORPUS_COUNT, after fuzz=$FUZZ_CORPUS_COUNT [+$FUZZ_DELTA]"
65+
fi
4966
done

0 commit comments

Comments
 (0)