[libcxx-commits] [compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

Oliver Hunt via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 5 23:47:56 PDT 2025


================
@@ -597,6 +611,18 @@ _LIBUNWIND_EXPORT uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) {
   unw_cursor_t *cursor = (unw_cursor_t *)context;
   unw_word_t result;
   __unw_get_reg(cursor, UNW_REG_IP, &result);
+
+#if __has_feature(ptrauth_calls)
+  // If we are in an arm64e frame, then the PC should have been signed with the
+  // sp
+  {
+    unw_word_t sp;
+    __unw_get_reg(cursor, UNW_REG_SP, &sp);
+    result = (unw_word_t)ptrauth_auth_data((void *)result,
+                                           ptrauth_key_return_address, sp);
+  }
+#endif
----------------
ojhunt wrote:

I think we'll need to go through the pr to determine which of the ptrauth_calls should be ptrauth_returns as our codebase assumes they're always the same

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


More information about the libcxx-commits mailing list