aboutsummaryrefslogtreecommitdiff
path: root/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2020-05-19 10:28:18 -0700
committerMatt Morehouse <mascasa@google.com>2020-05-19 10:28:57 -0700
commite2e38fca64e49d684de0b100437fe2f227f8fcdd (patch)
tree6cafffe95803cc6e81e76825146178420b479ebe /compiler-rt/lib/fuzzer/FuzzerDriver.cpp
parent0980c9c6f155d8a06ad839d530636bf109aae34b (diff)
downloadllvm-e2e38fca64e49d684de0b100437fe2f227f8fcdd.zip
llvm-e2e38fca64e49d684de0b100437fe2f227f8fcdd.tar.gz
llvm-e2e38fca64e49d684de0b100437fe2f227f8fcdd.tar.bz2
Entropic: Boosting LibFuzzer Performance
Summary: This is collaboration between Marcel Boehme @ Monash, Australia and Valentin Manès plus Sang Kil Cha @ KAIST, South Korea. We have made a few modifications to boost LibFuzzer performance by changing how weights are assigned to the seeds in the corpus. Essentially, seeds that reveal more "information" about globally rare features are assigned a higher weight. Our results on the Fuzzer Test Suite seem quite promising. In terms of bug finding, our Entropic patch usually finds the same errors much faster and in more runs. In terms of coverage, our version Entropic achieves the same coverage in less than half the time for the majority of subjects. For the lack of space, we shared more detailed performance results directly with @kcc. We'll publish the preprint with all the technical details as soon as it is accepted. Happy to share if you drop us an email. There should be plenty of opportunities to optimise further. For instance, while Entropic achieves the same coverage in less than half the time, Entropic has a much lower #execs per second. We ran the perf-tool and found a few performance bottlenecks. Thanks for open-sourcing LibFuzzer (and the entire LLVM Compiler Infrastructure)! This has been such a tremendous help to my research. Patch By: Marcel Boehme Reviewers: kcc, metzman, morehouse, Dor1s, vitalybuka Reviewed By: kcc Subscribers: dgg5503, Valentin, llvm-commits, kcc Tags: #llvm Differential Revision: https://reviews.llvm.org/D73776
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerDriver.cpp')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerDriver.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 0d4e468..1a0b258 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -708,6 +708,26 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
Options.CollectDataFlow = Flags.collect_data_flow;
if (Flags.stop_file)
Options.StopFile = Flags.stop_file;
+ Options.Entropic = Flags.entropic;
+ Options.EntropicFeatureFrequencyThreshold =
+ (size_t)Flags.entropic_feature_frequency_threshold;
+ Options.EntropicNumberOfRarestFeatures =
+ (size_t)Flags.entropic_number_of_rarest_features;
+ if (Options.Entropic) {
+ if (!Options.FocusFunction.empty()) {
+ Printf("ERROR: The parameters `--entropic` and `--focus_function` cannot "
+ "be used together.\n");
+ exit(1);
+ }
+ Printf("INFO: Running with entropic power schedule (0x%X, %d).\n",
+ Options.EntropicFeatureFrequencyThreshold,
+ Options.EntropicNumberOfRarestFeatures);
+ }
+ struct EntropicOptions Entropic;
+ Entropic.Enabled = Options.Entropic;
+ Entropic.FeatureFrequencyThreshold =
+ Options.EntropicFeatureFrequencyThreshold;
+ Entropic.NumberOfRarestFeatures = Options.EntropicNumberOfRarestFeatures;
unsigned Seed = Flags.seed;
// Initialize Seed.
@@ -728,7 +748,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
Random Rand(Seed);
auto *MD = new MutationDispatcher(Rand, Options);
- auto *Corpus = new InputCorpus(Options.OutputCorpus);
+ auto *Corpus = new InputCorpus(Options.OutputCorpus, Entropic);
auto *F = new Fuzzer(Callback, *Corpus, *MD, Options);
for (auto &U: Dictionary)