public inbox for linux-alpha@vger.kernel.org
 help / color / mirror / Atom feed
From: Magnus Lindholm <linmag7@gmail.com>
To: kees@kernel.org, luto@amacapital.net, wad@chromium.org,
	shuah@kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org,
	glaubitz@physik.fu-berlin.de
Cc: Magnus Lindholm <linmag7@gmail.com>
Subject: [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf
Date: Tue,  3 Feb 2026 07:33:26 +0100	[thread overview]
Message-ID: <20260203063357.14320-1-linmag7@gmail.com> (raw)

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


             reply	other threads:[~2026-02-03  6:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03  6:33 Magnus Lindholm [this message]
2026-02-05  2:17 ` [PATCH] selftests/seccomp: add Alpha support to seccomp_bpf Kees Cook
2026-02-05  6:16   ` Magnus Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260203063357.14320-1-linmag7@gmail.com \
    --to=linmag7@gmail.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=kees@kernel.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox