git: 75c66218401c - main - tests/posixshm: Check for hardware support in largepage_pkru
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 24 Apr 2026 13:28:39 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=75c66218401c00f4728d5312e2b933b8d3aefde1
commit 75c66218401c00f4728d5312e2b933b8d3aefde1
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-04-24 13:23:03 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-04-24 13:23:03 +0000
tests/posixshm: Check for hardware support in largepage_pkru
MFC after: 3 days
Fixes: ca87c0b8e396 ("pkru: Fix handling of 1GB largepage mappings")
---
tests/sys/posixshm/posixshm_test.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/sys/posixshm/posixshm_test.c b/tests/sys/posixshm/posixshm_test.c
index 8333faa90594..fe6386c6aa4b 100644
--- a/tests/sys/posixshm/posixshm_test.c
+++ b/tests/sys/posixshm/posixshm_test.c
@@ -39,6 +39,8 @@
#include <sys/wait.h>
#ifdef __amd64__
+#include <machine/cpufunc.h>
+#include <machine/specialreg.h>
#include <machine/sysarch.h>
#endif
@@ -1966,6 +1968,14 @@ ATF_TC_BODY(largepage_pkru, tc)
struct sigaction sa;
char *addr, *addr1;
int error, fd, pscnt;
+ u_int regs[4];
+
+ do_cpuid(0, regs);
+ if (regs[0] < 7)
+ atf_tc_skip("PKU not supported");
+ cpuid_count(7, 0, regs);
+ if ((regs[2] & CPUID_STDEXT2_PKU) == 0)
+ atf_tc_skip("PKU not supported");
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = sigsegv;