git: 87054ce8fb07 - releng/15.1 - tests/posixshm: Check for hardware support in largepage_pkru
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 07 May 2026 20:40:26 UTC
The branch releng/15.1 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=87054ce8fb0739cde2399e06af7ea083dc2a9c58
commit 87054ce8fb0739cde2399e06af7ea083dc2a9c58
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-04-24 13:23:03 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-05-07 20:40:09 +0000
tests/posixshm: Check for hardware support in largepage_pkru
Approved by: re (cperciva)
MFC after: 3 days
Fixes: ca87c0b8e396 ("pkru: Fix handling of 1GB largepage mappings")
(cherry picked from commit 75c66218401c00f4728d5312e2b933b8d3aefde1)
(cherry picked from commit 8988b4de4e3b85baa97fd76254e00da7d3304b35)
---
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;