[PATCH] D74828: tsan: fix pthread_detach with called_from_lib suppressions
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 10:25:36 PST 2020
yln added inline comments.
================
Comment at: compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp:313
+ ctx->thread_registry->FindThread(ConsumeThreadByUid, &findCtx);
+ int tid = findCtx.tctx ? findCtx.tctx->tid : ThreadRegistry::kUnknownTid;
+ DPrintf("#%d: ThreadTid uid=%zu tid=%d\n", thr->tid, uid, tid);
----------------
dvyukov wrote:
> yln wrote:
> > This preserves the original semantics. Should we consider asserting that we found a thread (with an unique uid)? None of the callers seem to deal with the error case (when we return `kUnknownTid` here).
> There is checking later.
> If pthread_t is bogus then pthread_join should fail as well, in such case pthread_join interceptor will not use kUnknownTid.
> Otherwise it will be passed to ThreadJoin, which has checks for tid value in the beginning.
> Crashing/producing warning on invalid argument will change behavior of programs, without tsan pthread_joing should just return an error. Arguably programs should not do it, but deploying it now may be hard. I don't want to touch this just as a side effect of completely unrelated bug fix.
Got it, thanks for explaining.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74828/new/
https://reviews.llvm.org/D74828
More information about the llvm-commits
mailing list