[compiler-rt] r275098 - [compiler-rt] Refactor the interception code on windows.

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 11 13:37:12 PDT 2016


Author: etienneb
Date: Mon Jul 11 15:37:12 2016
New Revision: 275098

URL: http://llvm.org/viewvc/llvm-project?rev=275098&view=rev
Log:
[compiler-rt] Refactor the interception code on windows.

[asan] Fix unittest Asan-x86_64-inline-Test crashing on Windows64

REAL(memcpy) was used in several places in Asan, while REAL(memmove) was not used.
This CL chooses to patch memcpy() first, solving the crash for unittest.

The crash looks like this:

projects\compiler-rt\lib\asan\tests\default\Asan-x86_64-inline-Test.exe
=================================================================
==22680==ERROR: AddressSanitizer: access-violation on unknown address 0x000000000000 (pc 0x000000000000 bp 0x0029d555f590 sp 0x0029d555f438 T0)
==22680==Hint: pc points to the zero page.

AddressSanitizer can not provide additional info.
 SUMMARY: AddressSanitizer: access-violation (<unknown module>)
==22680==ABORTING

Patch by: Wei Wang
Differential Revision: http://reviews.llvm.org/D22232


Modified:
    compiler-rt/trunk/lib/asan/asan_interceptors.cc

Modified: compiler-rt/trunk/lib/asan/asan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_interceptors.cc?rev=275098&r1=275097&r2=275098&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc Mon Jul 11 15:37:12 2016
@@ -725,11 +725,13 @@ void InitializeAsanInterceptors() {
   InitializeCommonInterceptors();
 
   // Intercept mem* functions.
-  ASAN_INTERCEPT_FUNC(memmove);
+  ASAN_INTERCEPT_FUNC(memcpy);
   ASAN_INTERCEPT_FUNC(memset);
   if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) {
-    ASAN_INTERCEPT_FUNC(memcpy);
+    // In asan, REAL(memmove) is not used, but it is used in msan.
+    ASAN_INTERCEPT_FUNC(memmove);
   }
+  CHECK(REAL(memcpy));
 
   // Intercept str* functions.
   ASAN_INTERCEPT_FUNC(strcat);  // NOLINT




More information about the llvm-commits mailing list