diff options
author | Jonathan Metzman <metzman@chromium.org> | 2019-04-30 20:56:18 +0000 |
---|---|---|
committer | Jonathan Metzman <metzman@chromium.org> | 2019-04-30 20:56:18 +0000 |
commit | f3ee97731eb524e9c7bc6911c205a38e643dfff4 (patch) | |
tree | 4e2bb339020d1c0221c5d798cf91f01ab906108f /compiler-rt/lib/fuzzer/FuzzerFork.cpp | |
parent | eeae45dc77d227d0376e381708e5ece4760ededb (diff) | |
download | bcm5719-llvm-f3ee97731eb524e9c7bc6911c205a38e643dfff4.tar.gz bcm5719-llvm-f3ee97731eb524e9c7bc6911c205a38e643dfff4.zip |
[libFuzzer] Replace -seed_corpus to better support fork mode on Win
Summary:
Pass seed corpus list in a file to get around argument length limits on Windows.
This limit was preventing many uses of fork mode on Windows.
Reviewers: kcc, morehouse
Reviewed By: kcc
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D60980
llvm-svn: 359610
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerFork.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerFork.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp index 9d338aa4708..dd16ec1e288 100644 --- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp @@ -66,6 +66,7 @@ struct FuzzJob { std::string CorpusDir; std::string FeaturesDir; std::string LogPath; + std::string SeedListPath; std::string CFPath; // Fuzzing Outputs. @@ -74,6 +75,7 @@ struct FuzzJob { ~FuzzJob() { RemoveFile(CFPath); RemoveFile(LogPath); + RemoveFile(SeedListPath); RmDirRecursive(CorpusDir); RmDirRecursive(FeaturesDir); } @@ -121,8 +123,11 @@ struct GlobalEnv { for (size_t i = 0; i < CorpusSubsetSize; i++) Seeds += (Seeds.empty() ? "" : ",") + Files[Rand->SkewTowardsLast(Files.size())]; - if (!Seeds.empty()) - Cmd.addFlag("seed_inputs", Seeds); + if (!Seeds.empty()) { + Job->SeedListPath = std::to_string(JobId) + ".seeds"; + WriteToFile(Seeds, Job->SeedListPath); + Cmd.addFlag("seed_inputs", "@" + Job->SeedListPath); + } Job->LogPath = DirPlusFile(TempDir, std::to_string(JobId) + ".log"); Job->CorpusDir = DirPlusFile(TempDir, "C" + std::to_string(JobId)); Job->FeaturesDir = DirPlusFile(TempDir, "F" + std::to_string(JobId)); |