[PATCH] D27052: [compiler-rt][asan] Fix overlaping parameters for memmove/memcpy on windows.

Etienne Bergeron via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 08:43:48 PST 2016


etienneb updated this revision to Diff 80603.
etienneb marked 7 inline comments as done.
etienneb added a comment.

split and simplify patch


https://reviews.llvm.org/D27052

Files:
  lib/asan/asan_interceptors.cc


Index: lib/asan/asan_interceptors.cc
===================================================================
--- lib/asan/asan_interceptors.cc
+++ lib/asan/asan_interceptors.cc
@@ -454,17 +454,17 @@
 INTERCEPTOR(void*, memcpy, void *to, const void *from, uptr size) {
   void *ctx;
   ASAN_INTERCEPTOR_ENTER(ctx, memcpy);
-#if !SANITIZER_MAC
-  ASAN_MEMCPY_IMPL(ctx, to, from, size);
-#else
-  // 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.
-  ASAN_MEMMOVE_IMPL(ctx, to, from, size);
-#endif  // !SANITIZER_MAC
+  if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) {
+    ASAN_MEMCPY_IMPL(ctx, to, from, size);
+  } else {
+    // 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.
+    ASAN_MEMMOVE_IMPL(ctx, to, from, size);
+  }
 }
 
 INTERCEPTOR(void*, memset, void *block, int c, uptr size) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27052.80603.patch
Type: text/x-patch
Size: 1471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161207/4f0984a1/attachment.bin>


More information about the llvm-commits mailing list