[libcxx-commits] [PATCH] D114385: [libunwind] Fix testing with sanitizers enabled
Leonard Chan via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 29 13:54:53 PST 2021
leonardchan added a comment.
> The unwind_leaffunction.pass.cpp test was failing with ubsan because it was
> relying on undefined behavior to "do the right thing" and result in a SIGSEGV.
> IMO it makes more sense to simply raise a SIGSEGV directly, since that is guaranteed
> to work.
It looks like using `raise` causes this test to fail on our aarch64 builder <https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-arm64/b8829557385974689473/overview> with exit code 255 (from the `_Exit(-1)` in `signal_handler`). I'm unsure why it would fail when using `raise`. These are a couple of things I noticed when debugging:
- If I replace `raise(SIGSEGV)` with `kill(getpid(), SIGSEGV)`, the test passes normally. The man page <https://man7.org/linux/man-pages/man3/raise.3.html> for raise says this is functionally equivalent.
- If I manually print out the frame names from `info.dli_sname`, I notice with `raise` I only cover 2 frames (`_Z14signal_handleri`, `__kernel_rt_sigreturn`) but with `kill` I get 5 frames (`_Z14signal_handleri`, `__kernel_rt_sigreturn`, `kill`, `_Z18crashing_leaf_funcv`, `main`).
- If I use the old UB approach, I get 4 frames (just excluding the call to `kill`).
Any ideas for why this might be the case?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114385/new/
https://reviews.llvm.org/D114385
More information about the libcxx-commits
mailing list