[compiler-rt] r275494 - [asan] Avoid hooking memchr() on Windows64
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 15:29:22 PDT 2016
Author: etienneb
Date: Thu Jul 14 17:29:22 2016
New Revision: 275494
URL: http://llvm.org/viewvc/llvm-project?rev=275494&view=rev
Log:
[asan] Avoid hooking memchr() on Windows64
There is not enough padding in front of memchr(), and, the first 6 bytes
contains a branch instruction. Basically the current interception will
not work on memchr().
It was disabled before, but was missing the part to disable it for
INTERCEPT_LIBRARY_FUNCTION.
Patch by Wei Wang
Differential Revision: https://reviews.llvm.org/D22371
Modified:
compiler-rt/trunk/lib/asan/asan_win_dll_thunk.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
Modified: compiler-rt/trunk/lib/asan/asan_win_dll_thunk.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win_dll_thunk.cc?rev=275494&r1=275493&r2=275494&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win_dll_thunk.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win_dll_thunk.cc Thu Jul 14 17:29:22 2016
@@ -21,6 +21,7 @@
#ifdef ASAN_DLL_THUNK
#include "asan_init_version.h"
#include "interception/interception.h"
+#include "sanitizer_common/sanitizer_platform_interceptors.h"
// ---------- Function interception helper functions and macros ----------- {{{1
extern "C" {
@@ -390,7 +391,9 @@ INTERCEPTOR(int, _except_handler4, void
INTERCEPT_LIBRARY_FUNCTION(frexp);
INTERCEPT_LIBRARY_FUNCTION(longjmp);
+#if SANITIZER_INTERCEPT_MEMCHR
INTERCEPT_LIBRARY_FUNCTION(memchr);
+#endif
INTERCEPT_LIBRARY_FUNCTION(memcmp);
INTERCEPT_LIBRARY_FUNCTION(memcpy);
INTERCEPT_LIBRARY_FUNCTION(memmove);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=275494&r1=275493&r2=275494&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Thu Jul 14 17:29:22 2016
@@ -83,10 +83,9 @@
#define SANITIZER_INTERCEPT_MEMMOVE 1
#define SANITIZER_INTERCEPT_MEMCPY 1
#define SANITIZER_INTERCEPT_MEMCMP 1
-// TODO(wwchrome): Re-enable intercepting memchr() when ready.
// The function memchr() contains a jump in the first 6 bytes
// that is problematic to intercept correctly on Win64.
-// Disable memchr() interception for Win64 temporarily.
+// Disable memchr() interception for Win64.
#if SANITIZER_WINDOWS64
#define SANITIZER_INTERCEPT_MEMCHR 0
#else
More information about the llvm-commits
mailing list