Author: Daniil Kovalev
Date: 2025-12-29T06:56:52Z
New Revision: 367e3889fabcc3dcd3ee2d664d652ab6ec26854b

URL: 
https://github.com/llvm/llvm-project/commit/367e3889fabcc3dcd3ee2d664d652ab6ec26854b
DIFF: 
https://github.com/llvm/llvm-project/commit/367e3889fabcc3dcd3ee2d664d652ab6ec26854b.diff

LOG: [PAC][libunwind] Enhance PAuth-related comments in `__unw_set_reg` 
(#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

Added: 
    

Modified: 
    libunwind/src/libunwind.cpp

Removed: 
    


################################################################################
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