[PATCH] D22610: [compiler-rt] Fix memmove/memcpy overlap detection on windows
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 09:05:03 PDT 2016
etienneb updated this revision to Diff 64909.
etienneb added a comment.
fix unittests
https://reviews.llvm.org/D22610
Files:
lib/asan/asan_interceptors.cc
lib/asan/tests/asan_str_test.cc
Index: lib/asan/tests/asan_str_test.cc
===================================================================
--- lib/asan/tests/asan_str_test.cc
+++ lib/asan/tests/asan_str_test.cc
@@ -456,13 +456,15 @@
// memmove().
#if !defined(__APPLE__) || !defined(MAC_OS_X_VERSION_10_7) || \
(MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
+#if PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE
// Check "memcpy". Use Ident() to avoid inlining.
memset(str, 'z', size);
Ident(memcpy)(str + 1, str + 11, 10);
Ident(memcpy)(str, str, 0);
EXPECT_DEATH(Ident(memcpy)(str, str + 14, 15), OverlapErrorMessage("memcpy"));
EXPECT_DEATH(Ident(memcpy)(str + 14, str, 15), OverlapErrorMessage("memcpy"));
#endif
+#endif
// We do not treat memcpy with to==from as a bug.
// See http://llvm.org/bugs/show_bug.cgi?id=11763.
Index: lib/asan/asan_interceptors.cc
===================================================================
--- lib/asan/asan_interceptors.cc
+++ lib/asan/asan_interceptors.cc
@@ -725,11 +725,12 @@
InitializeCommonInterceptors();
// Intercept mem* functions.
- ASAN_INTERCEPT_FUNC(memcpy);
ASAN_INTERCEPT_FUNC(memset);
+ ASAN_INTERCEPT_FUNC(memmove);
if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) {
- // In asan, REAL(memmove) is not used, but it is used in msan.
- ASAN_INTERCEPT_FUNC(memmove);
+ ASAN_INTERCEPT_FUNC(memcpy);
+ } else {
+ *&REAL(memcpy) = REAL(memmove);
}
CHECK(REAL(memcpy));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22610.64909.patch
Type: text/x-patch
Size: 1459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160721/0e190fe4/attachment.bin>
More information about the llvm-commits
mailing list