[libFuzzer] Scale energy assigned to each input based on input execution time.
authorDokyung Song <dokyungs@google.com>
Mon, 17 Aug 2020 16:59:59 +0000 (16:59 +0000)
committerDokyung Song <dokyungs@google.com>
Thu, 3 Sep 2020 20:38:20 +0000 (20:38 +0000)
commit5cda4dc7b4d28fcd11307d4234c513ff779a1c6f
tree4cc9c6f58c14dc3c632bf68ebfee2a0e0bdadfe9
parent952dc7f288a271e53bae6fa082ad045ade39ffb3
[libFuzzer] Scale energy assigned to each input based on input execution time.

This patch scales the energy computed by the Entropic schedule based on the
execution time of each input. The input execution time is compared with the
average execution time of inputs in the corpus, and, based on the amount by
which they differ, the energy is scaled from 0.1x (for inputs executing slow) to
3x (for inputs executing fast). Note that the exact scaling criteria and formula
is borrowed from AFL.

On FuzzBench, this gives a sizeable throughput increase, which in turn leads to
more coverage on several benchmarks. For details, see the following report.

https://storage.googleapis.com/fuzzer-test-suite-public/exectime-report/index.html

Differential Revision: https://reviews.llvm.org/D86092
compiler-rt/lib/fuzzer/FuzzerCorpus.h
compiler-rt/lib/fuzzer/FuzzerDriver.cpp
compiler-rt/lib/fuzzer/FuzzerFlags.def
compiler-rt/lib/fuzzer/FuzzerLoop.cpp
compiler-rt/lib/fuzzer/FuzzerOptions.h
compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp
compiler-rt/test/fuzzer/EntropicScalePerExecTimeTest.cpp [new file with mode: 0644]
compiler-rt/test/fuzzer/entropic-scale-per-exec-time.test [new file with mode: 0644]