[sanitizers] Remove assert from ThreadArgRetval::Finish

Bionic uses pthread_exit to set retval, when GLIBC does not.
This cause double call to Finish. Rather then tracking this difference
on interceptor size, we can just relax precondition. It does not make
a difference.
This commit is contained in:
Vitaly Buka 2023-05-12 10:05:46 -07:00
parent 25159ee3af
commit d1aee9c0cb
4 changed files with 5 additions and 10 deletions

View File

@ -264,9 +264,7 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
}
INTERCEPTOR(int, pthread_exit, void *retval) {
AsanThread *t = GetCurrentThread();
if (t && t->tid() != kMainTid)
asanThreadArgRetval().Finish(GetThreadSelf(), retval);
asanThreadArgRetval().Finish(GetThreadSelf(), retval);
return REAL(pthread_exit)(retval);
}

View File

@ -107,9 +107,7 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
}
INTERCEPTOR(int, pthread_exit, void *retval) {
auto *t = GetCurrentThread();
if (t && !t->IsMainThread())
hwasanThreadArgRetval().Finish(GetThreadSelf(), retval);
hwasanThreadArgRetval().Finish(GetThreadSelf(), retval);
return REAL(pthread_exit)(retval);
}

View File

@ -489,9 +489,7 @@ INTERCEPTOR(int, pthread_detach, void *thread) {
}
INTERCEPTOR(int, pthread_exit, void *retval) {
ThreadContextLsanBase *t = GetCurrentThread();
if (t && t->tid != kMainTid)
GetThreadArgRetval().Finish(GetThreadSelf(), retval);
GetThreadArgRetval().Finish(GetThreadSelf(), retval);
return REAL(pthread_exit)(retval);
}

View File

@ -39,7 +39,8 @@ ThreadArgRetval::Args ThreadArgRetval::GetArgs(uptr thread) const {
void ThreadArgRetval::Finish(uptr thread, void* retval) {
__sanitizer::Lock lock(&mtx_);
auto t = data_.find(thread);
CHECK(t);
if (!t)
return;
if (t->second.detached) {
// Retval of detached thread connot be retrieved.
data_.erase(t);