[PATCH] D73136: [libFuzzer] Add INFO output when LLVMFuzzerCustomMutator is found.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 13:00:59 PST 2020


Dor1s created this revision.
Dor1s added reviewers: kcc, metzman.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

there is an ongoing work on interchangeable custom mutators
(https://github.com/google/clusterfuzz/pull/1333/files#r367706283)
and having some sort of signalling from libFuzzer that it has loaded
a custom mutator would be helpful.

The initial idea was to make the mutator to print something, but given
the anticipated variety of different mutators, it does not seem possible
to make all of them print the same message to signal their execution.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73136

Files:
  compiler-rt/lib/fuzzer/FuzzerDriver.cpp
  compiler-rt/test/fuzzer/fuzzer-custommutator.test


Index: compiler-rt/test/fuzzer/fuzzer-custommutator.test
===================================================================
--- compiler-rt/test/fuzzer/fuzzer-custommutator.test
+++ compiler-rt/test/fuzzer/fuzzer-custommutator.test
@@ -1,11 +1,13 @@
 RUN: %cpp_compiler %S/CustomMutatorTest.cpp -o %t-CustomMutatorTest
 RUN: not %run %t-CustomMutatorTest 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomMutator
+LLVMFuzzerCustomMutator: INFO: found LLVMFuzzerCustomMutator
 LLVMFuzzerCustomMutator: In LLVMFuzzerCustomMutator
 LLVMFuzzerCustomMutator: {{.*}} lim: 4096 {{.*}}
 LLVMFuzzerCustomMutator: BINGO
 
 # len_control is disabled for custom mutators by default, test that it can be enabled.
 RUN: not %run %t-CustomMutatorTest -len_control=100 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomMutatorWithLenControl
+LLVMFuzzerCustomMutatorWithLenControl: INFO: found LLVMFuzzerCustomMutator
 LLVMFuzzerCustomMutatorWithLenControl: In LLVMFuzzerCustomMutator
 LLVMFuzzerCustomMutatorWithLenControl: {{.*}} lim: {{[1-9][0-9]?}} {{.*}}
 LLVMFuzzerCustomMutatorWithLenControl: BINGO
Index: compiler-rt/lib/fuzzer/FuzzerDriver.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -195,8 +195,11 @@
   }
 
   // Disable len_control by default, if LLVMFuzzerCustomMutator is used.
-  if (EF->LLVMFuzzerCustomMutator)
+  if (EF->LLVMFuzzerCustomMutator) {
     Flags.len_control = 0;
+    Printf("INFO: found LLVMFuzzerCustomMutator (%p). "
+           "Disabling -len_control by default.\n", EF->LLVMFuzzerCustomMutator);
+  }
 
   Inputs = new Vector<std::string>;
   for (size_t A = 1; A < Args.size(); A++) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73136.239417.patch
Type: text/x-patch
Size: 1728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/5b8cd6f9/attachment.bin>


More information about the llvm-commits mailing list