[PATCH] D138095: [asan] Keep Itanium mangled names in global metadata

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 15:56:50 PST 2022


MaskRay added a comment.

In D138095#3945279 <https://reviews.llvm.org/D138095#3945279>, @gulfem wrote:

> In D138095#3941913 <https://reviews.llvm.org/D138095#3941913>, @MaskRay wrote:
>
>> In D138095#3941776 <https://reviews.llvm.org/D138095#3941776>, @gulfem wrote:
>>
>>> We started seeing the following test failures.
>>>
>>>   Failed Tests (8):
>>>     AddressSanitizer-x86_64-linux :: TestCases/Linux/odr-violation.cpp
>>>     AddressSanitizer-x86_64-linux :: TestCases/global-demangle.cpp
>>>     AddressSanitizer-x86_64-linux :: TestCases/global-location-nodebug.cpp
>>>     AddressSanitizer-x86_64-linux :: TestCases/global-location.cpp
>>>     AddressSanitizer-x86_64-linux-dynamic :: TestCases/Linux/odr-violation.cpp
>>>     AddressSanitizer-x86_64-linux-dynamic :: TestCases/global-demangle.cpp
>>>     AddressSanitizer-x86_64-linux-dynamic :: TestCases/global-location-nodebug.cpp
>>>     AddressSanitizer-x86_64-linux-dynamic :: TestCases/global-location.cpp
>>>
>>> https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8797107374001425041/overview
>>>
>>> The error is message from `global-demangle.cpp` is as the following:
>>>
>>>   FAIL: AddressSanitizer-x86_64-linux :: TestCases/global-demangle.cpp (560 of 12394)
>>>   ******************** TEST 'AddressSanitizer-x86_64-linux :: TestCases/global-demangle.cpp' FAILED ********************
>>>   Script:
>>>   --
>>>   : 'RUN: at line 1';      /b/s/w/ir/x/w/staging/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   -O0 /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp -o /b/s/w/ir/x/w/staging/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/global-demangle.cpp.tmp && not  /b/s/w/ir/x/w/staging/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/global-demangle.cpp.tmp 2>&1 | FileCheck /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp
>>>   --
>>>   Exit Code: 1
>>>   
>>>   Command Output (stderr):
>>>   --
>>>   /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp:15:12: error: CHECK: expected string not found in input
>>>    // CHECK: '{{.*}}XXX::YYY::ZZZ{{.*}}' {{.*}} of size 4
>>>              ^
>>>   <stdin>:8:56: note: scanning from here
>>>   0x561bdea237e6 is located 2 bytes after global variable '_ZN3XXX3YYY3ZZZE' defined in '/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp' (0x561bdea237e0) of size 4
>>>                                                          ^
>>>   <stdin>:8:165: note: possible intended match here
>>>   0x561bdea237e6 is located 2 bytes after global variable '_ZN3XXX3YYY3ZZZE' defined in '/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp' (0x561bdea237e0) of size 4
>>>                                                                                                                                                                       ^
>>>   
>>>   Input file: <stdin>
>>>   Check file: /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp
>>>   
>>>   -dump-input=help explains the following input dump.
>>>   
>>>   Input was:
>>>   <<<<<<
>>>               1: ================================================================= 
>>>               2: ==315196==ERROR: AddressSanitizer: global-buffer-overflow on address 0x561bdea237e6 at pc 0x561bdea15d7e bp 0x7ffda4270b00 sp 0x7ffda4270af8 
>>>               3: READ of size 1 at 0x561bdea237e6 thread T0 
>>>               4:  #0 0x561bdea15d7d in main /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp:12:15 
>>>               5:  #1 0x7fe9bc8a1d09 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x23d09) (BuildId: 814ca45fb917d1b757796ff5f456237c263711c7) 
>>>               6:  #2 0x561bde940339 in _start (/b/s/w/ir/x/w/staging/llvm_build/runtimes/runtimes-x86_64-unknown-linux-gnu-bins/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/global-demangle.cpp.tmp+0x59339) (BuildId: 4e75c435413f2362) 
>>>               7:  
>>>               8: 0x561bdea237e6 is located 2 bytes after global variable '_ZN3XXX3YYY3ZZZE' defined in '/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp' (0x561bdea237e0) of size 4 
>>>   check:15'0                                                            X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
>>>   check:15'1                                                                                                                                                                         ?                                   possible intended match
>>>               9:  '_ZN3XXX3YYY3ZZZE' is ascii string 'abc' 
>>>   check:15'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>              10: SUMMARY: AddressSanitizer: global-buffer-overflow /b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/asan/TestCases/global-demangle.cpp:12:15 in main 
>>>   check:15'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>              11: Shadow bytes around the buggy address: 
>>>   check:15'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>              12:  0x561bdea23500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
>>>   check:15'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>              13:  0x561bdea23580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
>>>   check:15'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>               .
>>>               .
>>>               .
>>>   >>>>>>
>>
>> I'll appreciate some debugging since other sanitizer bots seem fine? Does your build bot not link asan tests with libc++abi or libstdc++ which provides `__cxa_demangle`? Then a mangled name is expected.
>> I vaguely remember that Fuchsia does things somewhat differently.
>
> After https://reviews.llvm.org/rGdb7c82231c32074440d5426870051228435c6bce, we do not see the test asan test failures anymore.
> Are you planning to reland this patch or did you abandon it? We encountered the issue while building the Fuchsia toolchain for the host (Linux), and these tests failed on Linux, not Fuchsia.

Thanks for checking. db7c82231c32074440d5426870051228435c6bce <https://reviews.llvm.org/rGdb7c82231c32074440d5426870051228435c6bce> restored the original behavior and I do not plan to reland the demangling part of the patch (infeasible since -fsanitize=address user may not link in libc++abi/libstdc++).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138095/new/

https://reviews.llvm.org/D138095



More information about the llvm-commits mailing list