[compiler-rt] 97e0fd2 - Don't forward __pthread_mutex_* interceptors to pthread_mutex_* version
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 11:19:48 PST 2019
Author: Vitaly Buka
Date: 2019-11-22T11:19:39-08:00
New Revision: 97e0fd27eb9b2004b4d51a859fe364ace8d46b35
URL: https://github.com/llvm/llvm-project/commit/97e0fd27eb9b2004b4d51a859fe364ace8d46b35
DIFF: https://github.com/llvm/llvm-project/commit/97e0fd27eb9b2004b4d51a859fe364ace8d46b35.diff
LOG: Don't forward __pthread_mutex_* interceptors to pthread_mutex_* version
Summary:
Allows to use rr with asan
Fixes PR41095
Reviewers: eugenis
Subscribers: jfb, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D70581
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 50e3558b52e8..af301a1a689c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -4177,11 +4177,27 @@ INTERCEPTOR(int, pthread_mutex_unlock, void *m) {
#if SANITIZER_INTERCEPT___PTHREAD_MUTEX
INTERCEPTOR(int, __pthread_mutex_lock, void *m) {
- return WRAP(pthread_mutex_lock)(m);
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, __pthread_mutex_lock, m);
+ COMMON_INTERCEPTOR_MUTEX_PRE_LOCK(ctx, m);
+ int res = REAL(__pthread_mutex_lock)(m);
+ if (res == errno_EOWNERDEAD)
+ COMMON_INTERCEPTOR_MUTEX_REPAIR(ctx, m);
+ if (res == 0 || res == errno_EOWNERDEAD)
+ COMMON_INTERCEPTOR_MUTEX_POST_LOCK(ctx, m);
+ if (res == errno_EINVAL)
+ COMMON_INTERCEPTOR_MUTEX_INVALID(ctx, m);
+ return res;
}
INTERCEPTOR(int, __pthread_mutex_unlock, void *m) {
- return WRAP(pthread_mutex_unlock)(m);
+ void *ctx;
+ COMMON_INTERCEPTOR_ENTER(ctx, __pthread_mutex_unlock, m);
+ COMMON_INTERCEPTOR_MUTEX_UNLOCK(ctx, m);
+ int res = REAL(__pthread_mutex_unlock)(m);
+ if (res == errno_EINVAL)
+ COMMON_INTERCEPTOR_MUTEX_INVALID(ctx, m);
+ return res;
}
#define INIT___PTHREAD_MUTEX_LOCK \
More information about the llvm-commits
mailing list