[libunwind] [PAC][libunwind] Enhance PAuth-related comments in `__unw_set_reg` (PR #173769)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 28 07:56:19 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libunwind
Author: Daniil Kovalev (kovdan01)
<details>
<summary>Changes</summary>
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
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/173769
More information about the cfe-commits
mailing list