[compiler-rt] [compiler-rt][TSan] fix crash caused by intercpting pthread_detach on Android (PR #161596)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 4 14:04:33 PDT 2025
================
@@ -1130,6 +1130,20 @@ TSAN_INTERCEPTOR(int, pthread_create,
TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) {
SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret);
+#if SANITIZER_ANDROID
+ {
+ // In Bionic, pthread_detach calls pthread_join, so the thread has already
+ // been consumed by the pthread_detach interceptor.
+ Tid tid = ctx->thread_registry.FindThread(
+ [](ThreadContextBase* tctx, void* arg) {
+ return tctx->user_id == (uptr)arg;
+ },
+ th);
+ if (tid == kInvalidTid) {
----------------
fmayer wrote:
>From the comment it sounds like this will always be the case, is that correct?
https://github.com/llvm/llvm-project/pull/161596
More information about the llvm-commits
mailing list