diff options
author | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-03 16:19:37 +0000 |
---|---|---|
committer | Kuba Brecka <kuba.brecka@gmail.com> | 2015-11-03 16:19:37 +0000 |
commit | 77f16f369b527f5ccd2c114885694435e161eb30 (patch) | |
tree | 01916265d94f6ae1d599e35bb1cbfaa667442708 | |
parent | a4a227f7e881de24ab150d6277d59b256b55d99a (diff) | |
download | bcm5719-llvm-77f16f369b527f5ccd2c114885694435e161eb30.tar.gz bcm5719-llvm-77f16f369b527f5ccd2c114885694435e161eb30.zip |
[tsan] Allow memchr interceptor to be used before initialization on OS X
On OS X, `memchr` is called on a newly created thread even before `__tsan_thread_start_func` is invoked, which means that the ThreadState object for that thread will not yet be initialized. Let's add `COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED` into the interceptor to simply call `internal_memchr` in these cases.
Differential Revision: http://reviews.llvm.org/D14283
llvm-svn: 251935
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index 6d99b5100f9..62902a306c5 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -441,6 +441,8 @@ INTERCEPTOR(int, memcmp, const void *a1, const void *a2, uptr size) { #if SANITIZER_INTERCEPT_MEMCHR INTERCEPTOR(void*, memchr, const void *s, int c, SIZE_T n) { + if (COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED) + return internal_memchr(s, c, n); void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, memchr, s, c, n); void *res = REAL(memchr)(s, c, n); |