Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] kselftest/arm64/pauth: Scale exec_changed_keys on KSFT_MACHINE_SLOW
@ 2026-07-10 21:59 Stephen Bertram
  0 siblings, 0 replies; only message in thread
From: Stephen Bertram @ 2026-07-10 21:59 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Stephen Bertram, linux-kselftest

exec_changed_keys performs a fork+exec per PAC_COLLISION_ATTEMPTS
iteration. After raising the default to 1000, the test exceeds the
30s kselftest harness timeout on debug kernels. Use a reduced
iteration count when KSFT_MACHINE_SLOW=yes, consistent with other
kselftests slow-machine handling.

Signed-off-by: Stephen Bertram <sbertram@redhat.com>
---
 tools/testing/selftests/arm64/pauth/pac.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/arm64/pauth/pac.c b/tools/testing/selftests/arm64/pauth/pac.c
index f4b859c75a5a..fb9a1e9f8491 100644
--- a/tools/testing/selftests/arm64/pauth/pac.c
+++ b/tools/testing/selftests/arm64/pauth/pac.c
@@ -14,6 +14,8 @@
 #include "helper.h"
 
 #define PAC_COLLISION_ATTEMPTS 1000
+/* exec_changed_keys is fork+exec heavy; scale down on slow machines. */
+#define PAC_SLOW_MACHINE_COLLISION_ATTEMPTS 250
 /*
  * The kernel sets TBID by default. So bits 55 and above should remain
  * untouched no matter what.
@@ -36,6 +38,16 @@ do { \
 		SKIP(return, "Generic PAUTH not enabled");	\
 } while (0)
 
+static inline int pac_collision_attempts(void)
+{
+	const char *slow = getenv("KSFT_MACHINE_SLOW");
+
+	if (slow && !strcmp(slow, "yes"))
+		return PAC_SLOW_MACHINE_COLLISION_ATTEMPTS;
+
+	return PAC_COLLISION_ATTEMPTS;
+}
+
 void sign_specific(struct signatures *sign, size_t val)
 {
 	sign->keyia = keyia_sign(val);
@@ -301,6 +313,7 @@ TEST(exec_changed_keys)
 	int ret;
 	int same = 10;
 	int nkeys = NKEYS;
+	int attempts = pac_collision_attempts();
 	unsigned long hwcaps = getauxval(AT_HWCAP);
 
 	/* generic and data key instructions are not in NOP space. This prevents a SIGILL */
@@ -309,8 +322,7 @@ TEST(exec_changed_keys)
 		TH_LOG("WARNING: Generic PAUTH not enabled. Skipping generic key checks");
 		nkeys = NKEYS - 1;
 	}
-
-	for (int i = 0; i < PAC_COLLISION_ATTEMPTS; i++) {
+	for (int i = 0; i < attempts; i++) {
 		ret = exec_sign_all(&new_keys, i);
 		ASSERT_EQ(0, ret) TH_LOG("failed to run worker");
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-10 22:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 21:59 [PATCH] kselftest/arm64/pauth: Scale exec_changed_keys on KSFT_MACHINE_SLOW Stephen Bertram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox