Skip to content

Conversation

@glaubitz
Copy link
Contributor

This PR adds support for both 32-bit and 64-bit SPARC.

SPARC is one of the two remaining architectures, the other one being Alpha,
that is currently not supported by libseccomp. As the kernel already supports
SECCOMP on SPARC, we just have to add support to libseccomp.

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
@coveralls
Copy link

coveralls commented Aug 24, 2025

Coverage Status

coverage: 88.97% (-0.08%) from 89.046%
when pulling 51a837a on glaubitz:sparc-support
into 9b9ea8e on seccomp:main.

@drakenclimber
Copy link
Member

The sparc patch looks reasonable at a quick glance. I'll try to dig up a sparc machine so that I can test it out :)

@glaubitz
Copy link
Contributor Author

glaubitz commented Aug 29, 2025 via email

@drakenclimber
Copy link
Member

There is gcc202 in the GCC Compile Farm which is currently offline but should be back online next week after hardware maintenance.

I found a Sparc box here within Oracle (not a surprise), but I need to put a newer Linux on it. I expect that to happen next week.

If my box doesn't work out, I'll try out the gcc box.

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 4, 2025

There is gcc202 in the GCC Compile Farm which is currently offline but should be back online next week after hardware maintenance.

I found a Sparc box here within Oracle (not a surprise), but I need to put a newer Linux on it. I expect that to happen next week.

Ah, nice. Great that this is still possible ;-).

If my box doesn't work out, I'll try out the gcc box.

The GCC porterbox is expected to return to service tomorrow (crossing fingers).

@drakenclimber
Copy link
Member

I have my sparc64 box up and running.

$ lscpu
Architecture:          sparc64
  CPU op-mode(s):      32-bit, 64-bit
  Byte Order:          Big Endian
CPU(s):                256
  On-line CPU(s) list: 0-255
Model name:            SPARC-M7
  Thread(s) per core:  8
  Core(s) per socket:  32
  Socket(s):           1
  Flags:               sun4v
Caches (sum of all):
  L1d:                 4 MiB (256 instances)
  L1i:                 4 MiB (256 instances)
  L2:                  64 MiB (256 instances)

I'm getting test failures on test 36 and 37 with this patchset. I'll try and look into it later this week.

$ ./regression -b 36-sim-ipc_syscalls
=============== Mon Sep  8 10:28:33 AM EDT 2025 ===============
Regression Test Report ("regression -b 36-sim-ipc_syscalls")
 batch name: 36-sim-ipc_syscalls
 test mode:  c
 test type:  bpf-sim
 test arch:  x86
Test 36-sim-ipc_syscalls%%001-00001 result:   ERROR 36-sim-ipc_syscalls rc=33
...
$ ./regression -b 37-sim-ipc_syscalls_be
=============== Mon Sep  8 10:29:40 AM EDT 2025 ===============
Regression Test Report ("regression -b 37-sim-ipc_syscalls_be")
 batch name: 37-sim-ipc_syscalls_be
 test mode:  c
 test type:  bpf-sim
 test arch:  s390
Test 37-sim-ipc_syscalls_be%%001-00001 result:   ERROR 37-sim-ipc_syscalls_be rc=14
...

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 8, 2025

Thanks a lot! We're having delays with our SPARC T5, so I'm glad you got a machine yourself.

FWIW, I think the Linux kernel on SPARC might need some additional fixes for seccomp. I'm looking into that as well.

@drakenclimber
Copy link
Member

I found the bug that was causing tests 36 and 37 to fail. Definitely not what I expected :).

Here's the fix for those test failures:

diff --git a/src/syscalls.h b/src/syscalls.h
index b2720fc..ccdff1b 100644
--- a/src/syscalls.h
+++ b/src/syscalls.h
@@ -43,6 +43,9 @@ struct arch_syscall_table {
        /* each arch listed here must be defined in syscalls.c  */
        /* NOTE: see the warning above - BEWARE! */

+       /* NOTE: the order of the members of this structure must exactly
+        *       match the order of the columns in syscalls.csv! */
+
        int x86;
        enum scmp_kver x86_kver;
        int x86_64;
@@ -86,13 +89,13 @@ struct arch_syscall_table {
        int s390x;
        enum scmp_kver s390x_kver;

+       int sh;
+       enum scmp_kver sh_kver;
+
        int sparc;
        enum scmp_kver sparc_kver;
        int sparc64;
        enum scmp_kver sparc64_kver;
-
-       int sh;
-       enum scmp_kver sh_kver;
 };

@drakenclimber
Copy link
Member

For completeness, I'd recommend adding sparc and sparc64 to test 37:

diff --git a/tests/37-sim-ipc_syscalls_be.c b/tests/37-sim-ipc_syscalls_be.c
index d1bd57e..118c4a8 100644
--- a/tests/37-sim-ipc_syscalls_be.c
+++ b/tests/37-sim-ipc_syscalls_be.c
@@ -51,6 +51,12 @@ int main(int argc, char *argv[])
        if (rc != 0)
                goto out;
        rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC);
