Skip to content

Conversation

@kovdan01
Copy link
Contributor

The PAuth-related checks performed for arm64e are also performed for other PAuth-enabled ABIs such as Linux's pauthtest. This patch introduces use of 'PAuth-enabled ABI' phrase instead of 'arm64e' term for non-arm64e specific things. Also, on non-arm64e we cannot assume that we have FPAC, so an additional explanation regarding resign function guarantees is provided.

Note that other comments mentioning arm64e while not being arm64e-specific are fixed as part of #171717.

Fixes #160117

The PAuth-related checks performed for arm64e are also performed for
other PAuth-enabled ABIs such as Linux's pauthtest. This patch
introduces use of 'PAuth-enabled ABI' phrase instead of 'arm64e' term
for non-arm64e specific things. Also, on non-arm64e we cannot assume
that we have FPAC, so an additional explanation regarding resign
function guarantees is provided.

Note that other comments mentioning arm64e while not being
arm64e-specific are fixed as part of llvm#171717.

Fixes llvm#160117
@kovdan01 kovdan01 self-assigned this Dec 28, 2025
@kovdan01 kovdan01 moved this to In Progress in Pointer Authentication Tasks Dec 28, 2025
@kovdan01 kovdan01 marked this pull request as ready for review December 28, 2025 15:55
@kovdan01 kovdan01 requested a review from a team as a code owner December 28, 2025 15:55
@kovdan01 kovdan01 requested review from asl and ojhunt December 28, 2025 15:55
@llvmbot
Copy link
Member

llvmbot commented Dec 28, 2025

@llvm/pr-subscribers-libunwind

Author: Daniil Kovalev (kovdan01)

Changes

The PAuth-related checks performed for arm64e are also performed for other PAuth-enabled ABIs such as Linux's pauthtest. This patch introduces use of 'PAuth-enabled ABI' phrase instead of 'arm64e' term for non-arm64e specific things. Also, on non-arm64e we cannot assume that we have FPAC, so an additional explanation regarding resign function guarantees is provided.

Note that other comments mentioning arm64e while not being arm64e-specific are fixed as part of #171717.

Fixes #160117


Full diff: https://github.com/llvm/llvm-project/pull/173769.diff

1 Files Affected:

  • (modified) libunwind/src/libunwind.cpp (+9-6)
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index b3036396c379d..7ffffc2a30c0a 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -150,16 +150,19 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum,
           _LIBUNWIND_ABORT("PC vs frame info mismatch");
 
         // PC should have been signed with the sp, so we verify that
-        // roundtripping does not fail.
+        // roundtripping does not fail. The `ptrauth_auth_and_resign` is
+        // guaranteed to trap on authentication failure even without FPAC
+        // feature.
         pint_t pc = (pint_t)co->getReg(UNW_REG_IP);
         if (ptrauth_auth_and_resign((void *)pc, ptrauth_key_return_address, sp,
                                     ptrauth_key_return_address,
                                     sp) != (void *)pc) {
-          _LIBUNWIND_LOG("Bad unwind through arm64e (0x%zX, 0x%zX)->0x%zX\n",
-                         pc, sp,
-                         (pint_t)ptrauth_auth_data(
-                             (void *)pc, ptrauth_key_return_address, sp));
-          _LIBUNWIND_ABORT("Bad unwind through arm64e");
+          _LIBUNWIND_LOG(
+              "Bad unwind with PAuth-enabled ABI (0x%zX, 0x%zX)->0x%zX\n", pc,
+              sp,
+              (pint_t)ptrauth_auth_data((void *)pc, ptrauth_key_return_address,
+                                        sp));
+          _LIBUNWIND_ABORT("Bad unwind with PAuth-enabled ABI");
         }
       }
 #endif

@kovdan01
Copy link
Contributor Author

@ojhunt I believe that this is pretty trivial, so I would appreciate if you could take a quick look at this and give a feedback and say if new comments seem reasonable for you :)

Copy link
Collaborator

@asl asl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks like simple enough

@kovdan01 kovdan01 merged commit 367e388 into llvm:main Dec 29, 2025
83 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pointer Authentication Tasks Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[PAC][libunwind] Enhance comments and error messages related to libunwind hardening

3 participants