[libFuzzer] remove two unused experimental flags

llvm-svn: 353573
This commit is contained in:
Kostya Serebryany 2019-02-08 22:02:37 +00:00
parent 3edf63c55a
commit b1e8b8149b
7 changed files with 4 additions and 91 deletions

View File

@ -478,8 +478,7 @@ void FuzzWithFork(const FuzzingOptions &Options,
auto CFPath = TempPath(".fork");
Printf("INFO: -fork=1: doing fuzzing in a separate process in order to "
"be more resistant to crashes, timeouts, and OOMs\n");
auto Files =
CrashResistantMerge(Args, Corpora, CFPath, nullptr, nullptr);
auto Files = CrashResistantMerge(Args, Corpora, CFPath);
Printf("INFO: -fork=1: seed corpus analyzed, %zd seeds chosen, starting to "
"fuzz in separate processes\n", Files.size());
@ -738,9 +737,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
}
std::string CFPath =
Flags.merge_control_file ? Flags.merge_control_file : TempPath(".txt");
auto Files =
CrashResistantMerge(Args, *Inputs, CFPath, Flags.load_coverage_summary,
Flags.save_coverage_summary);
auto Files = CrashResistantMerge(Args, *Inputs, CFPath);
for (auto &Path : Files)
F->WriteToOutputCorpus(FileToVector(Path, Options.MaxLen));
// We are done, delete the control file if it was a temporary one.

View File

