diff options
-rw-r--r-- | tests/16-sim-arch_basic.c | 14 | ||||
-rwxr-xr-x | tests/16-sim-arch_basic.py | 8 |
2 files changed, 18 insertions, 4 deletions
diff --git a/tests/16-sim-arch_basic.c b/tests/16-sim-arch_basic.c index f2d122c..5b02cca 100644 --- a/tests/16-sim-arch_basic.c +++ b/tests/16-sim-arch_basic.c @@ -40,16 +40,26 @@ int main(int argc, char *argv[]) if (ctx == NULL) goto out; - if (seccomp_arch_native() != SCMP_ARCH_X86) { + if (seccomp_arch_exist(ctx, SCMP_ARCH_X86)) { rc = seccomp_arch_add(ctx, SCMP_ARCH_X86); if (rc != 0) goto out; } - if (seccomp_arch_native() != SCMP_ARCH_X86_64) { + if (seccomp_arch_exist(ctx, SCMP_ARCH_X86_64)) { rc = seccomp_arch_add(ctx, SCMP_ARCH_X86_64); if (rc != 0) goto out; } + if (seccomp_arch_exist(ctx, SCMP_ARCH_X32)) { + rc = seccomp_arch_add(ctx, SCMP_ARCH_X32); + if (rc != 0) + goto out; + } + if (seccomp_arch_exist(ctx, SCMP_ARCH_ARM)) { + rc = seccomp_arch_add(ctx, SCMP_ARCH_ARM); + if (rc != 0) + goto out; + } rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(read), 1, SCMP_A0(SCMP_CMP_EQ, STDIN_FILENO)); diff --git a/tests/16-sim-arch_basic.py b/tests/16-sim-arch_basic.py index e23d18b..4484ac5 100755 --- a/tests/16-sim-arch_basic.py +++ b/tests/16-sim-arch_basic.py @@ -30,10 +30,14 @@ from seccomp import * def test(args): f = SyscallFilter(KILL) - if not system_arch() == Arch.X86: + if not f.exist_arch(Arch.X86): f.add_arch(Arch.X86) - if not system_arch() == Arch.X86_64: + if not f.exist_arch(Arch.X86_64): f.add_arch(Arch.X86_64) + if not f.exist_arch(Arch.X32): + f.add_arch(Arch.X32) + if not f.exist_arch(Arch.ARM): + f.add_arch(Arch.ARM) f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin)) f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stdout)) f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stderr)) |