From d1c685ccf9d98f3b33c1af1c5dcb8bddbf75ab7c Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Sun, 29 May 2022 00:45:17 +0200 Subject: [PATCH] prepare for benchmarking new features for mutators fuzzer corpus in memory for benchmarking showmap single file input --- fuzzers/wcet_qemu_sys/Cargo.toml | 4 +++ fuzzers/wcet_qemu_sys/Makefile | 33 +++++++++++++++--------- fuzzers/wcet_qemu_sys/src/bin/fuzzer.rs | 28 +++++++++++++++++--- fuzzers/wcet_qemu_sys/src/bin/showmap.rs | 4 +-- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/fuzzers/wcet_qemu_sys/Cargo.toml b/fuzzers/wcet_qemu_sys/Cargo.toml index a200fd110e..769772a60f 100644 --- a/fuzzers/wcet_qemu_sys/Cargo.toml +++ b/fuzzers/wcet_qemu_sys/Cargo.toml @@ -27,7 +27,11 @@ obj_trace = [] obj_edges = [] obj_ticks = [] +muta_input = [ "sched_graph" ] muta_snip = [ "sched_graph" ] +muta_suffix = [ "sched_graph" ] + +benchmark = [] # don't save corpus to disk, easy parallelizable [profile.release] debug = true diff --git a/fuzzers/wcet_qemu_sys/Makefile b/fuzzers/wcet_qemu_sys/Makefile index a6120ca39e..86057c2a23 100644 --- a/fuzzers/wcet_qemu_sys/Makefile +++ b/fuzzers/wcet_qemu_sys/Makefile @@ -1,50 +1,59 @@ BENCHDIR = target/bench TARGET = tmr.axf -EXAMPLE = "\xff\05\x84\x84\x84\x84\x84\x84\x84\x84" -TARGET_TRACE = tmp/target_trace.ron -TARGET_EDGES = tmp/target_edges.ron +TARGET_TRACE = $(BENCHDIR)/traces/tmr_worst.ron +TARGET_EDGES = $(BENCHDIR)/edges/tmr_worst.ron $(BENCHDIR)/bin: mkdir -p $@ $(BENCHDIR)/bin/fuzz_vanilla: $(BENCHDIR)/bin - cargo build --features feed_afl,sched_queue + cargo build --features benchmark,feed_afl,sched_mapmax cp target/debug/fuzzer $@ $(BENCHDIR)/bin/fuzz_state: $(BENCHDIR)/bin - cargo build --features feed_state,sched_state + cargo build --features benchmark,feed_state,sched_state cp target/debug/fuzzer $@ $(BENCHDIR)/bin/fuzz_graph: $(BENCHDIR)/bin - cargo build --features feed_graph,sched_graph + cargo build --features benchmark,feed_graph,sched_graph cp target/debug/fuzzer $@ $(BENCHDIR)/bin/fuzz_graph_snip: $(BENCHDIR)/bin - cargo build --features feed_graph,sched_graph,muta_snip + cargo build --features benchmark,feed_graph,sched_graph,muta_snip,muta_input,muta_suffix cp target/debug/fuzzer $@ $(BENCHDIR)/bin/fuzz_graph_afl: $(BENCHDIR)/bin - cargo build --features feed_graph,sched_graph,feed_afl + cargo build --features benchmark,feed_graph,sched_graph,feed_afl cp target/debug/fuzzer $@ $(BENCHDIR)/bin/fuzz_graph_all: $(BENCHDIR)/bin - cargo build --features feed_graph,sched_graph,feed_afl,muta_snip + cargo build --features benchmark,feed_graph,sched_graph,feed_afl,muta_snip,muta_input,muta_suffix cp target/debug/fuzzer $@ binaries: $(BENCHDIR)/bin/fuzz_vanilla $(BENCHDIR)/bin/fuzz_state $(BENCHDIR)/bin/fuzz_graph $(BENCHDIR)/bin/fuzz_graph_snip $(BENCHDIR)/bin/fuzz_graph_afl $(BENCHDIR)/bin/fuzz_graph_all # variants: vanilla, state, graph, graph_snip, graph_afl, graph_all $(BENCHDIR)/bench_%.log: $(BENCHDIR)/bin/fuzz_% $(TARGET_TRACE) - for i in {1..5}; do ./fuzzer_bench.sh $< $(TARGET) --libafl-traces $(TARGET_TRACE) > $@_$$i; done + for i in {1..1}; do ./fuzzer_bench.sh $< $(TARGET) --libafl-traces $(TARGET_TRACE) --libafl-exectimes $@.exec_$$i > $@_$$i; done for i in $@_*; do tail -n 1 $$i >> $@; done benchmarks: target/bench/bench_vanilla.log target/bench/bench_state.log target/bench/bench_graph.log target/bench/bench_graph_snip.log target/bench/bench_graph_afl.log target/bench/bench_graph_all.log -all: binaries +all: binaries benchmarks clean_bench: rm -rf $(BENCHDIR)/bench_* clean: rm -rf target/bench - \ No newline at end of file + +%.case: %_inputs + mkdir -p $(BENCHDIR)/traces $(BENCHDIR)/edges + for i in $ { let in_dir = PathBuf::from(res.value_of("in").unwrap().to_string()); @@ -353,7 +353,7 @@ fn fuzz( } unsafe { - libafl_int_offset = 347780+int_tick.unwrap_or(0); + // libafl_int_offset = 347780+int_tick.unwrap_or(0); // INTR_OFFSET = int_tick; emu.write_mem(test_length_ptr,&(len as u32).to_le_bytes()); emu.write_mem(input_addr,buf);