+       if (rc != 0)
+               goto out;
+       rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC);
+       if (rc != 0)
+               goto out;
+       rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC64);
        if (rc != 0)
                goto out;

diff --git a/tests/37-sim-ipc_syscalls_be.tests b/tests/37-sim-ipc_syscalls_be.tests
index 96a5c81..b9224e4 100644
--- a/tests/37-sim-ipc_syscalls_be.tests
+++ b/tests/37-sim-ipc_syscalls_be.tests
@@ -7,19 +7,19 @@

 test type: bpf-sim

-# Testname             Arch                    Syscall         Arg0    Arg1    Arg2    Arg3    Arg4
Arg5    Result
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             1       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             2       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             3       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             4       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             11      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             12      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             13      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             14      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             21      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             22      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             23      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             24      N       N       N       N
N       ALLOW
+# Testname             Arch                                    Syscall         Arg0    Arg1    Arg2
Arg3    Arg4    Arg5    Result
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             1       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             2       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             3       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             4       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             11      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             12      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             13      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             14      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             21      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             22      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             23      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             24      N       N
N       N       N       ALLOW

 test type: bpf-valgrind

@drakenclimber
Copy link
Member

FWIW, I think the Linux kernel on SPARC might need some additional fixes for seccomp. I'm looking into that as well.

I agree. Test 52 is a test that loads a really simple seccomp filter in the kernel. It's failing in the seccomp() syscall.

$ ./regression -b 52-basic-load
=============== Tue Sep  9 06:06:17 AM EDT 2025 ===============
Regression Test Report ("regression -b 52-basic-load")
 batch name: 52-basic-load
 test mode:  c
 test type:  basic
Test 52-basic-load%%001-00001 result:   FAILURE 52-basic-load rc=127
Regression Test Summary
 tests run: 1
 tests skipped: 0
 tests passed: 0
 tests failed: 1
 tests errored: 0
============================================================

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 9, 2025

I found the bug that was causing tests 36 and 37 to fail. Definitely not what I expected :).

Here's the fix for those test failures:

diff --git a/src/syscalls.h b/src/syscalls.h
index b2720fc..ccdff1b 100644
--- a/src/syscalls.h
+++ b/src/syscalls.h
@@ -43,6 +43,9 @@ struct arch_syscall_table {
        /* each arch listed here must be defined in syscalls.c  */
        /* NOTE: see the warning above - BEWARE! */

+       /* NOTE: the order of the members of this structure must exactly
+        *       match the order of the columns in syscalls.csv! */
+
        int x86;
        enum scmp_kver x86_kver;
        int x86_64;
@@ -86,13 +89,13 @@ struct arch_syscall_table {
        int s390x;
        enum scmp_kver s390x_kver;

+       int sh;
+       enum scmp_kver sh_kver;
+
        int sparc;
        enum scmp_kver sparc_kver;
        int sparc64;
        enum scmp_kver sparc64_kver;
-
-       int sh;
-       enum scmp_kver sh_kver;
 };

Oh, wow. I would have never guessed that. I will fix that. Thanks so much for the thorough review!

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 9, 2025

For completeness, I'd recommend adding sparc and sparc64 to test 37:

diff --git a/tests/37-sim-ipc_syscalls_be.c b/tests/37-sim-ipc_syscalls_be.c
index d1bd57e..118c4a8 100644
--- a/tests/37-sim-ipc_syscalls_be.c
+++ b/tests/37-sim-ipc_syscalls_be.c
@@ -51,6 +51,12 @@ int main(int argc, char *argv[])
        if (rc != 0)
                goto out;
        rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC);
