* [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf
@ 2026-02-03 6:33 Magnus Lindholm
2026-02-05 2:17 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Magnus Lindholm @ 2026-02-03 6:33 UTC (permalink / raw)
To: kees, luto, wad, shuah, linux-kselftest, linux-kernel,
linux-alpha, glaubitz
Cc: Magnus Lindholm
Enable seccomp_bpf selftests on the Alpha architecture by providing
Alpha-specific register definitions and syscall accessors.
This allows the seccomp-bpf test suite to exercise syscall tracing,
seccomp filters, and user notification on Alpha.
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 29 +++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 32e2d4df397b..db2c81bb89b6 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -136,6 +136,8 @@ struct seccomp_data {
# define __NR_seccomp 354
# elif defined(__x86_64__)
# define __NR_seccomp 317
+# elif defined(__alpha__)
+# define __NR_seccomp 514
# elif defined(__arm__)
# define __NR_seccomp 383
# elif defined(__aarch64__)
@@ -1748,6 +1750,29 @@ TEST_F(TRACE_poke, getpid_runs_normally)
# define ARCH_REGS struct user_regs_struct
# define SYSCALL_NUM(_regs) (_regs).orig_eax
# define SYSCALL_RET(_regs) (_regs).eax
+#elif defined(__alpha__)
+#define ARCH_REGS struct pt_regs
+#define SYSCALL_NUM(_regs) ((_regs).r1)
+#define SYSCALL_NR_SET(_regs, _nr) \
+ ((_regs).r1 = (unsigned long)(_nr))
+#define SYSCALL_RET(_regs) ((_regs).r0)
+/*
+ * Alpha syscall ABI:
+ * - r0 holds return value (or positive errno on failure)
+ * - r19 (a3) is 0 on success, 1 on failure
+ */
+#define SYSCALL_RET_SET(_regs, _val) \
+ do { \
+ long __v = (long)(_val); \
+ if (__v < 0) { \
+ (_regs).r0 = (unsigned long)(-__v); \
+ (_regs).r19 = 1; \
+ } else { \
+ (_regs).r0 = (unsigned long)__v; \
+ (_regs).r19 = 0; \
+ } \
+ } while (0)
+
#elif defined(__arm__)
# define ARCH_REGS struct pt_regs
# define SYSCALL_NUM(_regs) (_regs).ARM_r7
@@ -4643,6 +4668,10 @@ TEST(user_notification_wait_killable_pre_notification)
pid_t pid;
long ret;
char c;
+
+ #if defined(__alpha__)
+ SKIP(return, "/proc/<pid>/syscall not available on Alpha");
+ #endif
/* 100 ms */
struct timespec delay = { .tv_nsec = 100000000 };
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf
2026-02-03 6:33 [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf Magnus Lindholm
@ 2026-02-05 2:17 ` Kees Cook
2026-02-05 6:16 ` Magnus Lindholm
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2026-02-05 2:17 UTC (permalink / raw)
To: Magnus Lindholm
Cc: luto, wad, shuah, linux-kselftest, linux-kernel, linux-alpha,
glaubitz
On Tue, Feb 03, 2026 at 07:33:26AM +0100, Magnus Lindholm wrote:
> Enable seccomp_bpf selftests on the Alpha architecture by providing
> Alpha-specific register definitions and syscall accessors.
>
> This allows the seccomp-bpf test suite to exercise syscall tracing,
> seccomp filters, and user notification on Alpha.
>
> Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Great! Thanks for doing this. How did you test it?
-Kees
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf
2026-02-05 2:17 ` Kees Cook
@ 2026-02-05 6:16 ` Magnus Lindholm
0 siblings, 0 replies; 3+ messages in thread
From: Magnus Lindholm @ 2026-02-05 6:16 UTC (permalink / raw)
To: Kees Cook
Cc: luto, wad, shuah, linux-kselftest, linux-kernel, linux-alpha,
glaubitz
>
> Great! Thanks for doing this. How did you test it?
>
I have a kernel patch ready with SECCOMP support for Alpha,
I'm doing some clean-up work before posting it. I'll have it posted
soon.
# PASSED: 111 / 111 tests passed.
# 13 skipped test(s) detected. Consider enabling relevant config
# options to improve coverage.
# Totals: pass:98 fail:0 xfail:0 xpass:0 skip:13 error:0
ds10 ~ #
ds10 ~ # uname -a
Linux ds10 6.19.0-rc6-00087-g8f403dd8d03b-dirty #121 SMP
Wed Feb 4 23:20:21 CET 2026 alpha EV67 Tsunami GNU/Linux
Magnus
> --
> Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-05 6:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 6:33 [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf Magnus Lindholm
2026-02-05 2:17 ` Kees Cook
2026-02-05 6:16 ` Magnus Lindholm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox