diff options
author | Etienne Bergeron <etienneb@google.com> | 2016-07-11 20:37:12 +0000 |
---|---|---|
committer | Etienne Bergeron <etienneb@google.com> | 2016-07-11 20:37:12 +0000 |
commit | 156759893994e40100c4a915057f269c0383c74b (patch) | |
tree | badde841cf8c2a19c97590f1d2f8e39898096260 | |
parent | c03c8412b1ae66b28d8169b62860b5aee5bbb95a (diff) | |
download | compiler-rt-156759893994e40100c4a915057f269c0383c74b.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275098 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_interceptors.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/asan/asan_interceptors.cc b/lib/asan/asan_interceptors.cc index 7f9a8844b..3b3b0f380 100644 --- a/lib/asan/asan_interceptors.cc +++ b/lib/asan/asan_interceptors.cc @@ -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 |