Open ehds opened 7 months ago
Possible fixes:
--- a/compiler-rt/lib/lsan/lsan_common_linux.cpp
+++ b/compiler-rt/lib/lsan/lsan_common_linux.cpp
@@ -122,7 +122,6 @@ void HandleLeaks() {
static int LockStuffAndStopTheWorldCallback(struct dl_phdr_info *info,
size_t size, void *data) {
- ScopedStopTheWorldLock lock;
DoStopTheWorldParam *param = reinterpret_cast<DoStopTheWorldParam *>(data);
StopTheWorld(param->callback, param->argument);
return 1;
@@ -139,6 +138,7 @@ static int LockStuffAndStopTheWorldCallback(struct dl_phdr_info *info,
void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
CheckForLeaksParam *argument) {
DoStopTheWorldParam param = {callback, argument};
+ ScopedStopTheWorldLock lock;
dl_iterate_phdr(LockStuffAndStopTheWorldCallback, ¶m);
}
Describtion
If a detached thread trigger
heap-use-after-free
during program exiting, it will cause a deadblock.Reproduction
Creating 5 never join threads to write
globa_p
which will be released before program exit, theses threads would triggerheap-use-after-free
error, then lead to deadblock.clang++ version:
test.cc
Program print one line
heap-use-after-free
ERROR info, and blocked.The stack information is as follows: