[compiler-rt] r332276 - Revert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon May 14 11:53:13 PDT 2018


Author: vitalybuka
Date: Mon May 14 11:53:13 2018
New Revision: 332276

URL: http://llvm.org/viewvc/llvm-project?rev=332276&view=rev
Log:
Revert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"

Tsan tests fail.

This reverts commit r332268

Removed:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/pthread_mutex.cc
Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h

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=332276&r1=332275&r2=332276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Mon May 14 11:53:13 2018
@@ -4054,22 +4054,6 @@ INTERCEPTOR(int, pthread_mutex_unlock, v
 #define INIT_PTHREAD_MUTEX_UNLOCK
 #endif
 
-#if SANITIZER_INTERCEPT___PTHREAD_MUTEX
-INTERCEPTOR(int, __pthread_mutex_lock, void *m)
-ALIAS(WRAPPER_NAME(pthread_mutex_lock));
-
-INTERCEPTOR(int, __pthread_mutex_unlock, void *m)
-ALIAS(WRAPPER_NAME(pthread_mutex_unlock));
-
-#define INIT___PTHREAD_MUTEX_LOCK \
-  COMMON_INTERCEPT_FUNCTION(__pthread_mutex_lock)
-#define INIT___PTHREAD_MUTEX_UNLOCK \
-  COMMON_INTERCEPT_FUNCTION(__pthread_mutex_unlock)
-#else
-#define INIT___PTHREAD_MUTEX_LOCK
-#define INIT___PTHREAD_MUTEX_UNLOCK
-#endif
-
 #if SANITIZER_INTERCEPT___LIBC_MUTEX
 INTERCEPTOR(int, __libc_mutex_lock, void *m)
 ALIAS(WRAPPER_NAME(pthread_mutex_lock));
@@ -7318,8 +7302,6 @@ static void InitializeCommonInterceptors
   INIT__EXIT;
   INIT_PTHREAD_MUTEX_LOCK;
   INIT_PTHREAD_MUTEX_UNLOCK;
-  INIT___PTHREAD_MUTEX_LOCK;
-  INIT___PTHREAD_MUTEX_UNLOCK;
   INIT___LIBC_MUTEX_LOCK;
   INIT___LIBC_MUTEX_UNLOCK;
   INIT___LIBC_THR_SETCANCELSTATE;

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=332276&r1=332275&r2=332276&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Mon May 14 11:53:13 2018
@@ -365,7 +365,6 @@
   (SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_OPENBSD || SI_MAC || SI_SOLARIS)
 
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEX SI_POSIX
-#define SANITIZER_INTERCEPT___PTHREAD_MUTEX SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT___LIBC_MUTEX SI_NETBSD
 #define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
   (SI_FREEBSD || SI_NETBSD || SI_OPENBSD || SI_LINUX_NOT_ANDROID || SI_SOLARIS)

Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/pthread_mutex.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/pthread_mutex.cc?rev=332275&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/pthread_mutex.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Linux/pthread_mutex.cc (removed)
@@ -1,34 +0,0 @@
-// RUN: %clangxx -O1 %s -o %t && %run %t
-// RUN: %clangxx -O1 -DUSE_GLIBC %s -o %t && %run %t
-// UNSUPPORTED: android
-
-#include <pthread.h>
-
-#ifdef USE_GLIBC
-extern "C" int __pthread_mutex_lock(pthread_mutex_t *__mutex);
-extern "C" int __pthread_mutex_unlock(pthread_mutex_t *__mutex);
-#define LOCK __pthread_mutex_lock
-#define UNLOCK __pthread_mutex_unlock
-#else
-#define LOCK pthread_mutex_lock
-#define UNLOCK pthread_mutex_unlock
-#endif
-
-pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
-int x;
-
-static void *Start(void *arg) {
-  LOCK(&m);
-  ++x;
-  UNLOCK(&m);
-  return nullptr;
-}
-
-int main() {
-  pthread_t threads[2] = {};
-  for (pthread_t &t : threads)
-    pthread_create(&t, 0, &Start, 0);
-  for (pthread_t &t : threads)
-    pthread_join(t, 0);
-  return 0;
-}




More information about the llvm-commits mailing list