[compiler-rt] r211206 - Revert "[sanitizer] Intercept pthread_*attr_get*."
Arnold Schwaighofer
aschwaighofer at apple.com
Wed Jun 18 12:04:47 PDT 2014
Author: arnolds
Date: Wed Jun 18 14:04:47 2014
New Revision: 211206
URL: http://llvm.org/viewvc/llvm-project?rev=211206&view=rev
Log:
Revert "[sanitizer] Intercept pthread_*attr_get*."
This reverts commit r211166. It broke public mac os x bots.
Removed:
compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=211206&r1=211205&r2=211206&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Jun 18 14:04:47 2014
@@ -3294,26 +3294,19 @@ INTERCEPTOR(int, random_r, void *buf, u3
// FIXME: under ASan the REAL() call below may write to freed memory and corrupt
// its metadata. See
// https://code.google.com/p/address-sanitizer/issues/detail?id=321.
-#if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET || \
- SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSSCHED || \
- SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET || \
- SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET || \
- SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET || \
- SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET
-#define INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(fn, sz) \
- INTERCEPTOR(int, fn, void *attr, void *r) { \
- void *ctx; \
- COMMON_INTERCEPTOR_ENTER(ctx, fn, attr, r); \
- int res = REAL(fn)(attr, r); \
- if (!res && r) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, r, sz); \
- return res; \
+#if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET || \
+ SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSSCHED
+#define INTERCEPTOR_PTHREAD_ATTR_GET(what, sz) \
+ INTERCEPTOR(int, pthread_attr_get##what, void *attr, void *r) { \
+ void *ctx; \
+ COMMON_INTERCEPTOR_ENTER(ctx, pthread_attr_get##what, attr, r); \
+ int res = REAL(pthread_attr_get##what)(attr, r); \
+ if (!res && r) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, r, sz); \
+ return res; \
}
#endif
-
#if SANITIZER_INTERCEPT_PTHREAD_ATTR_GET
-#define INTERCEPTOR_PTHREAD_ATTR_GET(what, sz) \
- INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_attr_get##what, sz)
INTERCEPTOR_PTHREAD_ATTR_GET(detachstate, sizeof(int))
INTERCEPTOR_PTHREAD_ATTR_GET(guardsize, sizeof(SIZE_T))
INTERCEPTOR_PTHREAD_ATTR_GET(schedparam, struct_sched_param_sz)
@@ -3387,60 +3380,6 @@ INTERCEPTOR(int, pthread_attr_getaffinit
#define INIT_PTHREAD_ATTR_GETAFFINITY_NP
#endif
-#if SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET
-#define INTERCEPTOR_PTHREAD_MUTEXATTR_GET(what, sz) \
- INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_mutexattr_get##what, sz)
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(pshared, sizeof(int))
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(type, sizeof(int))
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(protocol, sizeof(int))
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(prioceiling, sizeof(int))
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(robust, sizeof(int))
-INTERCEPTOR_PTHREAD_MUTEXATTR_GET(robust_np, sizeof(int))
-#define INIT_PTHREAD_MUTEXATTR_GET \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getpshared); \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_gettype); \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getprotocol); \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getprioceiling); \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getrobust); \
- COMMON_INTERCEPT_FUNCTION(pthread_mutexattr_getrobust_np);
-#else
-#define INIT_PTHREAD_MUTEXATTR_GET
-#endif
-
-#if SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET
-#define INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(what, sz) \
- INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_rwlockattr_get##what, sz)
-INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(pshared, sizeof(int))
-INTERCEPTOR_PTHREAD_RWLOCKATTR_GET(kind_np, sizeof(int))
-#define INIT_PTHREAD_RWLOCKATTR_GET \
- COMMON_INTERCEPT_FUNCTION(pthread_rwlockattr_getpshared); \
- COMMON_INTERCEPT_FUNCTION(pthread_rwlockattr_getkind_np);
-#else
-#define INIT_PTHREAD_RWLOCKATTR_GET
-#endif
-
-#if SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET
-#define INTERCEPTOR_PTHREAD_CONDATTR_GET(what, sz) \
- INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_condattr_get##what, sz)
-INTERCEPTOR_PTHREAD_CONDATTR_GET(pshared, sizeof(int))
-INTERCEPTOR_PTHREAD_CONDATTR_GET(clock, sizeof(__sanitizer_clockid_t))
-#define INIT_PTHREAD_CONDATTR_GET \
- COMMON_INTERCEPT_FUNCTION(pthread_condattr_getpshared); \
- COMMON_INTERCEPT_FUNCTION(pthread_condattr_getclock);
-#else
-#define INIT_PTHREAD_CONDATTR_GET
-#endif
-
-#if SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET
-#define INTERCEPTOR_PTHREAD_BARRIERATTR_GET(what, sz) \
- INTERCEPTOR_PTHREAD_OBJECT_ATTR_GET(pthread_barrierattr_get##what, sz)
-INTERCEPTOR_PTHREAD_BARRIERATTR_GET(pshared, sizeof(int))
-#define INIT_PTHREAD_BARRIERATTR_GET \
- COMMON_INTERCEPT_FUNCTION(pthread_barrierattr_getpshared);
-#else
-#define INIT_PTHREAD_BARRIERATTR_GET
-#endif
-
#if SANITIZER_INTERCEPT_TMPNAM
INTERCEPTOR(char *, tmpnam, char *s) {
void *ctx;
@@ -4667,10 +4606,6 @@ static void InitializeCommonInterceptors
INIT_PTHREAD_ATTR_GET;
INIT_PTHREAD_ATTR_GETINHERITSCHED;
INIT_PTHREAD_ATTR_GETAFFINITY_NP;
- INIT_PTHREAD_MUTEXATTR_GET;
- INIT_PTHREAD_RWLOCKATTR_GET;
- INIT_PTHREAD_CONDATTR_GET;
- INIT_PTHREAD_BARRIERATTR_GET;
INIT_TMPNAM;
INIT_TMPNAM_R;
INIT_TEMPNAM;
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=211206&r1=211205&r2=211206&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Wed Jun 18 14:04:47 2014
@@ -163,10 +163,6 @@
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
SI_MAC || SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GET SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GET SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_PTHREAD_CONDATTR_GET SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_PTHREAD_BARRIERATTR_GET SI_NOT_WINDOWS
#define SANITIZER_INTERCEPT_TMPNAM SI_NOT_WINDOWS
#define SANITIZER_INTERCEPT_TMPNAM_R SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_TEMPNAM SI_NOT_WINDOWS
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=211206&r1=211205&r2=211206&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc Wed Jun 18 14:04:47 2014
@@ -1058,7 +1058,6 @@ CHECK_SIZE_AND_OFFSET(shmid_ds, shm_natt
#endif
CHECK_TYPE_SIZE(clock_t);
-CHECK_TYPE_SIZE(clockid_t);
#if !SANITIZER_ANDROID
CHECK_TYPE_SIZE(ifaddrs);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=211206&r1=211205&r2=211206&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Jun 18 14:04:47 2014
@@ -440,8 +440,6 @@ namespace __sanitizer {
typedef long __sanitizer_clock_t;
#endif
- typedef int __sanitizer_clockid_t;
-
#if SANITIZER_LINUX || SANITIZER_FREEBSD
#if defined(_LP64) || defined(__x86_64__) || defined(__powerpc__)
typedef unsigned __sanitizer___kernel_uid_t;
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=211206&r1=211205&r2=211206&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Wed Jun 18 14:04:47 2014
@@ -47,7 +47,7 @@ DECLARE_REAL(int, pthread_attr_getdetach
extern "C" int pthread_attr_setstacksize(void *attr, uptr stacksize);
extern "C" int pthread_key_create(unsigned *key, void (*destructor)(void* v));
extern "C" int pthread_setspecific(unsigned key, const void *v);
-DECLARE_REAL(int, pthread_mutexattr_gettype, void *, void *)
+extern "C" int pthread_mutexattr_gettype(void *a, int *type);
extern "C" int pthread_yield();
extern "C" int pthread_sigmask(int how, const __sanitizer_sigset_t *set,
__sanitizer_sigset_t *oldset);
@@ -1029,7 +1029,7 @@ TSAN_INTERCEPTOR(int, pthread_mutex_init
bool recursive = false;
if (a) {
int type = 0;
- if (REAL(pthread_mutexattr_gettype)(a, &type) == 0)
+ if (pthread_mutexattr_gettype(a, &type) == 0)
recursive = (type == PTHREAD_MUTEX_RECURSIVE
|| type == PTHREAD_MUTEX_RECURSIVE_NP);
}
Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc?rev=211205&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc (removed)
@@ -1,20 +0,0 @@
-// RUN: %clangxx -O0 %s -o %t && %run %t
-// XFAIL: arm-linux-gnueabi
-
-#include <assert.h>
-#include <pthread.h>
-
-int main(void) {
- pthread_mutexattr_t ma;
- int res = pthread_mutexattr_init(&ma);
- assert(res == 0);
- res = pthread_mutexattr_setpshared(&ma, 1);
- assert(res == 0);
- int pshared;
- res = pthread_mutexattr_getpshared(&ma, &pshared);
- assert(res == 0);
- assert(pshared == 1);
- res = pthread_mutexattr_destroy(&ma);
- assert(res == 0);
- return 0;
-}
More information about the llvm-commits
mailing list