[compiler-rt] [asan] Make frame number checks more flexable (PR #94307)

Hau Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 5 01:32:17 PDT 2024


hau-hsu wrote:

> > Use more flexable regex ([0-9]+) for frame number checks. Since the frame numbers might change if some functions are not inlined.
> 
> Can you mention why some functions might be inlined. We use -O0 to prevent that. This change is probably still good but we need concrete examples.

Take [compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cpp](https://github.com/llvm/llvm-project/blob/5787f43f867d8545af2a3d5ee724964824186af4/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cpp) as an example, the FileChecks are:
```
// CHECK: {{    #0 0x.* in (__interceptor_)?malloc}}
// CHECK: {{    #1 0x.* \(<unknown module>\)}}
// CHECK: {{    #2 0x.* in main}}
```
but the call stack looks like:
```
previously allocated by thread T0 here:
    #0 0x2aaeb3662a in operator[] /home/root/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x2aaeb3662a in GetSizeClass /home/root/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_primary32.h:203:44
    #2 0x2aaeb3662a in PointerIsMine /home/root/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_primary32.h:198:12
    #3 0x2aaeb3662a in FromPrimary /home/root/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_combined.h:121:59
    #4 0x2aaeb3662a in Allocate /home/root/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_allocator_dlsym.h:36:5
    #5 0x2aaeb3662a in malloc /home/root/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:12
    #6 0x3fb7319a0a  (<unknown module>)
    #7 0x2aaeb6e996 in main /home/root/llvm-project/compiler-rt/test/asan/TestCases/Linux/stack-trace-dlclose.cpp:33:13
    #8 0x3fb770dd74  (/lib/libc.so.6+0x29d74)
```

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


More information about the llvm-commits mailing list