[compiler-rt] r180182 - tsan: disable getpwuid_r() and glob64() interceptors under tsan, because they cause interceptor recursion if user intercepts fopen()

Dmitry Vyukov dvyukov at google.com
Wed Apr 24 04:06:06 PDT 2013


Author: dvyukov
Date: Wed Apr 24 06:06:05 2013
New Revision: 180182

URL: http://llvm.org/viewvc/llvm-project?rev=180182&view=rev
Log:
tsan: disable getpwuid_r() and glob64() interceptors under tsan, because they cause interceptor recursion if user intercepts fopen()

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc

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=180182&r1=180181&r2=180182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Wed Apr 24 06:06:05 2013
@@ -11,6 +11,8 @@
 // given library functions on a given platform.
 //
 //===----------------------------------------------------------------------===//
+#ifndef SANITIZER_PLATFORM_INTERCEPTORS_H
+#define SANITIZER_PLATFORM_INTERCEPTORS_H
 
 #include "sanitizer_internal_defs.h"
 
@@ -67,3 +69,5 @@
 # define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID
 # define SANITIZER_INTERCEPT_WAIT SI_NOT_WINDOWS
 # define SANITIZER_INTERCEPT_INET SI_NOT_WINDOWS
+
+#endif  // #ifndef SANITIZER_PLATFORM_INTERCEPTORS_H

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=180182&r1=180181&r2=180182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Wed Apr 24 06:06:05 2013
@@ -10,7 +10,7 @@
 // This file is a part of ThreadSanitizer (TSan), a race detector.
 //
 // FIXME: move as many interceptors as possible into
-// sanitizer_common/sanitizer_common_interceptors.h
+// sanitizer_common/sanitizer_common_interceptors.inc
 //===----------------------------------------------------------------------===//
 
 #include "sanitizer_common/sanitizer_atomic.h"
@@ -1835,6 +1835,13 @@ struct TsanInterceptorContext {
   const uptr pc;
 };
 
+#include "sanitizer_common/sanitizer_platform_interceptors.h"
+// Causes interceptor recursion (getpwuid_r() calls fopen())
+#undef SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS
+#undef SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS
+// Causes interceptor recursion (glob64() calls lstat64())
+#undef SANITIZER_INTERCEPT_GLOB
+
 #define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \
     MemoryAccessRange(((TsanInterceptorContext*)ctx)->thr,  \
                       ((TsanInterceptorContext*)ctx)->pc,   \





More information about the llvm-commits mailing list