[PATCH] D14336: [tsan] Fix the memcpy interceptor to be memmove compatible on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 02:46:08 PST 2015


kubabrecka updated this revision to Diff 39334.
kubabrecka added a comment.

Updating patch to use internal_memmove and adding a comment.


http://reviews.llvm.org/D14336

Files:
  lib/tsan/rtl/tsan_interceptors.cc

Index: lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -626,7 +626,10 @@
     MemoryAccessRange(thr, pc, (uptr)dst, size, true);
     MemoryAccessRange(thr, pc, (uptr)src, size, false);
   }
-  return internal_memcpy(dst, src, size);
+  // On OS X, calling internal_memcpy here will cause memory corruptions,
+  // because memcpy and memmove are actually aliases of the same implementation.
+  // We need to use internal_memmove here.
+  return internal_memmove(dst, src, size);
 }
 
 TSAN_INTERCEPTOR(void*, memmove, void *dst, void *src, uptr n) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14336.39334.patch
Type: text/x-patch
Size: 683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151105/775205a8/attachment.bin>


More information about the llvm-commits mailing list