[llvm] r251133 - [libFuzzer] remove some old code; also make __sanitizer_get_total_unique_caller_callee_pairs weak so that newer libFuzzer works with older asan
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 11:37:58 PDT 2015
Author: kcc
Date: Fri Oct 23 13:37:58 2015
New Revision: 251133
URL: http://llvm.org/viewvc/llvm-project?rev=251133&view=rev
Log:
[libFuzzer] remove some old code; also make __sanitizer_get_total_unique_caller_callee_pairs weak so that newer libFuzzer works with older asan
Modified:
llvm/trunk/lib/Fuzzer/FuzzerInterface.cpp
llvm/trunk/lib/Fuzzer/FuzzerInterface.h
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerInterface.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInterface.cpp?rev=251133&r1=251132&r2=251133&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInterface.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInterface.cpp Fri Oct 23 13:37:58 2015
@@ -19,9 +19,6 @@ void FuzzerRandomLibc::ResetSeed(int see
size_t FuzzerRandomLibc::Rand() { return rand(); }
-UserSuppliedFuzzer::UserSuppliedFuzzer()
- : OwnRand(true), Rand(new FuzzerRandomLibc(0)), MD(*Rand) {}
-
UserSuppliedFuzzer::UserSuppliedFuzzer(FuzzerRandomBase *Rand)
: Rand(Rand), MD(*Rand) {}
Modified: llvm/trunk/lib/Fuzzer/FuzzerInterface.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInterface.h?rev=251133&r1=251132&r2=251133&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInterface.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInterface.h Fri Oct 23 13:37:58 2015
@@ -23,7 +23,6 @@
namespace fuzzer {
-typedef void (*DeprecatedUserCallback)(const uint8_t *Data, size_t Size);
/// Returns an int 0. Values other than zero are reserved for future.
typedef int (*UserCallback)(const uint8_t *Data, size_t Size);
/** Simple C-like interface with a single user-supplied callback.
@@ -46,7 +45,6 @@ int main(int argc, char **argv) {
#\endcode
*/
int FuzzerDriver(int argc, char **argv, UserCallback Callback);
-int FuzzerDriver(int argc, char **argv, DeprecatedUserCallback Callback);
class FuzzerRandomBase {
public:
@@ -137,7 +135,6 @@ int main(int argc, char **argv) {
*/
class UserSuppliedFuzzer {
public:
- UserSuppliedFuzzer(); // Deprecated, don't use.
UserSuppliedFuzzer(FuzzerRandomBase *Rand);
/// Executes the target function on 'Size' bytes of 'Data'.
virtual int TargetFunction(const uint8_t *Data, size_t Size) = 0;
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=251133&r1=251132&r2=251133&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Fri Oct 23 13:37:58 2015
@@ -186,17 +186,11 @@ class SimpleUserSuppliedFuzzer: public U
SimpleUserSuppliedFuzzer(FuzzerRandomBase *Rand, UserCallback Callback)
: UserSuppliedFuzzer(Rand), Callback(Callback) {}
- SimpleUserSuppliedFuzzer(FuzzerRandomBase *Rand, DeprecatedUserCallback Callback)
- : UserSuppliedFuzzer(Rand), DeprecatedCallback(Callback) {}
-
virtual int TargetFunction(const uint8_t *Data, size_t Size) override {
- if (Callback) return Callback(Data, Size);
- DeprecatedCallback(Data, Size);
- return 0;
+ return Callback(Data, Size);
}
private:
- DeprecatedUserCallback DeprecatedCallback = nullptr;
UserCallback Callback = nullptr;
};
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=251133&r1=251132&r2=251133&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Fri Oct 23 13:37:58 2015
@@ -15,6 +15,7 @@
extern "C" {
__attribute__((weak)) void __sanitizer_print_stack_trace();
+__attribute__((weak)) size_t __sanitizer_get_total_unique_caller_callee_pairs();
}
namespace fuzzer {
@@ -207,6 +208,8 @@ size_t Fuzzer::RecordBlockCoverage() {
size_t Fuzzer::RecordCallerCalleeCoverage() {
if (!Options.UseIndirCalls)
return 0;
+ if (!__sanitizer_get_total_unique_caller_callee_pairs)
+ return 0;
return LastRecordedCallerCalleeCoverage =
__sanitizer_get_total_unique_caller_callee_pairs();
}
More information about the llvm-commits
mailing list