diff options
author | Max Moroz <mmoroz@chromium.org> | 2018-07-16 14:54:23 +0000 |
---|---|---|
committer | Max Moroz <mmoroz@chromium.org> | 2018-07-16 14:54:23 +0000 |
commit | 2156d885e0cffd767ec955c607b94ad774c6474c (patch) | |
tree | b18c79a0698798f3c797d10634b67d6112ca4693 /compiler-rt/lib/fuzzer/FuzzerDriver.cpp | |
parent | 1f0b194b4a51623aec90594e92df635ab5444251 (diff) | |
download | bcm5719-llvm-2156d885e0cffd767ec955c607b94ad774c6474c.tar.gz bcm5719-llvm-2156d885e0cffd767ec955c607b94ad774c6474c.zip |
[libFuzzer] Implement stat::stability_rate based on the percentage of unstable edges.
Summary:
Created a -print_unstable_stats flag.
When -print_unstable_stats=1, we run it 2 more times on interesting inputs poisoning unstable edges in an array.
On program termination, we run PrintUnstableStats() which will print a line with a stability percentage like AFL does.
Patch by Kyungtak Woo (@kevinwkt).
Reviewers: metzman, Dor1s, kcc, morehouse
Reviewed By: metzman, Dor1s, morehouse
Subscribers: delcypher, llvm-commits, #sanitizers, kcc, morehouse, Dor1s
Differential Revision: https://reviews.llvm.org/D49212
llvm-svn: 337175
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerDriver.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp index ff2a639ac4a..e73fb2b6c6b 100644 --- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp @@ -102,14 +102,14 @@ static void PrintHelp() { Printf("%d\t%s\n", D.Default, D.Description); } Printf("\nFlags starting with '--' will be ignored and " - "will be passed verbatim to subprocesses.\n"); + "will be passed verbatim to subprocesses.\n"); } static const char *FlagValue(const char *Param, const char *Name) { size_t Len = strlen(Name); if (Param[0] == '-' && strstr(Param + 1, Name) == Param + 1 && Param[Len + 1] == '=') - return &Param[Len + 2]; + return &Param[Len + 2]; return nullptr; } @@ -302,10 +302,10 @@ static std::string GetDedupTokenFromFile(const std::string &Path) { } int CleanseCrashInput(const Vector<std::string> &Args, - const FuzzingOptions &Options) { + const FuzzingOptions &Options) { if (Inputs->size() != 1 || !Flags.exact_artifact_path) { Printf("ERROR: -cleanse_crash should be given one input file and" - " -exact_artifact_path\n"); + " -exact_artifact_path\n"); exit(1); } std::string InputFilePath = Inputs->at(0); @@ -520,7 +520,7 @@ int AnalyzeDictionary(Fuzzer *F, const Vector<Unit>& Dict, for (size_t i = 0; i < Dict.size(); ++i) { // Dictionary units with positive score are treated as useful ones. if (Scores[i] > 0) - continue; + continue; Printf("\""); PrintASCII(Dict[i].data(), Dict[i].size(), "\""); @@ -617,6 +617,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) { Options.PrintFinalStats = Flags.print_final_stats; Options.PrintCorpusStats = Flags.print_corpus_stats; Options.PrintCoverage = Flags.print_coverage; + Options.PrintUnstableStats = Flags.print_unstable_stats; Options.DumpCoverage = Flags.dump_coverage; if (Flags.exit_on_src_pos) Options.ExitOnSrcPos = Flags.exit_on_src_pos; |