+       if (rc != 0)
+               goto out;
+       rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC);
+       if (rc != 0)
+               goto out;
+       rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC64);
        if (rc != 0)
                goto out;

diff --git a/tests/37-sim-ipc_syscalls_be.tests b/tests/37-sim-ipc_syscalls_be.tests
index 96a5c81..b9224e4 100644
--- a/tests/37-sim-ipc_syscalls_be.tests
+++ b/tests/37-sim-ipc_syscalls_be.tests
@@ -7,19 +7,19 @@

 test type: bpf-sim

-# Testname             Arch                    Syscall         Arg0    Arg1    Arg2    Arg3    Arg4
Arg5    Result
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             1       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             2       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             3       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             4       N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             11      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             12      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             13      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             14      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             21      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             22      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             23      N       N       N       N
N       ALLOW
-37-sim-ipc_syscalls_be +s390,+s390x,+ppc       ipc             24      N       N       N       N
N       ALLOW
+# Testname             Arch                                    Syscall         Arg0    Arg1    Arg2
Arg3    Arg4    Arg5    Result
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             1       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             2       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             3       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             4       N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             11      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             12      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             13      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             14      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             21      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             22      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             23      N       N
N       N       N       ALLOW
+37-sim-ipc_syscalls_be +s390,+s390x,+ppc,+sparc,+sparc64       ipc             24      N       N
N       N       N       ALLOW

 test type: bpf-valgrind

Do I just have to modify tests/37-sim-ipc_syscalls_be.c or also tests/37-sim-ipc_syscalls_be.tests?

@drakenclimber
Copy link
Member

Do I just have to modify tests/37-sim-ipc_syscalls_be.c or also tests/37-sim-ipc_syscalls_be.tests?

We'll need to modify tests/37-sim-ipc_syscalls_be.c, tests/37-sim-ipc_syscalls_be.py (which I forgot to add), and tests/37-sim-ipc_syscalls_be.tests. Here's the entire diff:

diff --git a/tests/37-sim-ipc_syscalls_be.c b/tests/37-sim-ipc_syscalls_be.c
index d1bd57e..118c4a8 100644
--- a/tests/37-sim-ipc_syscalls_be.c
+++ b/tests/37-sim-ipc_syscalls_be.c
@@ -51,6 +51,12 @@ int main(int argc, char *argv[])
 	if (rc != 0)
 		goto out;
 	rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC);
+	if (rc != 0)
+		goto out;
+	rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC);
+	if (rc != 0)
+		goto out;
+	rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC64);
 	if (rc != 0)
 		goto out;
 
diff --git a/tests/37-sim-ipc_syscalls_be.py b/tests/37-sim-ipc_syscalls_be.py
index 18a09d0..34b0201 100755
--- a/tests/37-sim-ipc_syscalls_be.py
+++ b/tests/37-sim-ipc_syscalls_be.py
@@ -34,6 +34,8 @@ def test(args):
     f.add_arch(Arch("s390"))
     f.add_arch(Arch("s390x"))
     f.add_arch(Arch("ppc"))
+    f.add_arch(Arch("sparc"))
+    f.add_arch(Arch("sparc64"))
     f.add_rule(ALLOW, "semop")
     f.add_rule(ALLOW, "semtimedop")
     f.add_rule(ALLOW, "semget")
diff --git a/tests/37-sim-ipc_syscalls_be.tests b/tests/37-sim-ipc_syscalls_be.tests
index 96a5c81..b9224e4 100644
--- a/tests/37-sim-ipc_syscalls_be.tests
+++ b/tests/37-sim-ipc_syscalls_be.tests
@@ -7,19 +7,19 @@
 
 test type: bpf-sim
 
-# Testname		Arch			Syscall		Arg0	Arg1	Arg2	Arg3	Arg4	Arg5	Result
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		1	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		2	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		3	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		4	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		11	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		12	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		13	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		14	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		21	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		22	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		23	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		24	N	N	N	N	N	ALLOW
+# Testname		Arch					Syscall		Arg0	Arg1	Arg2	Arg3	Arg4	Arg5	Result
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		1	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		2	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		3	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		4	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		11	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		12	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		13	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		14	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		21	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		22	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		23	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		24	N	N	N	N	N	ALLOW
 
 test type: bpf-valgrind

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 9, 2025

