summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Fuzzer/FuzzerExtFunctions.def2
-rw-r--r--llvm/lib/Fuzzer/FuzzerInternal.h7
-rw-r--r--llvm/lib/Fuzzer/FuzzerLoop.cpp39
-rw-r--r--llvm/lib/Fuzzer/test/fuzzer-printcovpcs.test1
4 files changed, 2 insertions, 47 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerExtFunctions.def b/llvm/lib/Fuzzer/FuzzerExtFunctions.def
index e5cb3a7d9bb..b34670f85b4 100644
--- a/llvm/lib/Fuzzer/FuzzerExtFunctions.def
+++ b/llvm/lib/Fuzzer/FuzzerExtFunctions.def
@@ -29,8 +29,6 @@ EXT_FUNC(LLVMFuzzerCustomCrossOver, size_t,
EXT_FUNC(__lsan_enable, void, (), false);
EXT_FUNC(__lsan_disable, void, (), false);
EXT_FUNC(__lsan_do_recoverable_leak_check, int, (), false);
-EXT_FUNC(__sanitizer_set_coverage_pc_buffer, void, (uintptr_t*, uintptr_t), false);
-EXT_FUNC(__sanitizer_get_coverage_pc_buffer_pos, uintptr_t, (), false);
EXT_FUNC(__sanitizer_get_number_of_counters, size_t, (), false);
EXT_FUNC(__sanitizer_install_malloc_and_free_hooks, int,
(void (*malloc_hook)(const volatile void *, size_t),
diff --git a/llvm/lib/Fuzzer/FuzzerInternal.h b/llvm/lib/Fuzzer/FuzzerInternal.h
index 49f6a6a7cf3..cbbae0af151 100644
--- a/llvm/lib/Fuzzer/FuzzerInternal.h
+++ b/llvm/lib/Fuzzer/FuzzerInternal.h
@@ -118,8 +118,6 @@ private:
void AddToCorpusAndMaybeRerun(const Unit &U);
void CheckExitOnSrcPos();
- bool UpdateMaxCoverage();
-
// Trace-based fuzzing: we run a unit with some kind of tracing
// enabled and record potentially useful mutations. Then
// We apply these mutations one by one to the unit and run it again.
@@ -166,11 +164,6 @@ private:
size_t MaxInputLen = 0;
size_t MaxMutationLen = 0;
- // For -print_pcs
- uintptr_t* PcBuffer = nullptr;
- size_t PcBufferLen = 0;
- size_t PcBufferPos = 0, PrevPcBufferPos = 0;
-
// Need to know our own thread.
static thread_local bool IsMyThread;
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp
index 8ef86f22ff1..f7d0b156a5b 100644
--- a/llvm/lib/Fuzzer/FuzzerLoop.cpp
+++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp
@@ -63,11 +63,8 @@ void Fuzzer::ResetEdgeCoverage() {
}
void Fuzzer::ResetCounters() {
- if (Options.UseCounters) {
+ if (Options.UseCounters)
EF->__sanitizer_update_counter_bitset_and_clear_counters(0);
- }
- if (EF->__sanitizer_get_coverage_pc_buffer_pos)
- PcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos();
}
void Fuzzer::PrepareCounters(Fuzzer::Coverage *C) {
@@ -116,19 +113,6 @@ bool Fuzzer::RecordMaxCoverage(Fuzzer::Coverage *C) {
if (TPC.UpdateValueProfileMap(&C->VPMap))
Res = true;
- if (EF->__sanitizer_get_coverage_pc_buffer_pos) {
- uint64_t NewPcBufferPos = EF->__sanitizer_get_coverage_pc_buffer_pos();
- if (NewPcBufferPos > PcBufferPos) {
- Res = true;
- PcBufferPos = NewPcBufferPos;
- }
-
- if (PcBufferLen && NewPcBufferPos >= PcBufferLen) {
- Printf("ERROR: PC buffer overflow\n");
- _Exit(1);
- }
- }
-
return Res;
}
@@ -171,11 +155,6 @@ Fuzzer::Fuzzer(UserCallback CB, InputCorpus &Corpus, MutationDispatcher &MD,
TPC.SetUseCounters(Options.UseCounters);
TPC.SetUseValueProfile(Options.UseValueProfile);
- if (Options.PrintNewCovPcs) {
- PcBufferLen = 1 << 24;
- PcBuffer = new uintptr_t[PcBufferLen];
- EF->__sanitizer_set_coverage_pc_buffer(PcBuffer, PcBufferLen);
- }
if (Options.Verbosity)
TPC.PrintModuleInfo();
if (!Options.OutputCorpus.empty() && Options.Reload)
@@ -451,18 +430,11 @@ void Fuzzer::ShuffleAndMinimize(UnitVector *InitialCorpus) {
}
}
-bool Fuzzer::UpdateMaxCoverage() {
- PrevPcBufferPos = PcBufferPos;
- bool Res = RecordMaxCoverage(&MaxCoverage);
-
- return Res;
-}
-
bool Fuzzer::RunOne(const uint8_t *Data, size_t Size) {
TotalNumberOfRuns++;
ExecuteCallback(Data, Size);
- bool Res = UpdateMaxCoverage();
+ bool Res = RecordMaxCoverage(&MaxCoverage);
auto TimeOfUnit =
duration_cast<seconds>(UnitStopTime - UnitStartTime).count();
@@ -561,13 +533,6 @@ void Fuzzer::PrintOneNewPC(uintptr_t PC) {
void Fuzzer::PrintNewPCs() {
if (!Options.PrintNewCovPcs) return;
- if (PrevPcBufferPos != PcBufferPos) {
- int NumPrinted = 0;
- for (size_t I = PrevPcBufferPos; I < PcBufferPos; ++I) {
- if (NumPrinted++ > 30) break; // Don't print too many new PCs.
- PrintOneNewPC(PcBuffer[I]);
- }
- }
uintptr_t *PCIDs;
if (size_t NumNewPCIDs = TPC.GetNewPCIDs(&PCIDs))
for (size_t i = 0; i < NumNewPCIDs; i++)
diff --git a/llvm/lib/Fuzzer/test/fuzzer-printcovpcs.test b/llvm/lib/Fuzzer/test/fuzzer-printcovpcs.test
index 721e50dcbe7..e3ef0a5e693 100644
--- a/llvm/lib/Fuzzer/test/fuzzer-printcovpcs.test
+++ b/llvm/lib/Fuzzer/test/fuzzer-printcovpcs.test
@@ -1,4 +1,3 @@
-RUN: LLVMFuzzer-SimpleTest -print_pcs=1 -seed=1 2>&1 | FileCheck %s --check-prefix=PCS
RUN: LLVMFuzzer-SimpleTest-TracePC -print_pcs=1 -seed=1 2>&1 | FileCheck %s --check-prefix=PCS
PCS-NOT: NEW_PC
PCS:INITED
OpenPOWER on IntegriCloud