mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-26 05:18:46 +00:00
[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:
parent
25159ee3af
commit
d1aee9c0cb
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user