diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-09-22 21:34:44 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2015-09-22 21:34:44 +0000 |
| commit | 9147de0ddf9f6697f7902229ec63e2d02e1e2867 (patch) | |
| tree | 05c259d8b05c9d2ae08cf9ef20b684bc748dc50a /compiler-rt/lib/asan | |
| parent | 1d6063e80497357361ee47e065e1068e7c98fec8 (diff) | |
| download | bcm5719-llvm-9147de0ddf9f6697f7902229ec63e2d02e1e2867.tar.gz bcm5719-llvm-9147de0ddf9f6697f7902229ec63e2d02e1e2867.zip | |
[asan] Versioned interceptor for pthread_create.
This fixes a crash in pthread_create on linux/i386 due to abi
incompatibility between intercepted and non-intercepted functions.
See the test case for more details.
llvm-svn: 248325
Diffstat (limited to 'compiler-rt/lib/asan')
| -rw-r--r-- | compiler-rt/lib/asan/asan_interceptors.cc | 8 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_interceptors.h | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_interceptors.cc b/compiler-rt/lib/asan/asan_interceptors.cc index 0ed175ac3db..8307408b175 100644 --- a/compiler-rt/lib/asan/asan_interceptors.cc +++ b/compiler-rt/lib/asan/asan_interceptors.cc @@ -27,6 +27,10 @@ #include "sanitizer_common/sanitizer_posix.h" #endif +#if defined(__i386) && SANITIZER_LINUX +#define ASAN_PTHREAD_CREATE_VERSION "GLIBC_2.1" +#endif + namespace __asan { // Return true if we can quickly decide that the region is unpoisoned. @@ -791,7 +795,11 @@ void InitializeAsanInterceptors() { // Intercept threading-related functions #if ASAN_INTERCEPT_PTHREAD_CREATE +#if defined(ASAN_PTHREAD_CREATE_VERSION) + ASAN_INTERCEPT_FUNC_VER(pthread_create, ASAN_PTHREAD_CREATE_VERSION); +#else ASAN_INTERCEPT_FUNC(pthread_create); +#endif ASAN_INTERCEPT_FUNC(pthread_join); #endif diff --git a/compiler-rt/lib/asan/asan_interceptors.h b/compiler-rt/lib/asan/asan_interceptors.h index 488ada78ab8..279c5f38451 100644 --- a/compiler-rt/lib/asan/asan_interceptors.h +++ b/compiler-rt/lib/asan/asan_interceptors.h @@ -98,6 +98,12 @@ DECLARE_REAL(int, sigaction, int signum, const struct sigaction *act, if ((!INTERCEPT_FUNCTION(name) || !REAL(name))) \ VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \ } while (0) +#define ASAN_INTERCEPT_FUNC_VER(name, ver) \ + do { \ + if ((!INTERCEPT_FUNCTION_VER(name, ver) || !REAL(name))) \ + VReport( \ + 1, "AddressSanitizer: failed to intercept '" #name "@@" #ver "'\n"); \ + } while (0) #else // OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION. #define ASAN_INTERCEPT_FUNC(name) |

