[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

llvm-svn: 275494
This commit is contained in:
Etienne Bergeron 2016-07-14 22:29:22 +00:00
parent 4e0ff9c46b
commit c52ae0e8d1
2 changed files with 4 additions and 2 deletions

View File

@ -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 *a, void *b, void *c, void *d) {
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);

View File

@ -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