Do I just have to modify tests/37-sim-ipc_syscalls_be.c or also tests/37-sim-ipc_syscalls_be.tests?

We'll need to modify tests/37-sim-ipc_syscalls_be.c, tests/37-sim-ipc_syscalls_be.py (which I forgot to add), and tests/37-sim-ipc_syscalls_be.tests. Here's the entire diff:

diff --git a/tests/37-sim-ipc_syscalls_be.c b/tests/37-sim-ipc_syscalls_be.c
index d1bd57e..118c4a8 100644
--- a/tests/37-sim-ipc_syscalls_be.c
+++ b/tests/37-sim-ipc_syscalls_be.c
@@ -51,6 +51,12 @@ int main(int argc, char *argv[])
 	if (rc != 0)
 		goto out;
 	rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC);
+	if (rc != 0)
+		goto out;
+	rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC);
+	if (rc != 0)
+		goto out;
+	rc = seccomp_arch_add(ctx, SCMP_ARCH_SPARC64);
 	if (rc != 0)
 		goto out;
 
diff --git a/tests/37-sim-ipc_syscalls_be.py b/tests/37-sim-ipc_syscalls_be.py
index 18a09d0..34b0201 100755
--- a/tests/37-sim-ipc_syscalls_be.py
+++ b/tests/37-sim-ipc_syscalls_be.py
@@ -34,6 +34,8 @@ def test(args):
     f.add_arch(Arch("s390"))
     f.add_arch(Arch("s390x"))
     f.add_arch(Arch("ppc"))
+    f.add_arch(Arch("sparc"))
+    f.add_arch(Arch("sparc64"))
     f.add_rule(ALLOW, "semop")
     f.add_rule(ALLOW, "semtimedop")
     f.add_rule(ALLOW, "semget")
diff --git a/tests/37-sim-ipc_syscalls_be.tests b/tests/37-sim-ipc_syscalls_be.tests
index 96a5c81..b9224e4 100644
--- a/tests/37-sim-ipc_syscalls_be.tests
+++ b/tests/37-sim-ipc_syscalls_be.tests
@@ -7,19 +7,19 @@
 
 test type: bpf-sim
 
-# Testname		Arch			Syscall		Arg0	Arg1	Arg2	Arg3	Arg4	Arg5	Result
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		1	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		2	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		3	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		4	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		11	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		12	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		13	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		14	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		21	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		22	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		23	N	N	N	N	N	ALLOW
-37-sim-ipc_syscalls_be	+s390,+s390x,+ppc	ipc		24	N	N	N	N	N	ALLOW
+# Testname		Arch					Syscall		Arg0	Arg1	Arg2	Arg3	Arg4	Arg5	Result
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		1	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		2	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		3	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		4	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		11	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		12	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		13	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		14	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		21	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		22	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		23	N	N	N	N	N	ALLOW
+37-sim-ipc_syscalls_be	+s390,+s390x,+ppc,+sparc,+sparc64	ipc		24	N	N	N	N	N	ALLOW
 
 test type: bpf-valgrind

Thank you so much!

@glaubitz
Copy link
Contributor Author

glaubitz commented Sep 9, 2025

Requested changes have been implemented. Please retry.

Copy link
Member

@drakenclimber drakenclimber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I wasn't able to successfully run the python tests. Either I screwed something up, or there are problems with the Python/Debian/Pip repos. I'm guessing the former :)

I'm still seeing a failure with test 52 (which loads the filter into the kernel). Seems like an issue with the sparc/seccomp kernel itself. I'll gladly help test/review kernel changes to get this working.

All in all, this looks good to me. I had a few small nitpicks, but they're easily fixed.

I think I'd prefer to wait to merge it until we get it fully working, but I'll defer to others here. Once we get it running, I'll add my Reviewed-by.

Thanks for the hard work, @glaubitz. It's always cool to see another architecture added :)

#define __SNR_open_tree __PNR_open_tree
#endif

#define __SNR_open_tree_attr __PNR_open_tree_attr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should this be:

#ifdef __NR_open_tree_attr
#define __SNR_open_tree_attr			__NR_open_tree_attr
#else
#define __SNR_open_tree_attr			__PNR_open_tree_attr
#endif


#define __SNR_perf_event_open __NR_perf_event_open

#define __SNR_perfctr __PNR_perfctr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should this be:

