diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 476bff1260..1c3706a8cc 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -899,6 +899,10 @@ int seccomp_protect_sysctl(void) { log_debug("Operating on architecture: %s", seccomp_arch_to_string(arch)); + if (IN_SET(arch, SCMP_ARCH_X32, SCMP_ARCH_AARCH64)) + /* No _sysctl syscall */ + continue; + r = seccomp_init_for_arch(&seccomp, arch, SCMP_ACT_ALLOW); if (r < 0) return r; diff --git a/src/test/test-seccomp.c b/src/test/test-seccomp.c index efd145e063..50fe24c794 100644 --- a/src/test/test-seccomp.c +++ b/src/test/test-seccomp.c @@ -244,13 +244,17 @@ static void test_protect_sysctl(void) { assert_se(pid >= 0); if (pid == 0) { +#if __NR__sysctl > 0 assert_se(syscall(__NR__sysctl, NULL) < 0); assert_se(errno == EFAULT); +#endif assert_se(seccomp_protect_sysctl() >= 0); +#if __NR__sysctl > 0 assert_se(syscall(__NR__sysctl, 0, 0, 0) < 0); assert_se(errno == EPERM); +#endif _exit(EXIT_SUCCESS); }