[libunwind] [libunwind] fix unwinding from signal handler (PR #92291)

David Tenty via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 19:37:28 PDT 2024


daltenty wrote:

This is breaking a number of tests for the UBSAN on AIX, the traceback produced by the runtime are no longer correct.

Before this change:
```
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==52887862==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x00000000 (pc 0x10000784 bp 0x2ff22020 sp 0x2ff22020 T59639729)
==52887862==The signal is caused by a UNKNOWN memory access.
==52887862==Hint: address points to the zero page.
    #0 0x10000784 in .void Xyz::Abc<int, int>() /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
    #1 0x1000073c in .bar /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:25
    #2 0x100007cc in .FOO() /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:29
    #3 0x10000834 in .main /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:33
    #4 0x100002d0 in .__start (/home/daltenty/llvm/dev/build/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/ubsan-powerpc-AIX/Posix/Output/dedup_token_length_test.cpp.tmp+0x100002d0)

DEDUP_TOKEN: .void Xyz::Abc<int, int>()--.bar
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20 in .void Xyz::Abc<int, int>()
==52887862==ABORTING
```

After:
```
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==1704572==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x00000000 (pc 0x10000784 bp 0x2ff221b0 sp 0x2ff221b0 T56035233)
==1704572==The signal is caused by a UNKNOWN memory access.
==1704572==Hint: address points to the zero page.
    #0 0x10000784 in .void Xyz::Abc<int, int>() /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
    #1 0x1001d764 in .ubsan_GetStackTrace(__sanitizer::BufferedStackTrace*, unsigned int, unsigned int, unsigned int, void*, bool) /home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/ubsan/ubsan_diag.cpp:41
    #2 0x10025ca4 in .__ubsan::OnStackUnwind(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*) /home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp:53
    #3 0x1001cd10 in ReportDeadlySignalImpl /home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:272
    #4 0x1001cd10 in .__sanitizer::ReportDeadlySignal(__sanitizer::SignalContext const&, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) /home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:286
    #5 0x1001d2d4 in .__sanitizer::HandleDeadlySignal(void*, void*, unsigned int, void (*)(__sanitizer::SignalContext const&, void const*, __sanitizer::BufferedStackTrace*), void const*) /home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:295

DEDUP_TOKEN: .void Xyz::Abc<int, int>()--.ubsan_GetStackTrace(__sanitizer::BufferedStackTrace*, unsigned int, unsigned int, unsigned int, void*, bool)
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV /home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20 in .void Xyz::Abc<int, int>()
==1704572==ABORTING
```


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


More information about the cfe-commits mailing list