selftests/seccomp: add Alpha support to seccomp_bpf
Subsystems (3)
Magnus Lindholm
maintainerPATCH 1/1 selftests/seccomp: add Alpha support to seccomp_bpf
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.
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+)
tools/testing/selftests/seccomp/seccomp_bpf.c +29 -0
@@ -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 };
Signature · 1 line
2.52.0
Kees Cook
maintainerQuoted 7 lines · Magnus Lindholm
Enable
seccomp_bpfselftests 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 <[email protected]>
Great! Thanks for doing this. How did you test it?
-Kees
Signature · 1 line
Kees Cook
Magnus Lindholm
maintainerQuoted 3 lines
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
Quoted 2 lines
--
Kees Cook
Magnus Lindholm
maintainerHi,
Alpha support for SECCOMP and SECCOMP_FILTER was just merged into Linus' tree.
Regards
Magnus
Kees Cook
maintainerQuoted 5 lines · Magnus Lindholm
Hi,
Alpha support for SECCOMP and
SECCOMP_FILTERwas just merged into Linus' tree.
It looks like the selftest changes still need to be landed?
-Kees
Signature · 1 line
Kees Cook
Magnus Lindholm
maintainerHi
Quoted 2 lines
It looks like the selftest changes still need to be landed?
Yeah, I took the SECCOMP support patch through my tree during this merge window, I was thinking that the patch for selftest would go through your tree?
Regards
Magnus
Magnus Lindholm
maintainerHi Kees,
Will you take this through your tree? or do I take it through my alpha tree?
Regards Magnus
Quoted 14 lines · Kees Cook
Quoted 5 lines · Magnus Lindholm
Hi,
Alpha support for SECCOMP and
SECCOMP_FILTERwas just merged into Linus' tree.It looks like the selftest changes still need to be landed?
-Kees
--
Kees Cook