summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Fuzzer')
-rw-r--r--llvm/lib/Fuzzer/FuzzerDriver.cpp14
-rw-r--r--llvm/lib/Fuzzer/FuzzerFlags.def9
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h5
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp12
-rwxr-xr-xllvm/lib/Fuzzer/pull_and_push_fuzz_corpus.sh17
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer-timeout.test2
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer.test2
7 files changed, 10 insertions, 51 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerDriver.cpp b/llvm/lib/Fuzzer/FuzzerDriver.cpp
index 386caeffbc6..4e559b44fd3 100644
--- a/llvm/lib/Fuzzer/FuzzerDriver.cpp
+++ b/llvm/lib/Fuzzer/FuzzerDriver.cpp
@@ -293,9 +293,6 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
Options.MaxNumberOfRuns = Flags.runs;
if (!Inputs->empty())
Options.OutputCorpus = (*Inputs)[0];
- if (Flags.sync_command)
- Options.SyncCommand = Flags.sync_command;
- Options.SyncTimeout = Flags.sync_timeout;
Options.ReportSlowUnits = Flags.report_slow_units;
if (Flags.artifact_prefix)
Options.ArtifactPrefix = Flags.artifact_prefix;
@@ -307,7 +304,8 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
return 1;
if (Flags.verbosity > 0 && !Dictionary.empty())
Printf("Dictionary: %zd entries\n", Dictionary.size());
- Options.SaveArtifacts = !Flags.test_single_input;
+ bool DoPlainRun = AllInputsAreFiles();
+ Options.SaveArtifacts = !DoPlainRun;
Options.PrintNewCovPcs = Flags.print_new_cov_pcs;
Options.PrintFinalStats = Flags.print_final_stats;
@@ -337,12 +335,8 @@ static int FuzzerDriver(const std::vector<std::string> &Args,
if (Flags.handle_fpe) SetSigFpeHandler();
if (Flags.handle_int) SetSigIntHandler();
- if (Flags.test_single_input) {
- RunOneTest(&F, Flags.test_single_input);
- exit(0);
- }
-
- if (AllInputsAreFiles()) {
+ if (DoPlainRun) {
+ Options.SaveArtifacts = false;
int Runs = std::max(1, Flags.runs);
Printf("%s: Running %zd inputs %d time(s) each.\n", ProgName->c_str(),
Inputs->size(), Runs);
diff --git a/llvm/lib/Fuzzer/FuzzerFlags.def b/llvm/lib/Fuzzer/FuzzerFlags.def
index caf3d55f46a..f794d32cb5d 100644
--- a/llvm/lib/Fuzzer/FuzzerFlags.def
+++ b/llvm/lib/Fuzzer/FuzzerFlags.def
@@ -52,16 +52,11 @@ FUZZER_FLAG_INT(workers, 0,
FUZZER_FLAG_INT(reload, 1,
"Reload the main corpus periodically to get new units"
" discovered by other processes.")
-FUZZER_FLAG_STRING(sync_command, "Execute an external command "
- "\"<sync_command> <test_corpus>\" "
- "to synchronize the test corpus.")
-FUZZER_FLAG_INT(sync_timeout, 600, "Minimum timeout between syncs.")
FUZZER_FLAG_INT(report_slow_units, 10,
"Report slowest units if they run for more than this number of seconds.")
FUZZER_FLAG_INT(only_ascii, 0,
"If 1, generate only ASCII (isprint+isspace) inputs.")
FUZZER_FLAG_STRING(dict, "Experimental. Use the dictionary file.")
-FUZZER_FLAG_STRING(test_single_input, "Use specified file as test input.")
FUZZER_FLAG_STRING(artifact_prefix, "Write fuzzing artifacts (crash, "
"timeout, or slow inputs) as "
"$(artifact_prefix)file")
@@ -82,5 +77,9 @@ FUZZER_FLAG_INT(handle_abrt, 1, "If 1, try to intercept SIGABRT.")
FUZZER_FLAG_INT(handle_ill, 1, "If 1, try to intercept SIGILL.")
FUZZER_FLAG_INT(handle_fpe, 1, "If 1, try to intercept SIGFPE.")
FUZZER_FLAG_INT(handle_int, 1, "If 1, try to intercept SIGINT.")
+
FUZZER_DEPRECATED_FLAG(exit_on_first)
FUZZER_DEPRECATED_FLAG(save_minimized_corpus)
+FUZZER_DEPRECATED_FLAG(sync_command)
+FUZZER_DEPRECATED_FLAG(sync_timeout)
+FUZZER_DEPRECATED_FLAG(test_single_input)
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 29a00507c0e..5c6abc7ff43 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -290,11 +290,9 @@ public:
bool ShuffleAtStartUp = true;
int PreferSmallDuringInitialShuffle = -1;
size_t MaxNumberOfRuns = ULONG_MAX;
- int SyncTimeout = 600;
int ReportSlowUnits = 10;
bool OnlyASCII = false;
std::string OutputCorpus;
- std::string SyncCommand;
std::string ArtifactPrefix = "./";
std::string ExactArtifactPath;
bool SaveArtifacts = true;
@@ -365,8 +363,6 @@ private:
// Must be called whenever the corpus or unit weights are changed.
void UpdateCorpusDistribution();
- void SyncCorpus();
-
size_t RecordBlockCoverage();
size_t RecordCallerCalleeCoverage();
void PrepareCoverageBeforeRun();
@@ -412,7 +408,6 @@ private:
MutationDispatcher &MD;
FuzzingOptions Options;
system_clock::time_point ProcessStartTime = system_clock::now();
- system_clock::time_point LastExternalSync = system_clock::now();
system_clock::time_point UnitStartTime;
long TimeOfLongestUnitInSeconds = 0;
long EpochOfLastReadOfOutputCorpus = 0;
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 3492f7f5b27..4f3b5a7bd35 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -561,7 +561,6 @@ void Fuzzer::Loop() {
if (Options.DoCrossOver)
MD.SetCorpus(&Corpus);
while (true) {
- SyncCorpus();
auto Now = system_clock::now();
if (duration_cast<seconds>(Now - LastCorpusReload).count()) {
RereadOutputCorpus(Options.MaxLen);
@@ -581,17 +580,6 @@ void Fuzzer::Loop() {
MD.PrintRecommendedDictionary();
}
-void Fuzzer::SyncCorpus() {
- if (Options.SyncCommand.empty() || Options.OutputCorpus.empty())
- return;
- auto Now = system_clock::now();
- if (duration_cast<seconds>(Now - LastExternalSync).count() <
- Options.SyncTimeout)
- return;
- LastExternalSync = Now;
- ExecuteCommand(Options.SyncCommand + " " + Options.OutputCorpus);
-}
-
void Fuzzer::UpdateCorpusDistribution() {
size_t N = Corpus.size();
std::vector<double> Intervals(N + 1);
diff --git a/llvm/lib/Fuzzer/pull_and_push_fuzz_corpus.sh b/llvm/lib/Fuzzer/pull_and_push_fuzz_corpus.sh
deleted file mode 100755
index 05c322c6e5b..00000000000
--- a/llvm/lib/Fuzzer/pull_and_push_fuzz_corpus.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-# A simple script to synchronise a fuzz test corpus
-# with an external git repository.
-# Usage:
-# pull_and_push_fuzz_corpus.sh DIR
-# It assumes that DIR is inside a git repo and push
-# can be done w/o typing a password.
-cd $1
-git add *
-git commit -m "fuzz test corpus"
-git pull --rebase --no-edit
-for((attempt=0; attempt<5; attempt++)); do
- echo GIT PUSH $1 ATTEMPT $attempt
- if $(git push); then break; fi
- git pull --rebase --no-edit
-done
-
diff --git a/llvm/lib/Fuzzer/test/fuzzer-timeout.test b/llvm/lib/Fuzzer/test/fuzzer-timeout.test
index 1c08871ddb8..2defef6ac7d 100644
--- a/llvm/lib/Fuzzer/test/fuzzer-timeout.test
+++ b/llvm/lib/Fuzzer/test/fuzzer-timeout.test
@@ -7,7 +7,7 @@ TimeoutTest: #1
TimeoutTest: #2
TimeoutTest: SUMMARY: libFuzzer: timeout
-RUN: not LLVMFuzzer-TimeoutTest -timeout=1 -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInputTimeoutTest
+RUN: not LLVMFuzzer-TimeoutTest -timeout=1 %S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInputTimeoutTest
SingleInputTimeoutTest: ALARM: working on the last Unit for
SingleInputTimeoutTest-NOT: Test unit written to ./timeout-
diff --git a/llvm/lib/Fuzzer/test/fuzzer.test b/llvm/lib/Fuzzer/test/fuzzer.test
index 0822995825b..95d0ecaf9ab 100644
--- a/llvm/lib/Fuzzer/test/fuzzer.test
+++ b/llvm/lib/Fuzzer/test/fuzzer.test
@@ -2,7 +2,7 @@ CHECK: BINGO
Done1000000: Done 1000000 runs in
RUN: LLVMFuzzer-SimpleTest 2>&1 | FileCheck %s
-RUN: not LLVMFuzzer-NullDerefTest -test_single_input=%S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInput
+RUN: not LLVMFuzzer-NullDerefTest %S/hi.txt 2>&1 | FileCheck %s --check-prefix=SingleInput
SingleInput-NOT: Test unit written to ./crash-
RUN: LLVMFuzzer-SimpleCmpTest -max_total_time=1 2>&1 | FileCheck %s --check-prefix=MaxTotalTime
OpenPOWER on IntegriCloud