From 84d6309cf1eaf7632298d1305ce17f5f7497e1c0 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 28 Feb 2025 19:11:36 +0100 Subject: [PATCH] QThread: disable pthread_clockjoin_np when building under TSAN TSAN does not support intercepting pthread_clockjoin_np (only join, tryjoin and timedjoin), and will claim that an application leaks threads. Disable the clockjoin codepath when building under TSAN. Unfortunately I can't seem to find a version check for the sanitizers to apply here and know if and when TSAN will get this support. Pick-to: 6.9 Change-Id: If12419e5d600e519bf4315d27f74d74a87dcf792 Reviewed-by: Thiago Macieira --- src/corelib/configure.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake index a4a89d35907..0b80923cf6b 100644 --- a/src/corelib/configure.cmake +++ b/src/corelib/configure.cmake @@ -454,11 +454,18 @@ poll(&pfd, 1, 0); ") # pthread_clockjoin +# As of GCC 15, TSAN does not support pthread_clockjoin_np, +# so disable it in a TSAN build. Unfortunately there doesn't +# seem to be a version check possible, just check the +# TSAN_INTERCEPT macros into tsan_interceptors_posix.cpp. qt_config_compile_test(pthread_clockjoin LABEL "pthread_clockjoin()" LIBRARIES Threads::Threads CODE "#include +#if __has_feature(thread_sanitizer) || defined(__SANITIZE_THREAD__) +#error +#endif int main() { void *ret;