[compiler-rt] [ASan] Prevent ASan/LSan deadlock by preloading modules before error reporting (PR #131756)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 11:12:02 PDT 2025


zeroomega wrote:

We are still seeing this test (AddressSanitizer-x86_64-linux-dynamic :: TestCases/asan_lsan_deadlock.cpp) failing occasionally on our clang-linux-x64 builder after the mitigation patch b111da97e81f32fe0fb89f8daa2e7516909a8797 was landed. Error message:

```
Exit Code: 1

Command Output (stderr):
--
/b/s/w/ir/x/w/llvm_build/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only   -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   -shared-libasan -O0 /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp # RUN: at line 4
+ /b/s/w/ir/x/w/llvm_build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -shared-libasan -O0 /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp -o /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
env ASAN_OPTIONS=detect_leaks=1 not  /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp 2>&1 | FileCheck /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp # RUN: at line 5
+ env ASAN_OPTIONS=detect_leaks=1 not /b/s/w/ir/x/w/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/asan_lsan_deadlock.cpp.tmp
+ FileCheck /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp:58:12: error: CHECK: expected string not found in input
 // CHECK: SUMMARY: AddressSanitizer: stack-buffer-overflow
           ^
<stdin>:1:1: note: scanning from here
=================================================================
^
<stdin>:2:10: note: possible intended match here
==1498708==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7b0acc6de034 at pc 0x562cddf01db0 bp 0x7b0aca8fdcb0 sp 0x7b0aca8fdca8
         ^

Input file: <stdin>
Check file: /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: ================================================================= 
check:58'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: ==1498708==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7b0acc6de034 at pc 0x562cddf01db0 bp 0x7b0aca8fdcb0 sp 0x7b0aca8fdca8 
check:58'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:58'1              ?                                                                                                                                    possible intended match
            3: WRITE of size 4 at 0x7b0acc6de034 thread T2 
check:58'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>>>

--
```

Failed task: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8715964028295378769/overview

Would a larger timeout in compiler-rt/test/asan/TestCases/asan_lsan_deadlock.cpp be helpful? 

https://github.com/llvm/llvm-project/pull/131756


More information about the llvm-commits mailing list