[libcxx-commits] [PATCH] D90898: [libunwind] Unwind through aarch64/Linux sigreturn frame

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 5 20:27:33 PST 2020


rprichard created this revision.
rprichard added reviewers: danielkiss, compnerd, srhines.
Herald added subscribers: libcxx-commits, llvm-commits, kristof.beyls, krytarowski.
Herald added projects: LLVM, libunwind.
Herald added a reviewer: libunwind.
rprichard requested review of this revision.

An AArch64 sigreturn trampoline frame can't currently be described
in a DWARF .eh_frame section, because the AArch64 DWARF spec currently
doesn't define a constant for the PC register. (PC and LR may need to
be restored to different values.)

Instead, use the same technique as libgcc or github.com/libunwind and
detect the sigreturn frame by looking for the sigreturn instructions:

  mov x8, #0x8b
  svc #0x0

If a sigreturn frame is detected, libunwind restores all the GPRs by
assuming that sp points at an rt_sigframe Linux kernel struct. This
behavior is a fallback mode that is only used if there is no ordinary
unwind info for sigreturn.

If libunwind can't find unwind info for a PC, it assumes that the PC is
readable, which could crash if it points at an XOM
(execute-only-memory) function or is invalid.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90898

Files:
  libunwind/include/__libunwind_config.h
  libunwind/src/UnwindCursor.hpp
  libunwind/test/signal_unwind.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90898.303320.patch
Type: text/x-patch
Size: 7045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201106/3b886f1b/attachment-0001.bin>


More information about the libcxx-commits mailing list