summaryrefslogtreecommitdiff
path: root/lib/asan
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2016-12-27 21:13:11 +0000
committerVitaly Buka <vitalybuka@google.com>2016-12-27 21:13:11 +0000
commit165576e6bb7845056dda0d91e047073c65407cdd (patch)
tree2366f33db96245e6c790a5f521bc37d4d2d0deea /lib/asan
parentb24d223f432e9d785d42c70a68464b5928570373 (diff)
[compiler-rt] Move logic which replace memcpy interceptor with memmove from asan to sanitizer_common.
Reviewers: eugenis Subscribers: kubabrecka, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D28074 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290626 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan')
-rw-r--r--lib/asan/asan_interceptors.cc23
-rw-r--r--lib/asan/asan_internal.h11
-rw-r--r--lib/asan/asan_mac.cc9
3 files changed, 1 insertions, 42 deletions
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc
index 1ef3a4df0..606016d4f 100644
--- a/lib/asan/asan_interceptors.cc
+++ b/lib/asan/asan_interceptors.cc
@@ -250,20 +250,10 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void *)
ASAN_MEMMOVE_IMPL(ctx, to, from, size); \
} while (false)
-// At least on 10.7 and 10.8 both memcpy() and memmove() are being replaced
-// with WRAP(memcpy). As a result, false positives are reported for
-// memmove() calls. If we just disable error reporting with
-// ASAN_OPTIONS=replace_intrin=0, memmove() is still replaced with
-// internal_memcpy(), which may lead to crashes, see
-// http://llvm.org/bugs/show_bug.cgi?id=16362.
#define COMMON_INTERCEPTOR_MEMCPY_IMPL(ctx, to, from, size) \
do { \
ASAN_INTERCEPTOR_ENTER(ctx, memcpy); \
- if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) { \
- ASAN_MEMCPY_IMPL(ctx, to, from, size); \
- } else { \
- ASAN_MEMMOVE_IMPL(ctx, to, from, size); \
- } \
+ ASAN_MEMCPY_IMPL(ctx, to, from, size); \
} while (false)
#define COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, block, c, size) \
@@ -272,17 +262,6 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, void *)
ASAN_MEMSET_IMPL(ctx, block, c, size); \
} while (false)
-// In asan, REAL(memmove) is not used, but it is used in msan.
-#define COMMON_INTERCEPT_FUNCTION_MEMCPY() \
- do { \
- if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) { \
- ASAN_INTERCEPT_FUNC(memcpy); \
- } else { \
- ASSIGN_REAL(memcpy, memmove); \
- } \
- CHECK(REAL(memcpy)); \
- } while (false)
-
#include "sanitizer_common/sanitizer_common_interceptors.inc"
// Syscall interceptors don't have contexts, we don't support suppressions
diff --git a/lib/asan/asan_internal.h b/lib/asan/asan_internal.h
index a3fe062f7..1dc678c0c 100644
--- a/lib/asan/asan_internal.h
+++ b/lib/asan/asan_internal.h
@@ -103,17 +103,6 @@ void *AsanDlSymNext(const char *sym);
void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name);
-// Platform-specific options.
-#if SANITIZER_MAC
-bool PlatformHasDifferentMemcpyAndMemmove();
-# define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE \
- (PlatformHasDifferentMemcpyAndMemmove())
-#elif SANITIZER_WINDOWS64
-# define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE false
-#else
-# define PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE true
-#endif // SANITIZER_MAC
-
// Add convenient macro for interface functions that may be represented as
// weak hooks.
#define ASAN_MALLOC_HOOK(ptr, size) \
diff --git a/lib/asan/asan_mac.cc b/lib/asan/asan_mac.cc
index 525864f72..baf533ac9 100644
--- a/lib/asan/asan_mac.cc
+++ b/lib/asan/asan_mac.cc
@@ -49,15 +49,6 @@ namespace __asan {
void InitializePlatformInterceptors() {}
void InitializePlatformExceptionHandlers() {}
-bool PlatformHasDifferentMemcpyAndMemmove() {
- // On OS X 10.7 memcpy() and memmove() are both resolved
- // into memmove$VARIANT$sse42.
- // See also https://github.com/google/sanitizers/issues/34.
- // TODO(glider): need to check dynamically that memcpy() and memmove() are
- // actually the same function.
- return GetMacosVersion() == MACOS_VERSION_SNOW_LEOPARD;
-}
-
// No-op. Mac does not support static linkage anyway.
void *AsanDoesNotSupportStaticLinkage() {
return 0;