[clang] [compiler-rt] Move interceptors for libresolv functions to MSan (PR #119071)

Aaron Puchert via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 06:56:13 PST 2024


aaronpuchert wrote:

With my change reverted I get the failure as well:
```
FAIL: SanitizerCommon-msan-x86_64-Linux :: Linux/dn_expand.cpp (5088 of 5094)
******************** TEST 'SanitizerCommon-msan-x86_64-Linux :: Linux/dn_expand.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: [...]/bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=memory  -funwind-tables --sysroot=/home/aaron/chrome-sysroot  -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/msan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp &&  [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/msan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
+ [...]/bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=memory -funwind-tables --sysroot=/home/aaron/chrome-sysroot -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/msan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp
+ [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/msan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
MemorySanitizer:DEADLYSIGNAL
==18030==ERROR: MemorySanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x000000000400 sp 0x7ffe85eb3638 T18030)
==18030==Hint: pc points to the zero page.
==18030==The signal is caused by a READ memory access.
==18030==Hint: address points to the zero page.
    #0 0x000000000000  (<unknown module>)
    #1 0x55e9e7fc6f54 in __sanitizer::BufferedStackTrace::UnwindImpl(unsigned long, unsigned long, void*, bool, unsigned int) [...]/compiler-rt/lib/msan/msan.cpp:342:12
    #2 0x55e9e7fbf356 in ReportDeadlySignalImpl [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:275:3
    #3 0x55e9e7fbf356 in __sanitizer::ReportDeadlySignal(__sanitizer::SignalContext const&, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:289:5
    #4 0x55e9e7fbf6e0 in __sanitizer::HandleDeadlySignal(void*, void*, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:298:3
    #5 0x7fe82565797f  (/lib64/libc.so.6+0x5797f) (BuildId: 4f849c7c3d8ac76c5b3bafcb925d42a5e83bc222)

==18030==Register values:
rax = 0x00002fe825ca8690  rbx = 0x00007ffe85eb3690  rcx = 0x00007ffe85eb3690  rdx = 0x00007ffe85eb3aa7
rdi = 0x00007ffe85eb3a90  rsi = 0x00007ffe85eb3ab3  rbp = 0x0000000000000400  rsp = 0x00007ffe85eb3638
 r8 = 0x0000000000000400   r9 = 0x00007fe825d1247e  r10 = 0x00007fe825618de0  r11 = 0x00007fe8256413be
r12 = 0x00007ffe85eb3a90  r13 = 0xffffaf0000000000  r14 = 0x00007ffe85eb3aa7  r15 = 0x00007ffe85eb3ab3
MemorySanitizer can not provide additional info.
SUMMARY: MemorySanitizer: SEGV (<unknown module>)
==18030==ABORTING

--

********************
FAIL: SanitizerCommon-asan-x86_64-Linux :: Linux/dn_expand.cpp (5090 of 5094)
******************** TEST 'SanitizerCommon-asan-x86_64-Linux :: Linux/dn_expand.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: [...]/bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=address  -funwind-tables --sysroot=/home/aaron/chrome-sysroot  -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp &&  [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
+ [...]/bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=address -funwind-tables --sysroot=/home/aaron/chrome-sysroot -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp
+ [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/asan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
AddressSanitizer:DEADLYSIGNAL
=================================================================
==18038==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7ffd1ccba1b0 sp 0x7ffd1ccb9968 T0)
==18038==Hint: pc points to the zero page.
==18038==The signal is caused by a READ memory access.
==18038==Hint: address points to the zero page.
    #0 0x000000000000  (<unknown module>)
    #1 0x55b3f6ded096 in testWrite() [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp:16:13
    #2 0x55b3f6ded9ba in main [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp:86:3
    #3 0x7f4f98c40eeb in __libc_start_call_main (/lib64/libc.so.6+0x40eeb) (BuildId: 4f849c7c3d8ac76c5b3bafcb925d42a5e83bc222)

==18038==Register values:
rax = 0x00000000970de001  rbx = 0x00007b4f970de070  rcx = 0x00007b4f970de070  rdx = 0x00007b4f970de037
rdi = 0x00007b4f970de020  rsi = 0x00007b4f970de043  rbp = 0x00007ffd1ccba1b0  rsp = 0x00007ffd1ccb9968
 r8 = 0x0000000000000400   r9 = 0x0000000000000000  r10 = 0x00000f69f2e1bc08  r11 = 0x0000000000000003
r12 = 0x00007b4f970de043  r13 = 0x00007b4f970de070  r14 = 0x00000000970de000  r15 = 0x00007b4f970de037
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (<unknown module>)
==18038==ABORTING

--

********************
FAIL: SanitizerCommon-tsan-x86_64-Linux :: Linux/dn_expand.cpp (5094 of 5094)
******************** TEST 'SanitizerCommon-tsan-x86_64-Linux :: Linux/dn_expand.cpp' FAILED ********************
Exit Code: 66

Command Output (stderr):
--
RUN: at line 1: [...]/bin/clang  --driver-mode=g++ -gline-tables-only -fsanitize=thread  -funwind-tables --sysroot=/home/aaron/chrome-sysroot  -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/tsan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp &&  [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/tsan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
+ [...]/bin/clang --driver-mode=g++ -gline-tables-only -fsanitize=thread -funwind-tables --sysroot=/home/aaron/chrome-sysroot -I[...]/compiler-rt/test -ldl [...]/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp -o [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/tsan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp
+ [...]/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/tsan-x86_64-Linux/Linux/Output/dn_expand.cpp.tmp [...]/compiler-rt/test/sanitizer_common/TestCases/Linux
ThreadSanitizer:DEADLYSIGNAL
==18043==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x000000000400 sp 0x7ffef632c3e8 T18043)
==18043==Hint: pc points to the zero page.
==18043==The signal is caused by a READ memory access.
==18043==Hint: address points to the zero page.
    #0 <null> <null> (0x000000000000)
    #1 __sanitizer::BufferedStackTrace::UnwindImpl(unsigned long, unsigned long, void*, bool, unsigned int) [...]/compiler-rt/lib/tsan/rtl/tsan_stack_trace.cpp:55:3 (dn_expand.cpp.tmp+0xe10d0)
    #2 ReportDeadlySignalImpl [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:275:3 (dn_expand.cpp.tmp+0x53af6)
    #3 __sanitizer::ReportDeadlySignal(__sanitizer::SignalContext const&, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:289:5 (dn_expand.cpp.tmp+0x53af6)
    #4 __sanitizer::HandleDeadlySignal(void*, void*, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) [...]/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:298:3 (dn_expand.cpp.tmp+0x53e80)
    #5 <null> <null> (libc.so.6+0x5797f) (BuildId: 4f849c7c3d8ac76c5b3bafcb925d42a5e83bc222)

==18043==Register values:
rax = 0x0000563f3b6f553c  rbx = 0x00007ffef632c450  rcx = 0x00007ffef632c450  rdx = 0x00007ffef632c867
rdi = 0x00007ffef632c850  rsi = 0x00007ffef632c873  rbp = 0x0000000000000400  rsp = 0x00007ffef632c3e8
 r8 = 0x0000000000000400   r9 = 0x00000fffffffffff  r10 = 0x00007f134225f3d0  r11 = 0x0000000000001180
r12 = 0x00007ffef632c873  r13 = 0x00007ffef632c850  r14 = 0x00007f13422c6780  r15 = 0x00007ffef632c867
ThreadSanitizer can not provide additional info.
SUMMARY: ThreadSanitizer: SEGV (<unknown module>)
==18043==ABORTING
```
Of course that is with a system libc ≥ 2.34. Building and running the test against the sysroot, it succeeds as above. Could it be that you've ignored those test cases? Or am I seeing a different error than you?

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


More information about the llvm-commits mailing list