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

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 06:05:58 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL252162: [tsan] Fix the memcpy interceptor to be memmove compatible on OS X (authored by kuba.brecka).

Changed prior to commit:
  http://reviews.llvm.org/D14336?vs=39334&id=39358#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14336

Files:
  compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc

Index: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
+++ compiler-rt/trunk/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.39358.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151105/f4a2f569/attachment.bin>


More information about the llvm-commits mailing list