@ -52,13 +52,6 @@ FUZZER_FLAG_STRING(merge_control_file,
"If a merge process gets killed it tries to leave this file "
"in a state suitable for resuming the merge. "
"By default a temporary file will be used.")
FUZZER_FLAG_STRING(save_coverage_summary, "Experimental:"
" save coverage summary to a given file."
" Used with -merge=1")
FUZZER_FLAG_STRING(load_coverage_summary, "Experimental:"
" load coverage summary from a given file."
" Treat this coverage as belonging to the first corpus. "
" Used with -merge=1")
FUZZER_FLAG_INT(minimize_crash, 0, "If 1, minimizes the provided"
" crash input. Use with -runs=N or -max_total_time=N to limit "
"the number attempts."

View File

@ -168,16 +168,6 @@ size_t Merger::Merge(const Set<uint32_t> &InitialFeatures,
return AllFeatures.size() - InitialNumFeatures;
}
void Merger::PrintSummary(std::ostream &OS) {
for (auto &File : Files) {
OS << std::hex;
OS << File.Name << " size: " << File.Size << " features: ";
for (auto Feature : File.Features)
OS << " " << Feature;
OS << "\n";
}
}
Set<uint32_t> Merger::AllFeatures() const {
Set<uint32_t> S;
for (auto &File : Files)
@ -185,25 +175,6 @@ Set<uint32_t> Merger::AllFeatures() const {
return S;
}
Set<uint32_t> Merger::ParseSummary(std::istream &IS) {
std::string Line, Tmp;
Set<uint32_t> Res;
while (std::getline(IS, Line, '\n')) {
size_t N;
std::istringstream ISS1(Line);
ISS1 >> Tmp; // Name
ISS1 >> Tmp; // size:
assert(Tmp == "size:" && "Corrupt summary file");
ISS1 >> std::hex;
ISS1 >> N; // File Size
ISS1 >> Tmp; // features:
assert(Tmp == "features:" && "Corrupt summary file");
while (ISS1 >> std::hex >> N)
Res.insert(N);
}
return Res;
}
// Inner process. May crash if the target crashes.
void Fuzzer::CrashResistantMergeInternalStep(const std::string &CFPath) {
Printf("MERGE-INNER: using the control file '%s'\n", CFPath.c_str());
@ -278,9 +249,7 @@ static void WriteNewControlFile(const std::string &CFPath,
Vector<std::string>
CrashResistantMerge(const Vector<std::string> &Args,
const Vector<std::string> &Corpora,
const std::string &CFPath,
const char *CoverageSummaryInputPathOrNull,
const char *CoverageSummaryOutputPathOrNull) {
const std::string &CFPath) {
size_t NumAttempts = 0;
if (FileSize(CFPath)) {
Printf("MERGE-OUTER: non-empty control file provided: '%s'\n",
@ -354,19 +323,7 @@ CrashResistantMerge(const Vector<std::string> &Args,
IF.close();
Printf("MERGE-OUTER: consumed %zdMb (%zdMb rss) to parse the control file\n",
M.ApproximateMemoryConsumption() >> 20, GetPeakRSSMb());
if (CoverageSummaryOutputPathOrNull) {
Printf("MERGE-OUTER: writing coverage summary for %zd files to %s\n",
M.Files.size(), CoverageSummaryOutputPathOrNull);
std::ofstream SummaryOut(CoverageSummaryOutputPathOrNull);
M.PrintSummary(SummaryOut);
}
Set<uint32_t> InitialFeatures;
if (CoverageSummaryInputPathOrNull) {
std::ifstream SummaryIn(CoverageSummaryInputPathOrNull);
InitialFeatures = M.ParseSummary(SummaryIn);
Printf("MERGE-OUTER: coverage summary loaded from %s, %zd features found\n",
CoverageSummaryInputPathOrNull, InitialFeatures.size());
}
Vector<std::string> NewFiles;
size_t NumNewFeatures = M.Merge(InitialFeatures, &NewFiles);
Printf("MERGE-OUTER: %zd new files with %zd new features added\n",

View File

@ -63,8 +63,6 @@ struct Merger {
bool Parse(std::istream &IS, bool ParseCoverage);
bool Parse(const std::string &Str, bool ParseCoverage);
void ParseOrExit(std::istream &IS, bool ParseCoverage);
void PrintSummary(std::ostream &OS);
Set<uint32_t> ParseSummary(std::istream &IS);
size_t Merge(const Set<uint32_t> &InitialFeatures,
Vector<std::string> *NewFiles);
size_t ApproximateMemoryConsumption() const;
@ -74,9 +72,7 @@ struct Merger {
Vector<std::string>
CrashResistantMerge(const Vector<std::string> &Args,
const Vector<std::string> &Corpora,
const std::string &CFPath,
const char *CoverageSummaryInputPathOrNull,
const char *CoverageSummaryOutputPathOrNull);
const std::string &CFPath);
} // namespace fuzzer

View File

@ -645,10 +645,7 @@ static void Merge(const std::string &Input,
Merger M;
Vector<std::string> NewFiles;
EXPECT_TRUE(M.Parse(Input, true));
std::stringstream SS;
M.PrintSummary(SS);
EXPECT_EQ(NumNewFeatures, M.Merge({}, &NewFiles));
EXPECT_EQ(M.AllFeatures(), M.ParseSummary(SS));
EQ(NewFiles, Result);
}

View File

@ -28,16 +28,6 @@ RUN: %run %t/T.exe -merge=1 %t/T1 %t/T2 -merge_control_file=%t/MCF 2>&1 | FileCh
OK_0: MERGE-OUTER: control file ok, 3 files total, first not processed file 0
OK_0: MERGE-OUTER: 3 new files with {{.*}} new features added
RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
RUN: %run %t/T.exe -merge=1 %t/T1 %t/T2 -merge_control_file=%t/MCF -save_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=SAVE_SUMMARY
SAVE_SUMMARY: MERGE-OUTER: writing coverage summary for 3 files to {{.*}}/SUMMARY
RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
RUN: %run %t/T.exe -merge=1 %t/T1 %t/T2 -merge_control_file=%t/MCF -load_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=LOAD_SUMMARY
LOAD_SUMMARY: MERGE-OUTER: coverage summary loaded from
RUN: rm -f %t/T1/*; cp %t/T0/* %t/T1
RUN: echo 3 > %t/MCF; echo 0 >> %t/MCF; echo %t/T1/1 >> %t/MCF; echo %t/T1/2 >> %t/MCF; echo %t/T1/3 >> %t/MCF
RUN: echo STARTED 0 1 >> %t/MCF

View File

@ -1,17 +0,0 @@
RUN: %cpp_compiler %S/FullCoverageSetTest.cpp -o %t-FullCoverageSetTest
RUN: rm -rf %t/T1 %t/T2
RUN: mkdir -p %t/T0 %t/T1 %t/T2
RUN: echo ...Z.. > %t/T2/1
RUN: echo ....E. > %t/T2/2
RUN: echo .....R > %t/T2/3
RUN: echo F..... > %t/T2/a
RUN: echo .U.... > %t/T2/b
RUN: echo ..Z... > %t/T2/c
RUN: %run %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 -save_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=SAVE_SUMMARY
SAVE_SUMMARY: MERGE-OUTER: writing coverage summary for 6 files to {{.*}}SUMMARY
RUN: rm %t/T1/*
RUN: %run %t-FullCoverageSetTest -merge=1 %t/T1 %t/T2 -load_coverage_summary=%t/SUMMARY 2>&1 | FileCheck %s --check-prefix=LOAD_SUMMARY
LOAD_SUMMARY: MERGE-OUTER: coverage summary loaded from {{.*}}SUMMAR
LOAD_SUMMARY: MERGE-OUTER: 0 new files with 0 new features added