[libFuzzer] Add INFO output when LLVMFuzzerCustomMutator is found.

Summary:
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.

Reviewers: kcc, metzman

Reviewed By: metzman

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D73136
This commit is contained in:
Max Moroz 2020-01-22 12:56:16 -08:00
parent 8ded83ff7e
commit 15f1d5d144
2 changed files with 6 additions and 1 deletions

View File

@ -195,8 +195,11 @@ static void ParseFlags(const Vector<std::string> &Args,
}
// 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++) {

View File

@ -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