From 80c2c9fe4eac515b31292c522b51657800028018 Mon Sep 17 00:00:00 2001 From: Xiaotian Wu Date: Tue, 9 Feb 2021 15:52:18 +0800 Subject: tests: Add 64-bit LoongArch support [xen0n: LoongArch (and a few upcoming architectures / ABIs) does not have fstat, so the fstat in 06-sim-actions is also being changed to fstatfs for uniformity across the board.] Signed-off-by: Xiaotian Wu Signed-off-by: WANG Xuerui Acked-by: Tom Hromatka Signed-off-by: Paul Moore --- tests/06-sim-actions.py | 2 +- tests/06-sim-actions.tests | 7 +-- tests/15-basic-resolver.c | 1 + tests/16-sim-arch_basic.c | 6 +++ tests/16-sim-arch_basic.py | 1 + tests/23-sim-arch_all_le_basic.c | 3 ++ tests/23-sim-arch_all_le_basic.py | 1 + tests/36-sim-ipc_syscalls.c | 3 ++ tests/38-basic-pfc_coverage.c | 3 ++ tests/38-basic-pfc_coverage.pfc | 97 ++++++++++++++++++++++++++++++++++++++ tests/53-sim-binary_tree.c | 3 ++ tests/53-sim-binary_tree.py | 1 + tests/53-sim-binary_tree.tests | 78 +++++++++++++++--------------- tests/55-basic-pfc_binary_tree.c | 3 ++ tests/55-basic-pfc_binary_tree.pfc | 87 ++++++++++++++++++++++++++++++++++ tests/56-basic-iterate_syscalls.c | 1 + tests/56-basic-iterate_syscalls.py | 1 + tests/regression | 4 +- 18 files changed, 258 insertions(+), 44 deletions(-) diff --git a/tests/06-sim-actions.py b/tests/06-sim-actions.py index 253061d..cfbd4f4 100755 --- a/tests/06-sim-actions.py +++ b/tests/06-sim-actions.py @@ -38,7 +38,7 @@ def test(args): f.add_rule(ERRNO(errno.EPERM), "write") f.add_rule(TRAP, "close") f.add_rule(TRACE(1234), "openat") - f.add_rule(KILL_PROCESS, "fstat") + f.add_rule(KILL_PROCESS, "fstatfs") return f args = util.get_opt() diff --git a/tests/06-sim-actions.tests b/tests/06-sim-actions.tests index 0d1fda4..2092c38 100644 --- a/tests/06-sim-actions.tests +++ b/tests/06-sim-actions.tests @@ -15,12 +15,13 @@ test type: bpf-sim 06-sim-actions all fstatfs 4 0x856B008 N N N N KILL_PROCESS 06-sim-actions all rt_sigreturn N N N N N N LOG 06-sim-actions x86 0-2 N N N N N N KILL -06-sim-actions x86 7-107 N N N N N N KILL -06-sim-actions x86 109-172 N N N N N N KILL +06-sim-actions x86 7-99 N N N N N N KILL +06-sim-actions x86 101-172 N N N N N N KILL 06-sim-actions x86 174-294 N N N N N N KILL 06-sim-actions x86 296-350 N N N N N N KILL 06-sim-actions x86_64 6-14 N N N N N N KILL -06-sim-actions x86_64 16-256 N N N N N N KILL +06-sim-actions x86_64 16-137 N N N N N N KILL +06-sim-actions x86_64 139-256 N N N N N N KILL 06-sim-actions x86_64 258-350 N N N N N N KILL test type: bpf-sim-fuzz diff --git a/tests/15-basic-resolver.c b/tests/15-basic-resolver.c index c759dd1..bdb73f7 100644 --- a/tests/15-basic-resolver.c +++ b/tests/15-basic-resolver.c @@ -32,6 +32,7 @@ unsigned int arch_list[] = { SCMP_ARCH_X32, SCMP_ARCH_ARM, SCMP_ARCH_AARCH64, + SCMP_ARCH_LOONGARCH64, SCMP_ARCH_MIPS, SCMP_ARCH_MIPS64, SCMP_ARCH_MIPS64N32, diff --git a/tests/16-sim-arch_basic.c b/tests/16-sim-arch_basic.c index 4fcbb5c..be269c9 100644 --- a/tests/16-sim-arch_basic.c +++ b/tests/16-sim-arch_basic.c @@ -78,6 +78,9 @@ int main(int argc, char *argv[]) if (rc != 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_AARCH64); + if (rc != 0) + goto out; + rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64); if (rc != 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_MIPSEL); @@ -148,6 +151,9 @@ int main(int argc, char *argv[]) if (rc != 0) goto out; rc = seccomp_arch_remove(ctx, SCMP_ARCH_AARCH64); + if (rc != 0) + goto out; + rc = seccomp_arch_remove(ctx, SCMP_ARCH_LOONGARCH64); if (rc != 0) goto out; rc = seccomp_arch_remove(ctx, SCMP_ARCH_MIPSEL); diff --git a/tests/16-sim-arch_basic.py b/tests/16-sim-arch_basic.py index f22c985..79e6854 100755 --- a/tests/16-sim-arch_basic.py +++ b/tests/16-sim-arch_basic.py @@ -40,6 +40,7 @@ def test(args): f.add_arch(Arch("x32")) f.add_arch(Arch("arm")) f.add_arch(Arch("aarch64")) + f.add_arch(Arch("loongarch64")) f.add_arch(Arch("mipsel")) f.add_arch(Arch("mipsel64")) f.add_arch(Arch("mipsel64n32")) diff --git a/tests/23-sim-arch_all_le_basic.c b/tests/23-sim-arch_all_le_basic.c index 08f030c..ef6d2c3 100644 --- a/tests/23-sim-arch_all_le_basic.c +++ b/tests/23-sim-arch_all_le_basic.c @@ -57,6 +57,9 @@ int main(int argc, char *argv[]) if (rc != 0) goto out; rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("aarch64")); + if (rc != 0) + goto out; + rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("loongarch64")); if (rc != 0) goto out; rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("mipsel")); diff --git a/tests/23-sim-arch_all_le_basic.py b/tests/23-sim-arch_all_le_basic.py index 12bb243..783dc25 100755 --- a/tests/23-sim-arch_all_le_basic.py +++ b/tests/23-sim-arch_all_le_basic.py @@ -36,6 +36,7 @@ def test(args): f.add_arch(Arch("x32")) f.add_arch(Arch("arm")) f.add_arch(Arch("aarch64")) + f.add_arch(Arch("loongarch64")) f.add_arch(Arch("mipsel")) f.add_arch(Arch("mipsel64")) f.add_arch(Arch("mipsel64n32")) diff --git a/tests/36-sim-ipc_syscalls.c b/tests/36-sim-ipc_syscalls.c index 06aaf6a..da087e9 100644 --- a/tests/36-sim-ipc_syscalls.c +++ b/tests/36-sim-ipc_syscalls.c @@ -60,6 +60,9 @@ int main(int argc, char *argv[]) if (rc != 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_SH); + if (rc != 0) + goto out; + rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64); if (rc != 0) goto out; diff --git a/tests/38-basic-pfc_coverage.c b/tests/38-basic-pfc_coverage.c index 64a656e..c094cd4 100644 --- a/tests/38-basic-pfc_coverage.c +++ b/tests/38-basic-pfc_coverage.c @@ -64,6 +64,9 @@ int main(int argc, char *argv[]) if (rc < 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_AARCH64); + if (rc < 0) + goto out; + rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64); if (rc < 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_MIPSEL); diff --git a/tests/38-basic-pfc_coverage.pfc b/tests/38-basic-pfc_coverage.pfc index c91f1a8..815470e 100644 --- a/tests/38-basic-pfc_coverage.pfc +++ b/tests/38-basic-pfc_coverage.pfc @@ -300,6 +300,103 @@ if ($arch == 3221225655) action KILL; # default action action ALLOW; +# filter for arch loongarch64 (3221225730) +if ($arch == 3221225730) + # filter for syscall "open" (4294957130) [priority: 65535] + if ($syscall == 4294957130) + action KILL; + # filter for syscall "fstat" (4294957051) [priority: 65535] + if ($syscall == 4294957051) + action KILL_PROCESS; + # filter for syscall "exit_group" (94) [priority: 65535] + if ($syscall == 94) + action LOG; + # filter for syscall "exit" (93) [priority: 65535] + if ($syscall == 93) + action TRACE(1); + # filter for syscall "close" (57) [priority: 65535] + if ($syscall == 57) + action ERRNO(1); + # filter for syscall "write" (64) [priority: 65527] + if ($syscall == 64) + if ($a0.hi32 == 0) + if ($a0.lo32 == 0) + else + if ($a1.hi32 > 0) + else + if ($a1.hi32 == 0) + if ($a1.lo32 > 1) + else + if ($a2.hi32 > 0) + else + if ($a2.hi32 == 0) + if ($a2.lo32 >= 2) + else + action TRAP; + else + action TRAP; + else + if ($a2.hi32 > 0) + else + if ($a2.hi32 == 0) + if ($a2.lo32 >= 2) + else + action TRAP; + else + action TRAP; + else + if ($a1.hi32 > 0) + else + if ($a1.hi32 == 0) + if ($a1.lo32 > 1) + else + if ($a2.hi32 > 0) + else + if ($a2.hi32 == 0) + if ($a2.lo32 >= 2) + else + action TRAP; + else + action TRAP; + else + if ($a2.hi32 > 0) + else + if ($a2.hi32 == 0) + if ($a2.lo32 >= 2) + else + action TRAP; + else + action TRAP; + # filter for syscall "read" (63) [priority: 65525] + if ($syscall == 63) + if ($a0.hi32 == 0) + if ($a0.lo32 == 0) + if ($a1.hi32 > 0) + if ($a2.hi32 > 0) + if ($a3.hi32 & 0x00000000 == 0) + if ($a3.lo32 & 0x0000000f == 3) + action KILL; + else + if ($a2.hi32 == 0) + if ($a2.lo32 > 2) + if ($a3.hi32 & 0x00000000 == 0) + if ($a3.lo32 & 0x0000000f == 3) + action KILL; + else + if ($a1.hi32 == 0) + if ($a1.lo32 >= 1) + if ($a2.hi32 > 0) + if ($a3.hi32 & 0x00000000 == 0) + if ($a3.lo32 & 0x0000000f == 3) + action KILL; + else + if ($a2.hi32 == 0) + if ($a2.lo32 > 2) + if ($a3.hi32 & 0x00000000 == 0) + if ($a3.lo32 & 0x0000000f == 3) + action KILL; + # default action + action ALLOW; # filter for arch mipsel (1073741832) if ($arch == 1073741832) # filter for syscall "exit_group" (4246) [priority: 65535] diff --git a/tests/53-sim-binary_tree.c b/tests/53-sim-binary_tree.c index 4aa5f13..98b9e2c 100644 --- a/tests/53-sim-binary_tree.c +++ b/tests/53-sim-binary_tree.c @@ -103,6 +103,9 @@ int main(int argc, char *argv[]) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_AARCH64); + if (rc != 0) + goto out; + rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64); if (rc != 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC64LE); diff --git a/tests/53-sim-binary_tree.py b/tests/53-sim-binary_tree.py index 8ee58cd..8cda810 100755 --- a/tests/53-sim-binary_tree.py +++ b/tests/53-sim-binary_tree.py @@ -72,6 +72,7 @@ def test(args): f.remove_arch(Arch()) f.add_arch(Arch("aarch64")) + f.add_arch(Arch("loongarch64")) f.add_arch(Arch("ppc64le")) f.add_arch(Arch("x86_64")) diff --git a/tests/53-sim-binary_tree.tests b/tests/53-sim-binary_tree.tests index 2ebaafd..9813d0d 100644 --- a/tests/53-sim-binary_tree.tests +++ b/tests/53-sim-binary_tree.tests @@ -8,56 +8,56 @@ test type: bpf-sim # Testname Arch Syscall Arg0 Arg1 Arg2 Arg3 Arg4 Arg5 Result -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 read N N N N N N ERRNO(0) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 write N N N N N N ERRNO(1) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 read N N N N N N ERRNO(0) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 write N N N N N N ERRNO(1) 53-sim-binary_tree +x86_64,+ppc64le open N N N N N N ERRNO(2) -53-sim-binary_tree +aarch64 open N N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 close N N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 close 100 1234 N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 close 100 101 N N N N ERRNO(3) +53-sim-binary_tree +aarch64,+loongarch64 open N N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 close N N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 close 100 1234 N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 close 100 101 N N N N ERRNO(3) 53-sim-binary_tree +x86_64,+ppc64le stat N N N N N N ERRNO(4) -53-sim-binary_tree +aarch64 stat N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 stat N N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le,+aarch64 fstat N N N N N N ERRNO(5) 53-sim-binary_tree +x86_64,+ppc64le lstat N N N N N N ERRNO(6) -53-sim-binary_tree +aarch64 lstat N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 lstat N N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le poll 102 N N N N N ERRNO(7) -53-sim-binary_tree +aarch64 poll 102 N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 lseek 103 104 N N N N ERRNO(8) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 mmap N N N N N N ERRNO(9) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 mprotect N N N N N N ERRNO(10) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 munmap N N N N N N ERRNO(11) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 brk N N N N N N ERRNO(12) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 rt_sigaction N N N N N N ERRNO(13) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 rt_sigprocmask N N N N N N ERRNO(14) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 rt_sigreturn N N N N N N ERRNO(15) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 ioctl N N N N N N ERRNO(16) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 pread64 105 N N N N N ERRNO(17) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 pwrite64 N N N N N N ERRNO(18) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 readv N N N N N N ERRNO(19) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 writev N N N N N N ERRNO(20) +53-sim-binary_tree +aarch64,+loongarch64 poll 102 N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 lseek 103 104 N N N N ERRNO(8) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 mmap N N N N N N ERRNO(9) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 mprotect N N N N N N ERRNO(10) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 munmap N N N N N N ERRNO(11) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 brk N N N N N N ERRNO(12) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 rt_sigaction N N N N N N ERRNO(13) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 rt_sigprocmask N N N N N N ERRNO(14) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 rt_sigreturn N N N N N N ERRNO(15) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 ioctl N N N N N N ERRNO(16) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 pread64 105 N N N N N ERRNO(17) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 pwrite64 N N N N N N ERRNO(18) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 readv N N N N N N ERRNO(19) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 writev N N N N N N ERRNO(20) 53-sim-binary_tree +x86_64,+ppc64le access N N N N N N ERRNO(21) -53-sim-binary_tree +aarch64 access N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 access N N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le pipe N N N N N N ERRNO(22) -53-sim-binary_tree +aarch64 pipe N N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 select N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 pipe N N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 select N N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le select 106 107 N N N N ERRNO(23) -53-sim-binary_tree +aarch64 select 106 107 N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 sched_yield N N N N N N ERRNO(24) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 mremap N N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 mremap 108 109 N N N N ERRNO(25) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 msync N N N N N N ERRNO(26) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 mincore N N N N N N ERRNO(27) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 madvise N N N N N N ERRNO(28) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 dup 112 N N N N N ERRNO(32) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 dup 5678 N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 select 106 107 N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 sched_yield N N N N N N ERRNO(24) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 mremap N N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 mremap 108 109 N N N N ERRNO(25) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 msync N N N N N N ERRNO(26) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 mincore N N N N N N ERRNO(27) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 madvise N N N N N N ERRNO(28) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 dup 112 N N N N N ERRNO(32) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 dup 5678 N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le dup2 N N N N N N ERRNO(33) -53-sim-binary_tree +aarch64 dup2 N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 dup2 N N N N N N ALLOW 53-sim-binary_tree +x86_64,+ppc64le pause N N N N N N ERRNO(34) -53-sim-binary_tree +aarch64 pause N N N N N N ALLOW -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 nanosleep N N N N N N ERRNO(35) -53-sim-binary_tree +x86_64,+ppc64le,+aarch64 getitimer N N N N N N ERRNO(36) +53-sim-binary_tree +aarch64,+loongarch64 pause N N N N N N ALLOW +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 nanosleep N N N N N N ERRNO(35) +53-sim-binary_tree +x86_64,+ppc64le,+aarch64,+loongarch64 getitimer N N N N N N ERRNO(36) 53-sim-binary_tree +x86_64,+ppc64le alarm N N N N N N ERRNO(37) -53-sim-binary_tree +aarch64 alarm N N N N N N ALLOW +53-sim-binary_tree +aarch64,+loongarch64 alarm N N N N N N ALLOW test type: bpf-valgrind diff --git a/tests/55-basic-pfc_binary_tree.c b/tests/55-basic-pfc_binary_tree.c index e364fd6..0919f6b 100644 --- a/tests/55-basic-pfc_binary_tree.c +++ b/tests/55-basic-pfc_binary_tree.c @@ -87,6 +87,9 @@ int main(int argc, char *argv[]) if (rc < 0) goto out; rc = seccomp_arch_add(ctx, SCMP_ARCH_AARCH64); + if (rc < 0) + goto out; + rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64); if (rc < 0) goto out; rc = seccomp_attr_set(ctx, SCMP_FLTATR_CTL_OPTIMIZE, 2); diff --git a/tests/55-basic-pfc_binary_tree.pfc b/tests/55-basic-pfc_binary_tree.pfc index ba3244c..3310945 100644 --- a/tests/55-basic-pfc_binary_tree.pfc +++ b/tests/55-basic-pfc_binary_tree.pfc @@ -175,6 +175,93 @@ if ($arch == 3221225655) action ERRNO(16); # default action action ALLOW; +# filter for arch loongarch64 (3221225730) +if ($arch == 3221225730) + if ($syscall > 62) + if ($syscall > 214) + if ($syscall > 4294957051) + # filter for syscall "lstat" (4294957133) [priority: 65535] + if ($syscall == 4294957133) + action ERRNO(6); + # filter for syscall "open" (4294957130) [priority: 65535] + if ($syscall == 4294957130) + action ERRNO(2); + # filter for syscall "poll" (4294957127) [priority: 65535] + if ($syscall == 4294957127) + action ERRNO(7); + # filter for syscall "stat" (4294957122) [priority: 65535] + if ($syscall == 4294957122) + action ERRNO(4); + else # ($syscall <= 4294957051) + # filter for syscall "fstat" (4294957051) [priority: 65533] + if ($syscall == 4294957051) + if ($a0.hi32 == 0) + if ($a0.lo32 == 103) + action ERRNO(5); + # filter for syscall "mprotect" (226) [priority: 65533] + if ($syscall == 226) + if ($a0.hi32 == 0) + if ($a0.lo32 == 105) + action ERRNO(10); + # filter for syscall "mmap" (222) [priority: 65535] + if ($syscall == 222) + action ERRNO(9); + # filter for syscall "munmap" (215) [priority: 65535] + if ($syscall == 215) + action ERRNO(11); + else # ($syscall <= 214) + if ($syscall > 68) + # filter for syscall "brk" (214) [priority: 65535] + if ($syscall == 214) + action ERRNO(12); + # filter for syscall "rt_sigreturn" (139) [priority: 65535] + if ($syscall == 139) + action ERRNO(15); + # filter for syscall "rt_sigprocmask" (135) [priority: 65535] + if ($syscall == 135) + action ERRNO(14); + # filter for syscall "rt_sigaction" (134) [priority: 65535] + if ($syscall == 134) + action ERRNO(13); + else # ($syscall <= 68) + # filter for syscall "pwrite64" (68) [priority: 65531] + if ($syscall == 68) + if ($a0.hi32 == 0) + if ($a0.lo32 == 107) + if ($a1.hi32 == 0) + if ($a1.lo32 == 108) + action ERRNO(18); + # filter for syscall "pread64" (67) [priority: 65533] + if ($syscall == 67) + if ($a0.hi32 == 0) + if ($a0.lo32 == 106) + action ERRNO(17); + # filter for syscall "write" (64) [priority: 65533] + if ($syscall == 64) + if ($a0.hi32 == 0) + if ($a0.lo32 == 102) + action ERRNO(1); + # filter for syscall "read" (63) [priority: 65531] + if ($syscall == 63) + if ($a0.hi32 == 0) + if ($a0.lo32 == 100) + if ($a1.hi32 == 0) + if ($a1.lo32 == 101) + action ERRNO(0); + else # ($syscall <= 62) + # filter for syscall "lseek" (62) [priority: 65533] + if ($syscall == 62) + if ($a0.hi32 == 0) + if ($a0.lo32 == 104) + action ERRNO(8); + # filter for syscall "close" (57) [priority: 65535] + if ($syscall == 57) + action ERRNO(3); + # filter for syscall "ioctl" (29) [priority: 65535] + if ($syscall == 29) + action ERRNO(16); + # default action + action ALLOW; # invalid architecture action action KILL; # diff --git a/tests/56-basic-iterate_syscalls.c b/tests/56-basic-iterate_syscalls.c index 5e7ab67..b514afa 100644 --- a/tests/56-basic-iterate_syscalls.c +++ b/tests/56-basic-iterate_syscalls.c @@ -33,6 +33,7 @@ unsigned int arch_list[] = { SCMP_ARCH_X32, SCMP_ARCH_ARM, SCMP_ARCH_AARCH64, + SCMP_ARCH_LOONGARCH64, SCMP_ARCH_MIPS, SCMP_ARCH_MIPS64, SCMP_ARCH_MIPS64N32, diff --git a/tests/56-basic-iterate_syscalls.py b/tests/56-basic-iterate_syscalls.py index 77a5b89..d69dd0c 100755 --- a/tests/56-basic-iterate_syscalls.py +++ b/tests/56-basic-iterate_syscalls.py @@ -33,6 +33,7 @@ arch_list = ["x86", "x32", "arm", "aarch64", + "loongarch64", "mipsel", "mipsel64", "mipsel64n32", diff --git a/tests/regression b/tests/regression index 746cea9..32463c0 100755 --- a/tests/regression +++ b/tests/regression @@ -24,6 +24,7 @@ GLBL_ARCH_LE_SUPPORT=" \ x86 x86_64 x32 \ arm aarch64 \ + loongarch64 \ mipsel mipsel64 mipsel64n32 \ ppc64le \ riscv64 \ @@ -47,6 +48,7 @@ GLBL_ARCH_32B_SUPPORT=" \ GLBL_ARCH_64B_SUPPORT=" \ x86_64 \ aarch64 \ + loongarch64 \ mips64 \ parisc64 \ ppc64 \ @@ -801,7 +803,7 @@ function run_test_live() { # setup the arch specific return values case "$arch" in - x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x|riscv64|sh|sheb) + x86|x86_64|x32|arm|aarch64|loongarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x|riscv64|sh|sheb) rc_kill_process=159 rc_kill=159 rc_allow=160 -- cgit v1.2.1