-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Commit 0012092
committed
Avoid memset in ASan error message printing.
`-ftrivial-auto-var-init=pattern` emits `memset` to initialize variables,
but with half-way intercepted functions this is problematic.
Can also be switched off per function with `__declspec(no_init_all)`.
Program received signal SIGSEGV, Segmentation fault.
0x7a80f51f in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
87 COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, dst, v, size);
1: x/i $pc
=> 0x7a80f51f <__asan_wrap_memset(void*, int, __sanitizer::usize)+335>: push %eax
(rr) bt 10
#0 0x7a80f51f in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#1 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#2 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#3 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
...
#9168 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#9169 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#9170 0x7a80f44b in __asan_wrap_memset (dst=0x121ed78, v=255, size=400) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc:87
#9171 0x7a7db0c7 in __sanitizer::SharedPrintfCode (append_pid=false, format=0x7a82b160 <.refptr.___ImageBase+4> "%s: CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx) (tid=%u)\n", args=<optimized out>) at /home/bernhard/data/entwicklung/2025/llvm-mingw/2025-01-04/llvm-mingw/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_printf.cpp:308
#9172 0x0000000c in ?? ()
(rr) disassemble __sanitizer::SharedPrintfCode
Dump of assembler code for function _ZN11__sanitizerL16SharedPrintfCodeEbPKcPc:
0x7a7db0a0 <+0>: push %ebp
0x7a7db0a1 <+1>: push %ebx
0x7a7db0a2 <+2>: push %edi
0x7a7db0a3 <+3>: push %esi
0x7a7db0a4 <+4>: sub $0x190,%esp
0x7a7db0aa <+10>: mov %edx,%esi
0x7a7db0ac <+12>: mov %ecx,%edi
0x7a7db0ae <+14>: mov 0x1a4(%esp),%ebp
0x7a7db0b5 <+21>: mov %esp,%ebx
0x7a7db0b7 <+23>: push $0x190
0x7a7db0bc <+28>: push $0xff
0x7a7db0c1 <+33>: push %ebx
=> 0x7a7db0c2 <+34>: call 0x7a823bc6 <memset>
0x7a7db0c7 <+39>: add $0xc,%esp
0x7a7db0ca <+42>: mov %edi,%ecx
0x7a7db0cc <+44>: mov %ebx,%edx
0x7a7db0ce <+46>: push %ebp
0x7a7db0cf <+47>: push %esi
0x7a7db0d0 <+48>: call 0x7a7db5c0 <_ZN11__sanitizerL24SharedPrintfCodeNoBufferEbPciPKcS0_>
0x7a7db0d5 <+53>: add $0x198,%esp
0x7a7db0db <+59>: pop %esi
0x7a7db0dc <+60>: pop %edi
0x7a7db0dd <+61>: pop %ebx
0x7a7db0de <+62>: pop %ebp
0x7a7db0df <+63>: ret
End of assembler dump.
With the `no_init_all` ASan prints:
AddressSanitizer: CHECK failed: asan_suppressions.cpp:46 "((suppression_ctx)) != (0)" (0x0, 0x0) (tid=36)
Unfortunately it looks like this draws in almost all dlls ...
/* llvm-symbolizer.exe, avoid loading libclang_rt.asan_dynamic-i386.dll too early */
strstr(make->module, "msvcp140.dll") ||
strstr(make->module, "vcruntime140.dll") ||
strstr(make->module, "concrt140.dll") ||
strstr(make->module, "advapi32.dll") ||
strstr(make->module, "sechost.dll") ||
strstr(make->module, "gdi32.dll") ||
strstr(make->module, "oleaut32.dll") ||
strstr(make->module, "imm32.dll") ||
strstr(make->module, "rpcrt4.dll") ||
strstr(make->module, "combase.dll") ||
strstr(make->module, "ole32.dll") ||
strstr(make->module, "iphlpapi.dll") ||
strstr(make->module, "dnsapi.dll") ||
strstr(make->module, "netapi32.dll") ||
strstr(make->module, "nsi.dll") ||
strstr(make->module, "ws2_32.dll") ||
strstr(make->module, "winspool.drv") ||
strstr(make->module, "compstui.dll") ||
strstr(make->module, "comctl32.dll") ||
strstr(make->module, "comctl32.dll") ||
and more ... but it looked working with x86_64 ?1 parent 32e9e8d commit 0012092Copy full SHA for 0012092
File tree
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changedFilter options
- compiler-rt
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changed+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
540 | 540 |
| |
541 | 541 |
| |
542 | 542 |
| |
543 |
| - | |
| 543 | + | |
544 | 544 |
| |
545 | 545 |
| |
546 | 546 |
| |
|
0 commit comments