git: 89bb17ec3b02 - main - arm64: Mask out the PAC ID fields when disabled
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Jun 2025 10:42:01 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=89bb17ec3b0260fa0d9c30a23b7e5f73fc5917f4 commit 89bb17ec3b0260fa0d9c30a23b7e5f73fc5917f4 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2025-06-02 09:57:44 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2025-06-02 09:57:44 +0000 arm64: Mask out the PAC ID fields when disabled When we disable PAC we need to mask out the ID registers for userspace. Call update_special_reg to mask them out so userspace gets a correct view of the registers and hwcaps. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50573 --- sys/arm64/arm64/ptrauth.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/ptrauth.c b/sys/arm64/arm64/ptrauth.c index 7ef958b2e03c..dd36e66c85bb 100644 --- a/sys/arm64/arm64/ptrauth.c +++ b/sys/arm64/arm64/ptrauth.c @@ -97,14 +97,14 @@ ptrauth_check(const struct cpu_feat *feat __unused, u_int midr __unused) if (!pac_enable) { if (boothowto & RB_VERBOSE) printf("Pointer authentication is disabled\n"); - return (false); + goto out; } if (!get_kernel_reg(ID_AA64ISAR1_EL1, &isar1)) - return (false); + goto out; if (ptrauth_disable()) - return (false); + goto out; /* * This assumes if there is pointer authentication on the boot CPU @@ -113,6 +113,12 @@ ptrauth_check(const struct cpu_feat *feat __unused, u_int midr __unused) */ return (ID_AA64ISAR1_APA_VAL(isar1) > 0 || ID_AA64ISAR1_API_VAL(isar1) > 0); + +out: + update_special_reg(ID_AA64ISAR1_EL1, ID_AA64ISAR1_API_MASK | + ID_AA64ISAR1_APA_MASK | ID_AA64ISAR1_GPA_MASK | + ID_AA64ISAR1_GPI_MASK, 0); + return (false); } static void