114 lines
4.8 KiB
Makefile
114 lines
4.8 KiB
Makefile
BENCHDIR = target/bench
|
|
TNAME = tmrint
|
|
TARGET = $(TNAME).axf
|
|
TARGET_TRACE = $(BENCHDIR)/traces/$(TNAME)_worst.ron
|
|
TARGET_EDGES = $(BENCHDIR)/edges/$(TNAME)_worst.ron
|
|
RUNTIME = 3600
|
|
INT_FLAG = ,fuzz_interrupt
|
|
COMMON_FLAGS = benchmark,dump_infos#,$(INT_FLAG)
|
|
NUM_JOB = 3
|
|
NUM_ITERATIONS = 10
|
|
LOCKFILE = /tmp/bench_sem
|
|
LOCK = ./bash_sem.sh $(LOCKFILE) lock
|
|
RELEASE = ./bash_sem.sh $(LOCKFILE) release
|
|
|
|
$(BENCHDIR)/bin:
|
|
mkdir -p $@
|
|
|
|
$(BENCHDIR)/target_random:
|
|
cargo build --target-dir $@ --features $(COMMON_FLAGS),sched_queue,fuzz_random
|
|
|
|
$(BENCHDIR)/target_known_edges:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_known_edges,sched_queue
|
|
|
|
$(BENCHDIR)/target_afl_queue:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_afl,sched_queue
|
|
|
|
$(BENCHDIR)/target_afl_mapmax:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_afl,sched_mapmax
|
|
|
|
$(BENCHDIR)/target_state:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_state,sched_state
|
|
|
|
$(BENCHDIR)/target_state_afl:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_state,feed_afl,sched_state
|
|
|
|
$(BENCHDIR)/target_state_afl_int:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_state,sched_state,muta_interrupt
|
|
|
|
$(BENCHDIR)/target_graph:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_graph,sched_graph
|
|
|
|
$(BENCHDIR)/target_graph_muta:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_graph,sched_graph,muta_snip,muta_input,muta_suffix
|
|
|
|
$(BENCHDIR)/target_graph_afl:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_graph,sched_graph,feed_afl
|
|
|
|
$(BENCHDIR)/target_graph_muta_afl:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_graph,sched_graph,feed_afl,muta_snip,muta_input,muta_suffix
|
|
|
|
$(BENCHDIR)/target_graph_muta_afl_int:
|
|
cargo build --bin fuzzer --target-dir $@ --features $(COMMON_FLAGS),feed_graph,sched_graph,feed_afl,muta_snip,muta_input,muta_suffix,muta_interrupt
|
|
|
|
binaries: $(BENCHDIR)/target_random $(BENCHDIR)/target_known_edges $(BENCHDIR)/target_afl_queue $(BENCHDIR)/target_afl_mapmax $(BENCHDIR)/target_state $(BENCHDIR)/target_state_afl $(BENCHDIR)/target_state_afl_int \
|
|
$(BENCHDIR)/target_graph $(BENCHDIR)/target_graph_muta $(BENCHDIR)/target_graph_afl $(BENCHDIR)/target_graph_muta_afl $(BENCHDIR)/target_graph_muta_afl_int
|
|
|
|
# variants: known_edges, afl_queue, afl_mapmax, state, state_afl, graph, graph_muta, graph_afl, graph_all
|
|
$(BENCHDIR)/bench_%.log: $(BENCHDIR)/target_% $(TARGET_TRACE)
|
|
mkdir -p $(BENCHDIR)/execs
|
|
for i in {1..$(NUM_ITERATIONS)}; do \
|
|
CASE=$$(basename -s.log $@ | cut -d'_' -f 2- ); \
|
|
[ -f $(BENCHDIR)/execs/$$CASE\_$$i.exec -a -f $@_$$i ] && continue; \
|
|
$(LOCK); \
|
|
echo $$CASE iteration $$i; \
|
|
mkdir -p $(BENCHDIR)/infos/$$CASE ; \
|
|
./bench_fuzzer.sh $</debug/fuzzer $(TARGET) --libafl-traces $(TARGET_TRACE) --libafl-fuzztime $(RUNTIME) \
|
|
--libafl-dump $(BENCHDIR)/infos/$$CASE/$$i \
|
|
--libafl-edges $(TARGET_EDGES) --libafl-exectimes $(BENCHDIR)/execs/$$CASE\_$$i.exec > $@_$$i && \
|
|
sed -i "1 i\\$$CASE " $(BENCHDIR)/execs/$$CASE\_$$i.exec && \
|
|
$(RELEASE) & \
|
|
done
|
|
wait
|
|
for i in $@_*; do grep Stats $$i | tail -n 1 >> $@; done
|
|
|
|
benchmarks_noint: target/bench/bench_known_edges.log target/bench/bench_afl_queue.log target/bench/bench_afl_mapmax.log target/bench/bench_state.log target/bench/bench_state_afl.log \
|
|
target/bench/bench_graph.log target/bench/bench_graph_muta.log target/bench/bench_graph_afl.log target/bench/bench_graph_muta_afl.log
|
|
# target/bench/bench_graph_all.log target/bench/bench_state_afl_int.log
|
|
|
|
benchmarks_int: target/bench/bench_graph_muta_afl.log target/bench/bench_graph_muta_afl_int.log target/bench/bench_state_afl.log target/bench/bench_state_afl_int.log target/bench/bench_afl_mapmax.log target/bench/bench_afl_queue.log
|
|
|
|
benchmark_random: target/bench/bench_random.log
|
|
|
|
all: binaries benchmarks_noint
|
|
|
|
clean_bench:
|
|
rm -rf $(BENCHDIR)/bench_*
|
|
|
|
clean_aggregate:
|
|
rm -rf $(BENCHDIR)/bench_*.log
|
|
|
|
clean:
|
|
rm -rf target/bench
|
|
echo $(NUM_JOB) > $(LOCKFILE)
|
|
rm -rf $(LOCKFILE)_lockdir
|
|
|
|
reset_sem:
|
|
echo $(NUM_JOB) > $(LOCKFILE)
|
|
rm -rf $(LOCKFILE)_lockdir
|
|
|
|
%.case: %_inputs $(BENCHDIR)/target_random
|
|
mkdir -p $(BENCHDIR)/traces $(BENCHDIR)/edges
|
|
for i in $</*.case; do \
|
|
CASE=$$(basename -s.case $$i); echo $$CASE; \
|
|
PROG=$$(basename -s.case $@); \
|
|
LD_LIBRARY_PATH=$(BENCHDIR)/target_random/debug $(BENCHDIR)/target_random/debug/showmap --libafl-snapshot tmp/dummy.qcow2 \
|
|
--libafl-out tmp/test_out --libafl-in tmp/test_in --libafl-kernel $(TARGET) \
|
|
--libafl-single $$i \
|
|
--libafl-edges $(BENCHDIR)/edges/$$PROG\_$$CASE.ron \
|
|
--libafl-traces $(BENCHDIR)/traces/$$PROG\_$$CASE.ron | \
|
|
grep "Qemu Ticks:"; \
|
|
done
|
|
|
|
$(TARGET_TRACE): $(TNAME).case
|