[PATCH] D73776: Entropic: Boosting LibFuzzer Performance

marcel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 21:54:17 PDT 2020


marcel marked 4 inline comments as done.
marcel added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp:595
   Random Rand(0);
-  std::unique_ptr<InputCorpus> C(new InputCorpus(""));
+  struct EntropicOptions Entropic = {false, 0xFF, 100};
+  std::unique_ptr<InputCorpus> C(new InputCorpus("", Entropic));
----------------
kcc wrote:
> When running 'ninja check-fuzzer' this test fails for me: 
> 
> That's weird: why does the functionality change with Entropic off? 
> 
> [5/9] Running Fuzzer unit tests
> FAIL: LLVMFuzzer-Unittest :: ./Fuzzer-x86_64-Test/Corpus.Distribution (48 of 55)
> ******************** TEST 'LLVMFuzzer-Unittest :: ./Fuzzer-x86_64-Test/Corpus.Distribution' FAILED ********************
> Note: Google Test filter = Corpus.Distribution
> [==========] Running 1 test from 1 test case.
> [----------] Global test environment set-up.
> [----------] 1 test from Corpus
> [ RUN      ] Corpus.Distribution
> /usr/local/google/home/kcc/llvm-project/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp:609: Failure
> Expected: (Hist[i]) > (TriesPerUnit / N / 3), actual: 0 vs 2184
> /usr/local/google/home/kcc/llvm-project/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp:609: Failure
> Expected: (Hist[i]) > (TriesPerUnit / N / 3), actual: 0 vs 2184
> /usr/local/google/home/kcc/llvm-project/compiler-rt/lib/fuzzer/tests/FuzzerUnittest.cpp:609: Failure
Instead of updating the corpus distribution every time it changes (e.g., FuzzerCorpus.h#L114 and FuzzerCorpus.h#L165), entropic schedules that update by setting a flag. For efficiency, only when (and just before) a new input is chosen, the corpus distribution is actually updated. I had this update in ChooseUnitToMutate which calls ChooseUnitIdxToMutate. Now moved the call to UpdateCorpusDistribution to ChooseUnitIdxToMutate (which is used by the test case).

All 40 fuzzer unit tests pass.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73776/new/

https://reviews.llvm.org/D73776





More information about the llvm-commits mailing list