[compiler-rt] [sanitizer] Fix asserts in asan and tsan in pthread interceptors. (PR #75394)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 00:22:02 PST 2024
================
@@ -53,16 +56,30 @@ void ThreadArgRetval::Finish(uptr thread, void* retval) {
u32 ThreadArgRetval::BeforeJoin(uptr thread) const {
__sanitizer::Lock lock(&mtx_);
auto t = data_.find(thread);
- CHECK(t);
- CHECK(!t->second.detached);
- return t->second.gen;
+ bool detect_invalid_join = common_flags()->detect_invalid_join;
----------------
vitalybuka wrote:
```
if (t && !t->second.detached) {
return t->second.gen;
}
if (!common_flags()->detect_invalid_join)
return kInvalidGen;
const char* const reason = "unknown";
if (!t) {
reason = "already joined";
} else if (t->second.detached) {
reason = "detached";
}
Report("ERROR: %s: Joining %s thread, aborting.\n",
SanitizerToolName, reason);
Die();
```
https://github.com/llvm/llvm-project/pull/75394
More information about the llvm-commits
mailing list