[libcxx-commits] [PATCH] D96560: libunwind: Don't attempt to authenticate a null return address.

Peter Collingbourne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Feb 11 16:25:27 PST 2021

pcc created this revision.
pcc added reviewers: rprichard, danielkiss.
Herald added a project: libunwind.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libunwind.
pcc requested review of this revision.
Herald added a project: LLVM.

Null return addresses can appear at the bottom of the stack (i.e. the
frame corresponding to the entry point). Authenticating these addresses
will set the error code in the address, which will lead to a segfault
in the sigreturn trampoline detection code. Fix this problem by not
authenticating null addresses.

  rG LLVM Github Monorepo



Index: libunwind/src/DwarfInstructions.hpp
--- libunwind/src/DwarfInstructions.hpp
+++ libunwind/src/DwarfInstructions.hpp
@@ -213,7 +213,8 @@
       // restored. autia1716 is used instead of autia as autia1716 assembles
       // to a NOP on pre-v8.3a architectures.
       if ((R::getArch() == REGISTERS_ARM64) &&
-          prolog.savedRegisters[UNW_ARM64_RA_SIGN_STATE].value) {
+          prolog.savedRegisters[UNW_ARM64_RA_SIGN_STATE].value &&
+          returnAddress != 0) {
         return UNW_ECROSSRASIGNING;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96560.323185.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210212/98cc0384/attachment-0001.bin>

More information about the libcxx-commits mailing list