diff options
author | Vitaly Buka <vitalybuka@google.com> | 2023-05-05 17:28:57 -0700 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2023-05-08 14:08:28 -0700 |
commit | 5ec62943ac188994d7c7d54ea995398a4c62e74f (patch) | |
tree | 0e10b9d7455f45786c553b1666307b349df097d7 /compiler-rt | |
parent | 39c1005227fd39b528992dc9fb8126302f611c65 (diff) | |
download | llvm-5ec62943ac188994d7c7d54ea995398a4c62e74f.tar.gz |
[msan] Add pthread_*join_np interceptors
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/lib/msan/msan_interceptors.cpp | 22 | ||||
-rw-r--r-- | compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_join.cpp | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/compiler-rt/lib/msan/msan_interceptors.cpp b/compiler-rt/lib/msan/msan_interceptors.cpp index 4dbcd064d41e..8cf724b3949f 100644 --- a/compiler-rt/lib/msan/msan_interceptors.cpp +++ b/compiler-rt/lib/msan/msan_interceptors.cpp @@ -1120,6 +1120,24 @@ INTERCEPTOR(int, pthread_join, void *thread, void **retval) { return res; } +#if SANITIZER_GLIBC +INTERCEPTOR(int, pthread_tryjoin_np, void *thread, void **retval) { + ENSURE_MSAN_INITED(); + int res = REAL(pthread_tryjoin_np)(thread, retval); + if (!res && retval) + __msan_unpoison(retval, sizeof(*retval)); + return res; +} + +INTERCEPTOR(int, pthread_timedjoin_np, void *thread, void **retval, + const struct timespec *abstime) { + int res = REAL(pthread_timedjoin_np)(thread, retval, abstime); + if (!res && retval) + __msan_unpoison(retval, sizeof(*retval)); + return res; +} +#endif + DEFINE_REAL_PTHREAD_FUNCTIONS extern char *tzname[2]; @@ -1777,6 +1795,10 @@ void InitializeInterceptors() { #endif INTERCEPT_FUNCTION(pthread_join); INTERCEPT_FUNCTION(pthread_key_create); +#if SANITIZER_GLIBC + INTERCEPT_FUNCTION(pthread_tryjoin_np); + INTERCEPT_FUNCTION(pthread_timedjoin_np); +#endif #if SANITIZER_NETBSD INTERCEPT_FUNCTION(__libc_thr_keycreate); diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_join.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_join.cpp index 2b35b163b143..212a28dd3985 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_join.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/pthread_join.cpp @@ -4,8 +4,6 @@ // FIXME: Crashes on some bots in pthread_exit. // RUN: %run %t %if tsan %{ 0 %} %else %{ 1 %} -// XFAIL: msan - // REQUIRES: glibc #include <assert.h> |