Skip to content

Commit 87876aa

Browse files
pcmooredrakenclimber
authored andcommitted
tests: only use bogus syscall numbers in test 29
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 <[email protected]> Signed-off-by: Tom Hromatka <[email protected]>
1 parent 2847f10 commit 87876aa

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

tests/29-sim-pseudo_syscall.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,8 @@ int main(int argc, char *argv[])
4949
if (rc < 0)
5050
goto out;
5151

52-
/* SCMP_SYS(sysmips) == 4294957190 (unsigned) */
53-
rc = seccomp_rule_add(ctx, SCMP_ACT_KILL, SCMP_SYS(sysmips), 0);
54-
if (rc < 0)
55-
goto out;
56-
rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, SCMP_SYS(sysmips), 0);
57-
if (rc == 0)
58-
goto out;
59-
/* -10001 == 4294957295 (unsigned) */
60-
rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, -10001, 0);
52+
/* -100001 == 4294867295 (unsigned) */
53+
rc = seccomp_rule_add_exact(ctx, SCMP_ACT_KILL, -100001, 0);
6154
if (rc == 0)
6255
goto out;
6356

tests/29-sim-pseudo_syscall.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ def test(args):
3232
f = SyscallFilter(ALLOW)
3333
f.remove_arch(Arch())
3434
f.add_arch(Arch("x86"))
35-
f.add_rule(KILL, "sysmips")
3635
try:
37-
f.add_rule_exactly(KILL, "sysmips")
38-
except RuntimeError:
39-
pass
40-
try:
41-
f.add_rule_exactly(KILL, -10001)
36+
f.add_rule_exactly(KILL, -100001)
4237
except RuntimeError:
4338
pass
4439
return f

tests/29-sim-pseudo_syscall.tests

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ test type: bpf-sim
99

1010
# Testname Arch Syscall Arg0 Arg1 Arg2 Arg3 Arg4 Arg5 Result
1111
29-sim-pseudo_syscall +x86 0-10 N N N N N N ALLOW
12-
29-sim-pseudo_syscall +x86 4294957190 N N N N N N ALLOW
13-
29-sim-pseudo_syscall +x86 4294957295 N N N N N N ALLOW
12+
29-sim-pseudo_syscall +x86 4294867295 N N N N N N ALLOW
1413

1514
test type: bpf-valgrind
1615

0 commit comments

Comments
 (0)