1515
1616#include " interception/interception.h"
1717#include " sanitizer_common/sanitizer_allocator_dlsym.h"
18+ #include " sanitizer_common/sanitizer_glibc_version.h"
1819#include " sanitizer_common/sanitizer_platform_interceptors.h"
1920
2021#include " interception/interception.h"
@@ -766,6 +767,12 @@ INTERCEPTOR(int, pthread_join, pthread_t thread, void **value_ptr) {
766767 return REAL (pthread_join)(thread, value_ptr);
767768}
768769
770+ INTERCEPTOR (int , pthread_cond_init, pthread_cond_t *cond,
771+ const pthread_condattr_t *a) {
772+ __rtsan_notify_intercepted_call (" pthread_cond_init" );
773+ return REAL (pthread_cond_init)(cond, a);
774+ }
775+
769776INTERCEPTOR (int , pthread_cond_signal, pthread_cond_t *cond) {
770777 __rtsan_notify_intercepted_call (" pthread_cond_signal" );
771778 return REAL (pthread_cond_signal)(cond);
@@ -788,6 +795,11 @@ INTERCEPTOR(int, pthread_cond_timedwait, pthread_cond_t *cond,
788795 return REAL (pthread_cond_timedwait)(cond, mutex, ts);
789796}
790797
798+ INTERCEPTOR (int , pthread_cond_destroy, pthread_cond_t *cond) {
799+ __rtsan_notify_intercepted_call (" pthread_cond_destroy" );
800+ return REAL (pthread_cond_destroy)(cond);
801+ }
802+
791803INTERCEPTOR (int , pthread_rwlock_rdlock, pthread_rwlock_t *lock) {
792804 __rtsan_notify_intercepted_call (" pthread_rwlock_rdlock" );
793805 return REAL (pthread_rwlock_rdlock)(lock);
@@ -1641,10 +1653,26 @@ void __rtsan::InitializeInterceptors() {
16411653 INTERCEPT_FUNCTION (pthread_mutex_lock);
16421654 INTERCEPT_FUNCTION (pthread_mutex_unlock);
16431655 INTERCEPT_FUNCTION (pthread_join);
1656+
1657+ // See the comment in tsan_interceptors_posix.cpp.
1658+ #if SANITIZER_GLIBC && !__GLIBC_PREREQ(2, 36) && \
1659+ (defined (__x86_64__) || defined (__mips__) || SANITIZER_PPC64V1 || \
1660+ defined (__s390x__))
1661+ INTERCEPT_FUNCTION_VER (pthread_cond_init, " GLIBC_2.3.2" );
1662+ INTERCEPT_FUNCTION_VER (pthread_cond_signal, " GLIBC_2.3.2" );
1663+ INTERCEPT_FUNCTION_VER (pthread_cond_broadcast, " GLIBC_2.3.2" );
1664+ INTERCEPT_FUNCTION_VER (pthread_cond_wait, " GLIBC_2.3.2" );
1665+ INTERCEPT_FUNCTION_VER (pthread_cond_timedwait, " GLIBC_2.3.2" );
1666+ INTERCEPT_FUNCTION_VER (pthread_cond_destroy, " GLIBC_2.3.2" );
1667+ #else
1668+ INTERCEPT_FUNCTION (pthread_cond_init);
16441669 INTERCEPT_FUNCTION (pthread_cond_signal);
16451670 INTERCEPT_FUNCTION (pthread_cond_broadcast);
16461671 INTERCEPT_FUNCTION (pthread_cond_wait);
16471672 INTERCEPT_FUNCTION (pthread_cond_timedwait);
1673+ INTERCEPT_FUNCTION (pthread_cond_destroy);
1674+ #endif
1675+
16481676 INTERCEPT_FUNCTION (pthread_rwlock_rdlock);
16491677 INTERCEPT_FUNCTION (pthread_rwlock_unlock);
16501678 INTERCEPT_FUNCTION (pthread_rwlock_wrlock);
0 commit comments