[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:47:25 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);
> }
> ```
Then we will break libdl_deadlock.cpp :(
We can split Threads and Allocator lock, but the may get into the same issue later.
Lets keep as is for now.
https://github.com/llvm/llvm-project/pull/131756
More information about the llvm-commits
mailing list