[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)
Anatoly Trosinenko via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 08:56:22 PDT 2025
================
@@ -681,7 +681,18 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto)
// context struct, because it is allocated on the stack, and an exception
// could clobber the de-allocated portion of the stack after sp has been
// restored.
- ldr x16, [x0, #0x0F8]
+
+ ldr x16, [x0, #0x0F8] // load sp into scratch
+ ldr lr, [x0, #0x100] // restore pc into lr
+
+#if __has_feature(ptrauth_calls)
+ // The LR is signed with its address inside the register state. Time
+ // to resign to be a regular ROP signed pointer
+ add x1, x0, #0x100
+ autib lr, x1
+ pacib lr, x16 // signed the scratch register for sp
+#endif
----------------
atrosinenko wrote:
Likewise, we should probably use `autib1716` and `pacib1716` here to retain compatibility with Armv8.2-a.
https://github.com/llvm/llvm-project/pull/143230
More information about the llvm-commits
mailing list