mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 10:56:01 +00:00
[libFuzzer] avoid msan false positives in more cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb30028464
commit
c7ab3c7402
@ -44,6 +44,13 @@
|
||||
#define ATTRIBUTE_TARGET_POPCNT
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __clang__ // avoid gcc warning.
|
||||
# define ATTRIBUTE_NO_SANITIZE_MEMORY __attribute__((no_sanitize("memory")))
|
||||
#else
|
||||
# define ATTRIBUTE_NO_SANITIZE_MEMORY
|
||||
#endif
|
||||
|
||||
namespace fuzzer {
|
||||
|
||||
template <class T> T Min(T a, T b) { return a < b ? a : b; }
|
||||
|
@ -137,6 +137,7 @@ struct MallocFreeTracer {
|
||||
|
||||
static MallocFreeTracer AllocTracer;
|
||||
|
||||
ATTRIBUTE_NO_SANITIZE_MEMORY
|
||||
void MallocHook(const volatile void *ptr, size_t size) {
|
||||
size_t N = AllocTracer.Mallocs++;
|
||||
F->HandleMalloc(size);
|
||||
@ -146,6 +147,8 @@ void MallocHook(const volatile void *ptr, size_t size) {
|
||||
EF->__sanitizer_print_stack_trace();
|
||||
}
|
||||
}
|
||||
|
||||
ATTRIBUTE_NO_SANITIZE_MEMORY
|
||||
void FreeHook(const volatile void *ptr) {
|
||||
size_t N = AllocTracer.Frees++;
|
||||
if (int TraceLevel = AllocTracer.TraceLevel) {
|
||||
|
@ -198,9 +198,7 @@ void TracePC::PrintCoverage() {
|
||||
// For cmp instructions the interesting value is a XOR of the parameters.
|
||||
// The interesting value is mixed up with the PC and is then added to the map.
|
||||
|
||||
#ifdef __clang__ // avoid gcc warning.
|
||||
__attribute__((no_sanitize("memory")))
|
||||
#endif
|
||||
ATTRIBUTE_NO_SANITIZE_MEMORY
|
||||
void TracePC::AddValueForMemcmp(void *caller_pc, const void *s1, const void *s2,
|
||||
size_t n) {
|
||||
if (!n) return;
|
||||
@ -218,9 +216,7 @@ void TracePC::AddValueForMemcmp(void *caller_pc, const void *s1, const void *s2,
|
||||
TPC.HandleValueProfile((PC & 4095) | (Idx << 12));
|
||||
}
|
||||
|
||||
#ifdef __clang__ // avoid gcc warning.
|
||||
__attribute__((no_sanitize("memory")))
|
||||
#endif
|
||||
ATTRIBUTE_NO_SANITIZE_MEMORY
|
||||
void TracePC::AddValueForStrcmp(void *caller_pc, const char *s1, const char *s2,
|
||||
size_t n) {
|
||||
if (!n) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user