diff options
| author | Kostya Serebryany <kcc@google.com> | 2019-02-15 00:08:16 +0000 |
|---|---|---|
| committer | Kostya Serebryany <kcc@google.com> | 2019-02-15 00:08:16 +0000 |
| commit | 8c2791469deacae7e1a7a63ac9b1d3d5970ab681 (patch) | |
| tree | 909a271aa0ba4fb9deb78aca2bbf6b0959676de9 /compiler-rt/lib/fuzzer/FuzzerFork.cpp | |
| parent | 87498153aa12c672335e7ddb79972042832b8a66 (diff) | |
| download | bcm5719-llvm-8c2791469deacae7e1a7a63ac9b1d3d5970ab681.tar.gz bcm5719-llvm-8c2791469deacae7e1a7a63ac9b1d3d5970ab681.zip | |
[libFuzzer] when doing the merge, keep track of the coveraged edges, not just features
llvm-svn: 354087
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerFork.cpp')
| -rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerFork.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp index 7c82f3f046e..41fb5c1c57f 100644 --- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp @@ -72,7 +72,7 @@ struct GlobalEnv { Vector<std::string> CorpusDirs; std::string MainCorpusDir; std::string TempDir; - Set<uint32_t> Features; + Set<uint32_t> Features, Cov; Vector<std::string> Files; Random *Rand; int Verbosity = 0; @@ -122,9 +122,9 @@ struct GlobalEnv { GetSizedFilesFromDir(Job->CorpusDir, &TempFiles); Vector<std::string> FilesToAdd; - Set<uint32_t> NewFeatures; + Set<uint32_t> NewFeatures, NewCov; CrashResistantMerge(Args, {}, TempFiles, &FilesToAdd, Features, - &NewFeatures, Job->CFPath, false); + &NewFeatures, Cov, &NewCov, Job->CFPath, false); RemoveFile(Job->CFPath); for (auto &Path : FilesToAdd) { auto U = FileToVector(Path); @@ -134,11 +134,12 @@ struct GlobalEnv { } RmDirRecursive(Job->CorpusDir); Features.insert(NewFeatures.begin(), NewFeatures.end()); + Cov.insert(NewCov.begin(), NewCov.end()); auto Stats = ParseFinalStatsFromLog(Job->LogPath); NumRuns += Stats.number_of_executed_units; if (!FilesToAdd.empty()) - Printf("#%zd: ft: %zd corp: %zd exec/s %zd\n", NumRuns, - Features.size(), Files.size(), + Printf("#%zd: cov: %zd ft: %zd corp: %zd exec/s %zd\n", NumRuns, + Cov.size(), Features.size(), Files.size(), Stats.average_exec_per_sec); } }; @@ -202,6 +203,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options, auto CFPath = DirPlusFile(Env.TempDir, "merge.txt"); CrashResistantMerge(Env.Args, {}, SeedFiles, &Env.Files, {}, &Env.Features, + {}, &Env.Cov, CFPath, false); RemoveFile(CFPath); Printf("INFO: -fork=%d: %zd seeds, starting to fuzz; scratch: %s\n", |

