[llvm] r282831 - [libFuzzer] remove the code for -print_pcs=1 with the old coverage. It still works with the new one (trace-pc-guard)
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 29 18:24:58 PDT 2016
Author: kcc
Date: Thu Sep 29 20:24:57 2016
New Revision: 282831
URL: http://llvm.org/viewvc/llvm-project?rev=282831&view=rev
Log:
[libFuzzer] remove the code for -print_pcs=1 with the old coverage. It still works with the new one (trace-pc-guard)
Modified:
llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.def
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/test/fuzzer-printcovpcs.test
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.def?rev=282831&r1=282830&r2=282831&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.def (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.def Thu Sep 29 20:24:57 2016
@@ -29,8 +29,6 @@ EXT_FUNC(LLVMFuzzerCustomCrossOver, size
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),
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=282831&r1=282830&r2=282831&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Thu Sep 29 20:24:57 2016
@@ -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;
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=282831&r1=282830&r2=282831&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Thu Sep 29 20:24:57 2016
@@ -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::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, InputCor
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(UnitVect
}
}
-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++)
Modified: llvm/trunk/lib/Fuzzer/test/fuzzer-printcovpcs.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/test/fuzzer-printcovpcs.test?rev=282831&r1=282830&r2=282831&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/test/fuzzer-printcovpcs.test (original)
+++ llvm/trunk/lib/Fuzzer/test/fuzzer-printcovpcs.test Thu Sep 29 20:24:57 2016
@@ -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
More information about the llvm-commits
mailing list