#ifdef __NR_perfctr
#define __SNR_perfctr			__NR_perfctr
#else
#define __SNR_perfctr			__PNR_perfctr
#endif

#define __SNR_utimes __PNR_utimes
#endif

#define __SNR_utrap_install __PNR_utrap_install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should this be:

#ifdef __NR_utrap_install
#define __SNR_utrap_install			__NR_utrap_install
#else
#define __SNR_utrap_install			__PNR_utrap_install
#endif

#
function dump_sys_sparc() {
dump_from_syscall_tbl "$1/arch/sparc/kernel/syscalls/syscall.tbl" \
nospu 32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe that sparc uses nospu, correct? Thus, nospu should be removed.

#
function dump_sys_sparc64() {
dump_from_syscall_tbl "$1/arch/sparc/kernel/syscalls/syscall.tbl" \
nospu 64
Copy link
Member

@drakenclimber drakenclimber Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe that sparc64 uses nospu, correct? Thus, nospu should be removed.

@glaubitz
Copy link
Contributor Author

Unfortunately I wasn't able to successfully run the python tests. Either I screwed something up, or there are problems with the Python/Debian/Pip repos. I'm guessing the former :)

I'm going to retest on Debian unstable sparc64 later this week.

I'm still seeing a failure with test 52 (which loads the filter into the kernel). Seems like an issue with the sparc/seccomp kernel itself. I'll gladly help test/review kernel changes to get this working.

We're currently working on fixing many issues in the Linux kernel running on SPARC. Oracle engineers actually made a lot of contributions here, but they stopped upstreaming these changes when they abandoned the project.

The patches are part of the UEK 4/Update 7 kernel.

All in all, this looks good to me. I had a few small nitpicks, but they're easily fixed.

I think I'd prefer to wait to merge it until we get it fully working, but I'll defer to others here. Once we get it running, I'll add my Reviewed-by.

Sure, no problem.

Thanks for the hard work, @glaubitz. It's always cool to see another architecture added :)

Once SPARC support has been merged, Alpha will be the last unsupported platform and I'm sure we'll get that eventually added as well. ;-)

@pcmoore
Copy link
Member

pcmoore commented Oct 7, 2025

I found the bug that was causing tests 36 and 37 to fail. Definitely not what I expected :).
Here's the fix for those test failures:

diff --git a/src/syscalls.h b/src/syscalls.h
index b2720fc..ccdff1b 100644
--- a/src/syscalls.h
+++ b/src/syscalls.h
@@ -43,6 +43,9 @@ struct arch_syscall_table {
        /* each arch listed here must be defined in syscalls.c  */
        /* NOTE: see the warning above - BEWARE! */

+       /* NOTE: the order of the members of this structure must exactly
+        *       match the order of the columns in syscalls.csv! */
+
        int x86;
        enum scmp_kver x86_kver;
        int x86_64;
@@ -86,13 +89,13 @@ struct arch_syscall_table {
        int s390x;
        enum scmp_kver s390x_kver;

+       int sh;
+       enum scmp_kver sh_kver;
+
        int sparc;
        enum scmp_kver sparc_kver;
        int sparc64;
        enum scmp_kver sparc64_kver;
-
-       int sh;
-       enum scmp_kver sh_kver;
 };

Oh, wow. I would have never guessed that. I will fix that. Thanks so much for the thorough review!

Yeah ... oops! Does anyone want to submit a separate PR to fix that?

@glaubitz
Copy link
Contributor Author

glaubitz commented Oct 7, 2025

Oh, wow. I would have never guessed that. I will fix that. Thanks so much for the thorough review!

Yeah ... oops! Does anyone want to submit a separate PR to fix that?

What issue exactly do you mean?

And I just realized you requested some additional changes. I will look into these in the weekend.

FWIW, there is a Debian unstable machine running on a SPARC T5 LDOM in the GCC Compile Farm now available for testing (cfarm202.cfarm.net).

I will ask for help to implement SECCOMP_FILTER on SPARC, I have filed an issue for it already.

@pcmoore
Copy link
Member

pcmoore commented Oct 7, 2025

What issue exactly do you mean?

My apologies, I thought the sh arch/ABI was located incorrectly in the arch_syscall_table struct in the current codebase, but I realize it was just an issue with the code in the PR. Sorry for the noise :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants