[PATCH] tests: only use bogus syscall numbers in test 29
authorPaul Moore <paul@paul-moore.com>
Thu, 5 Sep 2024 21:29:13 +0000 (17:29 -0400)
committerFelix Geyer <fgeyer@debian.org>
Sun, 24 Nov 2024 20:54:16 +0000 (21:54 +0100)
The goal of test 29 is to test bogus negative syscall numbers,
unfortunately it appears our choice of syscalls was not bogus on all
the architectures we support.  This commit fixes that by picking a
syscall number well outside the pseudo-syscall/PNR range and removing
the sysmips(2) syscall from the test so as to not cause problems
at a later date.

Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Gbp-Pq: Name tests_only_use_bogus_syscall_numbers_in_test_29.patch

tests/29-sim-pseudo_syscall.c
tests/29-sim-pseudo_syscall.py
tests/29-sim-pseudo_syscall.tests

index 86734a8478324e196bc483100a7462310f03b6d7..3c3405a80d3e341765cb1685987fc827f546717f 100644 (file)
@@ -49,15 +49,8 @@ int main(int argc, char *argv[])
        if (rc < 0)
                goto out;
 
-       /* SCMP_SYS(sysmips) == 4294957190 (unsigned) */
-       rc = seccomp_rule_add(ctx, SCMP_ACT_KILL, SCMP_SYS(sysmips), 0);
-       if (rc < 0)
-               goto out;
-       rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, SCMP_SYS(sysmips), 0);
-       if (rc == 0)
-               goto out;
-       /* -10001 == 4294957295 (unsigned) */
-       rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, -10001, 0);
+       /* -100001 == 4294867295 (unsigned) */
+       rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, -100001, 0);
        if (rc == 0)
                goto out;
 
index d7ab33be2764a82ce78ab9831b4454a39e06b12b..74ffc61d3aa6bed7984a9b239b3038e177926608 100755 (executable)
@@ -32,13 +32,8 @@ def test(args):
     f = SyscallFilter(ALLOW)
     f.remove_arch(Arch())
     f.add_arch(Arch("x86"))
-    f.add_rule(KILL, "sysmips")
     try:
-        f.add_rule_exactly(KILL, "sysmips")
-    except RuntimeError:
-        pass
-    try:
-        f.add_rule_exactly(KILL, -10001)
+        f.add_rule_exactly(KILL, -100001)
     except RuntimeError:
         pass
     return f
index 45f8dceb276416476dfa71bada166e5990bdfc4a..779761e80dc4451fc231e1d83f5c12e81cf2e9a2 100644 (file)
@@ -9,8 +9,7 @@ test type: bpf-sim
 
 # Testname             Arch    Syscall         Arg0    Arg1    Arg2    Arg3    Arg4    Arg5    Result
 29-sim-pseudo_syscall  +x86    0-10            N       N       N       N       N       N       ALLOW
-29-sim-pseudo_syscall  +x86    4294957190      N       N       N       N       N       N       ALLOW
-29-sim-pseudo_syscall  +x86    4294957295      N       N       N       N       N       N       ALLOW
+29-sim-pseudo_syscall  +x86    4294867295      N       N       N       N       N       N       ALLOW
 
 test type: bpf-valgrind