Add a script for running multiple fuzzing sessions on multiple cores

This commit is contained in:
teor 2016-12-13 16:23:12 +11:00 committed by Nick Mathewson
parent 416e2f6b28
commit 0fb1156e9f
2 changed files with 35 additions and 0 deletions

View File

@ -42,6 +42,7 @@ To Run:
../afl/afl-fuzz -i src/test/fuzz/fuzz_dir_testcase -o src/test/fuzz/fuzz_dir_findings -m <asan-memory-limit> -- src/test/fuzz_dir
AFL has a multi-core mode, check the documentation for details.
You might find the included fuzz-multi.sh script useful for this.
macOS (OS X) requires slightly more preparation, including:
* using afl-clang (or afl-clang-fast from the llvm directory)

34
src/test/fuzz_multi.sh Executable file
View File

@ -0,0 +1,34 @@
MEMLIMIT_BYTES=21990500990976
N_CPUS=1
if [ $# -ge 1 ]; then
N_CPUS="$1"
shift
fi
FILTER=echo
for i in `seq -w "$N_CPUS"`; do
if [ "$i" -eq 1 ]; then
if [ "$N_CPUS" -eq 1 ]; then
INSTANCE=""
NUMBER=""
else
INSTANCE="-M"
NUMBER="$i"
fi
else
INSTANCE="-S"
NUMBER="$i"
fi
# use whatever remains on the command-line to prefix the fuzzer command
# you have to copy and paste and run these commands yourself
"$FILTER" "$@" \
../afl/afl-fuzz \
-i src/test/fuzz/fuzz_dir_testcase \
-o src/test/fuzz/fuzz_dir_findings \
-x src/test/fuzz/fuzz_dir_dictionary/fuzz_dir_http_header.dct \
-m "$MEMLIMIT_BYTES" \
"$INSTANCE" "$NUMBER" \
-- src/test/fuzz_dir
done