[compiler-rt] [ASan] Prevent ASan/LSan deadlock by preloading modules before error reporting (PR #131756)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 15:31:24 PDT 2025
vitalybuka wrote:
> ### Proposed Fixes for ASan-LSan Deadlock Issue
@Camsyn Will this work?
```
--- a/compiler-rt/lib/lsan/lsan_common_linux.cpp
+++ b/compiler-rt/lib/lsan/lsan_common_linux.cpp
@@ -117,7 +117,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;
@@ -133,6 +132,7 @@ static int LockStuffAndStopTheWorldCallback(struct dl_phdr_info *info,
// callback in the parent thread.
void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
CheckForLeaksParam *argument) {
+ ScopedStopTheWorldLock lock;
DoStopTheWorldParam param = {callback, argument};
dl_iterate_phdr(LockStuffAndStopTheWorldCallback, ¶m);
}
```
https://github.com/llvm/llvm-project/pull/131756
More information about the llvm-commits
mailing list