https://github.com/kovdan01 created 
https://github.com/llvm/llvm-project/pull/173769

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

>From d747d9d80c69ea512857030713003c5bef0bb6e7 Mon Sep 17 00:00:00 2001
From: Daniil Kovalev <[email protected]>
Date: Sun, 28 Dec 2025 15:48:13 +0300
Subject: [PATCH] [PAC][libunwind] Enhance PAuth-related comments in
 `__unw_set_reg`

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
---
 libunwind/src/libunwind.cpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

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

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to