From acbdac865d1e4e9942299d75faf3aca3101f2d58 Mon Sep 17 00:00:00 2001 From: Paul Grandperrin Date: Tue, 24 Apr 2018 18:54:32 +0200 Subject: [PATCH] Add continuous fuzzing script for libFuzzer --- ...rb => continuous-fuzzing-with-honggfuzz.rb | 4 ++-- continuous-fuzzing-with-libfuzzer.rb | 19 +++++++++++++++++++ fuzz-with-libfuzzer.sh | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) rename continuous-fuzzing.rb => continuous-fuzzing-with-honggfuzz.rb (100%) create mode 100755 continuous-fuzzing-with-libfuzzer.rb diff --git a/continuous-fuzzing.rb b/continuous-fuzzing-with-honggfuzz.rb similarity index 100% rename from continuous-fuzzing.rb rename to continuous-fuzzing-with-honggfuzz.rb index fbf3fc9..c70a686 100755 --- a/continuous-fuzzing.rb +++ b/continuous-fuzzing-with-honggfuzz.rb @@ -7,13 +7,13 @@ end loop do - system 'cd fuzzer-honggfuzz; cargo update' - File.open("targets.txt").each do |line| target, weight = line.split time = weight.to_i * time_mul.to_i system "HFUZZ_RUN_ARGS=\"--run_time #{time} $HFUZZ_RUN_ARGS\" ./fuzz-with-honggfuzz.sh #{target}" end + + system 'cd fuzzer-honggfuzz; cargo update' end diff --git a/continuous-fuzzing-with-libfuzzer.rb b/continuous-fuzzing-with-libfuzzer.rb new file mode 100755 index 0000000..886b8b8 --- /dev/null +++ b/continuous-fuzzing-with-libfuzzer.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +if ARGV.size >= 1 + time_mul = ARGV[0] +else + time_mul = 10 +end + +loop do + File.open("targets.txt").each do |line| + target, weight = line.split + time = weight.to_i * time_mul.to_i + + system "LIBFUZZER_ARGS=\"-max_total_time=#{time} $LIBFUZZER_ARGS\" ./fuzz-with-libfuzzer.sh #{target}" + end + + system 'cd fuzzer-libfuzzer; cargo update' +end + diff --git a/fuzz-with-libfuzzer.sh b/fuzz-with-libfuzzer.sh index 6c99b41..46adfa5 100755 --- a/fuzz-with-libfuzzer.sh +++ b/fuzz-with-libfuzzer.sh @@ -38,4 +38,4 @@ else fi mkdir -p "corpus-$1" -cargo run --target $TARGET --bin "$1" -- "corpus-$1" $SEEDS +cargo run --target $TARGET --bin "$1" -- "corpus-$1" $SEEDS $LIBFUZZER_ARGS