HALF ECHO LEARN / REFERENCE COLLECTION

v262.2

src/shared/seccomp-util.c

102,895 bytesGit mode 100644Download original fileLGPL-2.1-or-later

Git blob: d6d619894a60f4a94f096498dbeec4aa8794dcb5

Lines 1–1000 of 2,699

/* SPDX-License-Identifier: LGPL-2.1-or-later */
 
/* This needs to be included before the seccomp headers, otherwise missing syscalls will be defined in this
 * file and pass the ifdef, but they won't be defined in the seccomp headers so things like
 * SCMP_SYS(fchmodat2) will resolve as empty and fail the build with older glibc/libseccomp. */
#include <sys/syscall.h>
#include <fcntl.h>
#include <linux/seccomp.h>
#include <sched.h>
#include <sys/mman.h>
#include <sys/prctl.h> /* IWYU pragma: keep */
#include <sys/ptrace.h>
#include <sys/shm.h>
#include <sys/stat.h>
 
#ifdef __mips__
#include <asm/sgidefs.h>
#endif
 
#include "af-list.h"
#include "alloc-util.h"
#include "env-util.h"
#include "errno-list.h"
#include "log.h"
#include "namespace-util.h"
#include "nsflags.h"
#include "nulstr-util.h"
#include "parse-util.h"
#include "process-util.h"
#include "seccomp-util.h"
#include "set.h"
#include "string-util.h"
#include "strv.h"
 
#if HAVE_SECCOMP
DLSYM_PROTOTYPE(seccomp_api_get) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_add) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_exist) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_native) = NULL;
DLSYM_PROTOTYPE(seccomp_arch_remove) = NULL;
DLSYM_PROTOTYPE(seccomp_attr_set) = NULL;
DLSYM_PROTOTYPE(seccomp_init) = NULL;
DLSYM_PROTOTYPE(seccomp_load) = NULL;
DLSYM_PROTOTYPE(seccomp_release) = NULL;
DLSYM_PROTOTYPE(seccomp_rule_add_array) = NULL;
DLSYM_PROTOTYPE(seccomp_rule_add_exact) = NULL;
DLSYM_PROTOTYPE(seccomp_syscall_resolve_name) = NULL;
DLSYM_PROTOTYPE(seccomp_syscall_resolve_num_arch) = NULL;
 
/* This array will be modified at runtime as seccomp_restrict_archs is called. */
uint32_t seccomp_local_archs[] = {
 
        /* Note: always list the native arch we are compiled as last, so that users can deny-list seccomp(), but our own calls to it still succeed */
 
#if defined(__x86_64__) && defined(__ILP32__)
                SCMP_ARCH_X86,
                SCMP_ARCH_X86_64,
                SCMP_ARCH_X32,         /* native */
#elif defined(__x86_64__) && !defined(__ILP32__)
                SCMP_ARCH_X86,
                SCMP_ARCH_X32,
                SCMP_ARCH_X86_64,      /* native */
#elif defined(__i386__)
                SCMP_ARCH_X86,
#elif defined(__aarch64__)
                SCMP_ARCH_ARM,
                SCMP_ARCH_AARCH64,     /* native */
#elif defined(__arm__)
                SCMP_ARCH_ARM,
#elif defined(__loongarch_lp64)
                SCMP_ARCH_LOONGARCH64,
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && _MIPS_SIM == _MIPS_SIM_ABI32
                SCMP_ARCH_MIPSEL,
                SCMP_ARCH_MIPS,        /* native */
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && _MIPS_SIM == _MIPS_SIM_ABI32
                SCMP_ARCH_MIPS,
                SCMP_ARCH_MIPSEL,      /* native */
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && _MIPS_SIM == _MIPS_SIM_ABI64
                SCMP_ARCH_MIPSEL,
                SCMP_ARCH_MIPS,
                SCMP_ARCH_MIPSEL64N32,
                SCMP_ARCH_MIPS64N32,
                SCMP_ARCH_MIPSEL64,
                SCMP_ARCH_MIPS64,      /* native */
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && _MIPS_SIM == _MIPS_SIM_ABI64
                SCMP_ARCH_MIPS,
                SCMP_ARCH_MIPSEL,
                SCMP_ARCH_MIPS64N32,
                SCMP_ARCH_MIPSEL64N32,
                SCMP_ARCH_MIPS64,
                SCMP_ARCH_MIPSEL64,    /* native */
#elif defined(__mips__) && __BYTE_ORDER == __BIG_ENDIAN && _MIPS_SIM == _MIPS_SIM_NABI32
                SCMP_ARCH_MIPSEL,
                SCMP_ARCH_MIPS,
                SCMP_ARCH_MIPSEL64,
                SCMP_ARCH_MIPS64,
                SCMP_ARCH_MIPSEL64N32,
                SCMP_ARCH_MIPS64N32,   /* native */
#elif defined(__mips__) && __BYTE_ORDER == __LITTLE_ENDIAN && _MIPS_SIM == _MIPS_SIM_NABI32
                SCMP_ARCH_MIPS,
                SCMP_ARCH_MIPSEL,
                SCMP_ARCH_MIPS64,
                SCMP_ARCH_MIPSEL64,
                SCMP_ARCH_MIPS64N32,
                SCMP_ARCH_MIPSEL64N32, /* native */
#elif defined(__hppa64__)
                SCMP_ARCH_PARISC,
                SCMP_ARCH_PARISC64,    /* native */
#elif defined(__hppa__)
                SCMP_ARCH_PARISC,
#elif defined(__powerpc64__) && __BYTE_ORDER == __BIG_ENDIAN
                SCMP_ARCH_PPC,
                SCMP_ARCH_PPC64LE,
                SCMP_ARCH_PPC64,       /* native */
#elif defined(__powerpc64__) && __BYTE_ORDER == __LITTLE_ENDIAN
                SCMP_ARCH_PPC,
                SCMP_ARCH_PPC64,
                SCMP_ARCH_PPC64LE,     /* native */
#elif defined(__powerpc__)
                SCMP_ARCH_PPC,
#elif defined(__riscv) && __riscv_xlen == 64 && defined(SCMP_ARCH_RISCV64)
                SCMP_ARCH_RISCV64,
#elif defined(__s390x__)
                SCMP_ARCH_S390,
                SCMP_ARCH_S390X,      /* native */
#elif defined(__s390__)
                SCMP_ARCH_S390,
#endif
                SECCOMP_LOCAL_ARCH_END
        };
 
const char* seccomp_arch_to_string(uint32_t c) {
        /* Maintain order used in <seccomp.h>.
         *
         * Names used here should be the same as those used for ConditionArchitecture=,
         * except for "subarchitectures" like x32. */
 
        switch (c) {
        case SCMP_ARCH_NATIVE:
                return "native";
        case SCMP_ARCH_X86:
                return "x86";
        case SCMP_ARCH_X86_64:
                return "x86-64";
        case SCMP_ARCH_X32:
                return "x32";
        case SCMP_ARCH_ARM:
                return "arm";
        case SCMP_ARCH_AARCH64:
                return "arm64";
#ifdef SCMP_ARCH_LOONGARCH64
        case SCMP_ARCH_LOONGARCH64:
                return "loongarch64";
#endif
        case SCMP_ARCH_MIPS:
                return "mips";
        case SCMP_ARCH_MIPS64:
                return "mips64";
        case SCMP_ARCH_MIPS64N32:
                return "mips64-n32";
        case SCMP_ARCH_MIPSEL:
                return "mips-le";
        case SCMP_ARCH_MIPSEL64:
                return "mips64-le";
        case SCMP_ARCH_MIPSEL64N32:
                return "mips64-le-n32";
        case SCMP_ARCH_PARISC:
                return "parisc";
        case SCMP_ARCH_PARISC64:
                return "parisc64";
        case SCMP_ARCH_PPC:
                return "ppc";
        case SCMP_ARCH_PPC64:
                return "ppc64";
        case SCMP_ARCH_PPC64LE:
                return "ppc64-le";
#ifdef SCMP_ARCH_RISCV64
        case SCMP_ARCH_RISCV64:
                return "riscv64";
#endif
        case SCMP_ARCH_S390:
                return "s390";
        case SCMP_ARCH_S390X:
                return "s390x";
        default:
                return NULL;
        }
}
 
int seccomp_arch_from_string(const char *n, uint32_t *ret) {
        if (!n)
                return -EINVAL;
 
        assert(ret);
 
        if (streq(n, "native"))
                *ret = SCMP_ARCH_NATIVE;
        else if (streq(n, "x86"))
                *ret = SCMP_ARCH_X86;
        else if (streq(n, "x86-64"))
                *ret = SCMP_ARCH_X86_64;
        else if (streq(n, "x32"))
                *ret = SCMP_ARCH_X32;
        else if (streq(n, "arm"))
                *ret = SCMP_ARCH_ARM;
        else if (streq(n, "arm64"))
                *ret = SCMP_ARCH_AARCH64;
#ifdef SCMP_ARCH_LOONGARCH64
        else if (streq(n, "loongarch64"))
                *ret = SCMP_ARCH_LOONGARCH64;
#endif
        else if (streq(n, "mips"))
                *ret = SCMP_ARCH_MIPS;
        else if (streq(n, "mips64"))
                *ret = SCMP_ARCH_MIPS64;
        else if (streq(n, "mips64-n32"))
                *ret = SCMP_ARCH_MIPS64N32;
        else if (streq(n, "mips-le"))
                *ret = SCMP_ARCH_MIPSEL;
        else if (streq(n, "mips64-le"))
                *ret = SCMP_ARCH_MIPSEL64;
        else if (streq(n, "mips64-le-n32"))
                *ret = SCMP_ARCH_MIPSEL64N32;
        else if (streq(n, "parisc"))
                *ret = SCMP_ARCH_PARISC;
        else if (streq(n, "parisc64"))
                *ret = SCMP_ARCH_PARISC64;
        else if (streq(n, "ppc"))
                *ret = SCMP_ARCH_PPC;
        else if (streq(n, "ppc64"))
                *ret = SCMP_ARCH_PPC64;
        else if (streq(n, "ppc64-le"))
                *ret = SCMP_ARCH_PPC64LE;
#ifdef SCMP_ARCH_RISCV64
        else if (streq(n, "riscv64"))
                *ret = SCMP_ARCH_RISCV64;
#endif
        else if (streq(n, "s390"))
                *ret = SCMP_ARCH_S390;
        else if (streq(n, "s390x"))
                *ret = SCMP_ARCH_S390X;
        else
                return -EINVAL;
 
        return 0;
}
 
int seccomp_init_for_arch(scmp_filter_ctx *ret, uint32_t arch, uint32_t default_action) {
        _cleanup_(seccomp_releasep) scmp_filter_ctx seccomp = NULL;
        int r;
 
        assert(ret);
 
        /* Much like seccomp_init(), but initializes the filter for one specific architecture only, without affecting
         * any others. Also, turns off the NNP fiddling. */
 
        r = dlopen_libseccomp(LOG_DEBUG);
        if (r < 0)
                return r;
 
        seccomp = sym_seccomp_init(default_action);
        if (!seccomp)
                return -ENOMEM;
 
        if (arch != SCMP_ARCH_NATIVE &&
            arch != sym_seccomp_arch_native()) {
 
                r = sym_seccomp_arch_remove(seccomp, sym_seccomp_arch_native());
                if (r < 0)
                        return r;
 
                r = sym_seccomp_arch_add(seccomp, arch);
                if (r < 0)
                        return r;
 
                assert(sym_seccomp_arch_exist(seccomp, arch) >= 0);
                assert(sym_seccomp_arch_exist(seccomp, SCMP_ARCH_NATIVE) == -EEXIST);
                assert(sym_seccomp_arch_exist(seccomp, sym_seccomp_arch_native()) == -EEXIST);
        } else {
                assert(sym_seccomp_arch_exist(seccomp, SCMP_ARCH_NATIVE) >= 0);
                assert(sym_seccomp_arch_exist(seccomp, sym_seccomp_arch_native()) >= 0);
        }
 
        r = sym_seccomp_attr_set(seccomp, SCMP_FLTATR_ACT_BADARCH, SCMP_ACT_ALLOW);
        if (r < 0)
                return r;
 
        r = sym_seccomp_attr_set(seccomp, SCMP_FLTATR_CTL_NNP, 0);
        if (r < 0)
                return r;
 
#if SCMP_VER_MAJOR >= 3 || (SCMP_VER_MAJOR == 2 && SCMP_VER_MINOR >= 4)
        if (getenv_bool("SYSTEMD_LOG_SECCOMP") > 0) {
                r = sym_seccomp_attr_set(seccomp, SCMP_FLTATR_CTL_LOG, 1);
                if (r < 0)
                        log_debug_errno(r, "Failed to enable seccomp event logging: %m");
        }
#endif
 
        *ret = TAKE_PTR(seccomp);
        return 0;
}
 
static bool is_basic_seccomp_available(void) {
        return prctl_safe(PR_GET_SECCOMP, 0, 0, 0, 0) >= 0;
}
 
static bool is_seccomp_filter_available(void) {
        return prctl_safe(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0, 0, 0) == -EFAULT;
}
 
bool is_seccomp_available(void) {
        static int cached_enabled = -1;
 
        if (cached_enabled < 0) {
                if (dlopen_libseccomp(LOG_DEBUG) < 0)
                        return (cached_enabled = false);
 
                int b = secure_getenv_bool("SYSTEMD_SECCOMP");
                if (b != 0) {
                        if (b < 0 && b != -ENXIO) /* ENXIO: env var unset */
                                log_debug_errno(b, "Failed to parse $SYSTEMD_SECCOMP value, ignoring.");
 
                        cached_enabled =
                                is_basic_seccomp_available() &&
                                is_seccomp_filter_available();
                } else
                        cached_enabled = false;
        }
 
        return cached_enabled;
}
 
const SyscallFilterSet syscall_filter_sets[_SYSCALL_FILTER_SET_MAX] = {
        [SYSCALL_FILTER_SET_DEFAULT] = {
                .name = "@default",
                .help = "System calls that are always permitted",
                .value =
                "@sandbox\0"
                "arch_prctl\0"      /* Used during platform-specific initialization by ld-linux.so. */
                "brk\0"
                "cacheflush\0"
                "clock_getres\0"
                "clock_getres_time64\0"
                "clock_gettime\0"
                "clock_gettime64\0"
                "clock_nanosleep\0"
                "clock_nanosleep_time64\0"
                "execve\0"
                "exit\0"
                "exit_group\0"
                "futex\0"
                "futex_time64\0"
                "futex_waitv\0"
                "get_robust_list\0"
                "get_thread_area\0"
                "getegid\0"
                "getegid32\0"
                "geteuid\0"
                "geteuid32\0"
                "getgid\0"
                "getgid32\0"
                "getgroups\0"
                "getgroups32\0"
                "getpgid\0"
                "getpgrp\0"
                "getpid\0"
                "getppid\0"
                "getrandom\0"
                "getresgid\0"
                "getresgid32\0"
                "getresuid\0"
                "getresuid32\0"
                "getrlimit\0"      /* make sure processes can query stack size and such */
                "getsid\0"
                "gettid\0"
                "gettimeofday\0"
                "getuid\0"
                "getuid32\0"
                "lsm_get_self_attr\0"
                "lsm_list_modules\0"
                "membarrier\0"
                "mmap\0"
                "mmap2\0"
                "mprotect\0"
                "mseal\0"
                "munmap\0"
                "nanosleep\0"
                "pause\0"
                "prlimit64\0"
                "restart_syscall\0"
                "riscv_flush_icache\0"
                "riscv_hwprobe\0"
                "rseq\0"
                "rt_sigreturn\0"
                "sched_getaffinity\0"
                "sched_yield\0"
                "set_robust_list\0"
                "set_thread_area\0"
                "set_tid_address\0"
                "set_tls\0"
                "sigreturn\0"
                "time\0"
                "ugetrlimit\0"
                "uretprobe\0"
        },
        [SYSCALL_FILTER_SET_AIO] = {
                .name = "@aio",
                .help = "Asynchronous IO",
                .value =
                "io_cancel\0"
                "io_destroy\0"
                "io_getevents\0"
                "io_pgetevents\0"
                "io_pgetevents_time64\0"
                "io_setup\0"
                "io_submit\0"
                "io_uring_enter\0"
                "io_uring_register\0"
                "io_uring_setup\0"
        },
        [SYSCALL_FILTER_SET_BASIC_IO] = {
                .name = "@basic-io",
                .help = "Basic IO",
                .value =
                "_llseek\0"
                "close\0"
                "close_range\0"
                "dup\0"
                "dup2\0"
                "dup3\0"
                "llseek\0"
                "lseek\0"
                "pread64\0"
                "preadv\0"
                "preadv2\0"
                "pwrite64\0"
                "pwritev\0"
                "pwritev2\0"
                "read\0"
                "readv\0"
                "write\0"
                "writev\0"
        },
        [SYSCALL_FILTER_SET_CHOWN] = {
                .name = "@chown",
                .help = "Change ownership of files and directories",
                .value =
                "chown\0"
                "chown32\0"
                "fchown\0"
                "fchown32\0"
                "fchownat\0"
                "lchown\0"
                "lchown32\0"
        },
        [SYSCALL_FILTER_SET_CLOCK] = {
                .name = "@clock",
                .help = "Change the system time",
                .value =
                "adjtimex\0"
                "clock_adjtime\0"
                "clock_adjtime64\0"
                "clock_settime\0"
                "clock_settime64\0"
                "settimeofday\0"
        },
        [SYSCALL_FILTER_SET_CPU_EMULATION] = {
                .name = "@cpu-emulation",
                .help = "System calls for CPU emulation functionality",
                .value =
                "modify_ldt\0"
                "subpage_prot\0"
                "switch_endian\0"
                "vm86\0"
                "vm86old\0"
        },
        [SYSCALL_FILTER_SET_DEBUG] = {
                .name = "@debug",
                .help = "Debugging, performance monitoring and tracing functionality",
                .value =
                "lookup_dcookie\0"
                "perf_event_open\0"
                "pidfd_getfd\0"
                "ptrace\0"
                "rtas\0"
                "s390_runtime_instr\0"
                "sys_debug_setcontext\0"
        },
        [SYSCALL_FILTER_SET_FILE_SYSTEM] = {
                .name = "@file-system",
                .help = "File system operations",
                .value =
                "access\0"
                "chdir\0"
                "chmod\0"
                "close\0"
                "creat\0"
                "faccessat\0"
                "faccessat2\0"
                "fallocate\0"
                "fchdir\0"
                "fchmod\0"
                "fchmodat\0"
                "fchmodat2\0"
                "fcntl\0"
                "fcntl64\0"
                "fgetxattr\0"
                "file_getattr\0"
                "file_setattr\0"
                "flistxattr\0"
                "fremovexattr\0"
                "fsetxattr\0"
                "fstat\0"
                "fstat64\0"
                "fstatat\0"
                "fstatat64\0"
                "fstatfs\0"
                "fstatfs64\0"
                "ftruncate\0"
                "ftruncate64\0"
                "futimesat\0"
                "getcwd\0"
                "getdents\0"
                "getdents64\0"
                "getxattr\0"
                "getxattrat\0"
                "inotify_add_watch\0"
                "inotify_init\0"
                "inotify_init1\0"
                "inotify_rm_watch\0"
                "lgetxattr\0"
                "link\0"
                "linkat\0"
                "listmount\0"
                "listxattr\0"
                "listxattrat\0"
                "llistxattr\0"
                "lremovexattr\0"
                "lsetxattr\0"
                "lstat\0"
                "lstat64\0"
                "mkdir\0"
                "mkdirat\0"
                "mknod\0"
                "mknodat\0"
                "newfstat\0"
                "newfstatat\0"
                "oldfstat\0"
                "oldlstat\0"
                "oldstat\0"
                "open\0"
                "open_tree\0"
                "openat\0"
                "openat2\0"
                "readlink\0"
                "readlinkat\0"
                "removexattr\0"
                "removexattrat\0"
                "rename\0"
                "renameat\0"
                "renameat2\0"
                "rmdir\0"
                "setxattr\0"
                "setxattrat\0"
                "stat\0"
                "stat64\0"
                "statfs\0"
                "statfs64\0"
                "statmount\0"
                "statx\0"
                "symlink\0"
                "symlinkat\0"
                "truncate\0"
                "truncate64\0"
                "unlink\0"
                "unlinkat\0"
                "utime\0"
                "utimensat\0"
                "utimensat_time64\0"
                "utimes\0"
        },
        [SYSCALL_FILTER_SET_IO_EVENT] = {
                .name = "@io-event",
                .help = "Event loop system calls",
                .value =
                "_newselect\0"
                "epoll_create\0"
                "epoll_create1\0"
                "epoll_ctl\0"
                "epoll_ctl_old\0"
                "epoll_pwait\0"
                "epoll_pwait2\0"
                "epoll_wait\0"
                "epoll_wait_old\0"
                "eventfd\0"
                "eventfd2\0"
                "poll\0"
                "ppoll\0"
                "ppoll_time64\0"
                "pselect6\0"
                "pselect6_time64\0"
                "select\0"
        },
        [SYSCALL_FILTER_SET_IPC] = {
                .name = "@ipc",
                .help = "SysV IPC, POSIX Message Queues or other IPC",
                .value =
                "ipc\0"
                "memfd_create\0"
                "mq_getsetattr\0"
                "mq_notify\0"
                "mq_open\0"
                "mq_timedreceive\0"
                "mq_timedreceive_time64\0"
                "mq_timedsend\0"
                "mq_timedsend_time64\0"
                "mq_unlink\0"
                "msgctl\0"
                "msgget\0"
                "msgrcv\0"
                "msgsnd\0"
                "pipe\0"
                "pipe2\0"
                "process_madvise\0"
                "process_vm_readv\0"
                "process_vm_writev\0"
                "semctl\0"
                "semget\0"
                "semop\0"
                "semtimedop\0"
                "semtimedop_time64\0"
                "shmat\0"
                "shmctl\0"
                "shmdt\0"
                "shmget\0"
        },
        [SYSCALL_FILTER_SET_KEYRING] = {
                .name = "@keyring",
                .help = "Kernel keyring access",
                .value =
                "add_key\0"
                "keyctl\0"
                "request_key\0"
        },
        [SYSCALL_FILTER_SET_MEMLOCK] = {
                .name = "@memlock",
                .help = "Memory locking control",
                .value =
                "mlock\0"
                "mlock2\0"
                "mlockall\0"
                "munlock\0"
                "munlockall\0"
        },
        [SYSCALL_FILTER_SET_MODULE] = {
                .name = "@module",
                .help = "Loading and unloading of kernel modules",
                .value =
                "delete_module\0"
                "finit_module\0"
                "init_module\0"
        },
        [SYSCALL_FILTER_SET_MOUNT] = {
                .name = "@mount",
                .help = "Mounting and unmounting of file systems",
                .value =
                "chroot\0"
                "fsconfig\0"
                "fsmount\0"
                "fsopen\0"
                "fspick\0"
                "mount\0"
                "mount_setattr\0"
                "move_mount\0"
                "open_tree_attr\0"
                "pivot_root\0"
                "umount\0"
                "umount2\0"
        },
        [SYSCALL_FILTER_SET_NETWORK_IO] = {
                .name = "@network-io",
                .help = "Network or Unix socket IO, should not be needed if not network facing",
                .value =
                "accept\0"
                "accept4\0"
                "bind\0"
                "connect\0"
                "getpeername\0"
                "getsockname\0"
                "getsockopt\0"
                "listen\0"
                "recv\0"
                "recvfrom\0"
                "recvmmsg\0"
                "recvmmsg_time64\0"
                "recvmsg\0"
                "send\0"
                "sendmmsg\0"
                "sendmsg\0"
                "sendto\0"
                "setsockopt\0"
                "shutdown\0"
                "socket\0"
                "socketcall\0"
                "socketpair\0"
        },
        [SYSCALL_FILTER_SET_OBSOLETE] = {
                /* some unknown even to libseccomp */
                .name = "@obsolete",
                .help = "Unusual, obsolete or unimplemented system calls",
                .value =
                "_sysctl\0"
                "afs_syscall\0"
                "bdflush\0"
                "break\0"
                "create_module\0"
                "ftime\0"
                "get_kernel_syms\0"
                "getpmsg\0"
                "gtty\0"
                "idle\0"
                "lock\0"
                "mpx\0"
                "prof\0"
                "profil\0"
                "putpmsg\0"
                "query_module\0"
                "security\0"
                "sgetmask\0"
                "ssetmask\0"
                "stime\0"
                "stty\0"
                "sysfs\0"
                "tuxcall\0"
                "ulimit\0"
                "uselib\0"
                "ustat\0"
                "vserver\0"
        },
        [SYSCALL_FILTER_SET_PKEY] = {
                .name = "@pkey",
                .help = "System calls used for memory protection keys",
                .value =
                "pkey_alloc\0"
                "pkey_free\0"
                "pkey_mprotect\0"
        },
        [SYSCALL_FILTER_SET_PRIVILEGED] = {
                .name = "@privileged",
                .help = "All system calls which need super-user capabilities",
                .value =
                "@chown\0"
                "@clock\0"
                "@module\0"
                "@raw-io\0"
                "@reboot\0"
                "@swap\0"
                "_sysctl\0"
                "acct\0"
                "bpf\0"
                "capset\0"
                "chroot\0"
                "fanotify_init\0"
                "fanotify_mark\0"
                "nfsservctl\0"
                "open_by_handle_at\0"
                "pivot_root\0"
                "quotactl\0"
                "quotactl_fd\0"
                "setdomainname\0"
                "setfsuid\0"
                "setfsuid32\0"
                "setgroups\0"
                "setgroups32\0"
                "sethostname\0"
                "setresuid\0"
                "setresuid32\0"
                "setreuid\0"
                "setreuid32\0"
                "setuid\0"      /* We list the explicit system calls here, as @setuid also includes setgid() which is not necessarily privileged */
                "setuid32\0"
                "vhangup\0"
        },
        [SYSCALL_FILTER_SET_PROCESS] = {
                .name = "@process",
                .help = "Process control, execution, namespacing operations",
                .value =
                "capget\0"      /* Able to query arbitrary processes */
                "clone\0"
                /* ia64 as the only architecture has clone2, a replacement for clone, but ia64 doesn't
                 * implement seccomp, so we don't need to list it at all. C.f.
                 * acce2f71779c54086962fefce3833d886c655f62 in the kernel. */
                "clone3\0"
                "execveat\0"
                "fork\0"
                "getrusage\0"
                "kill\0"
                "pidfd_open\0"
                "pidfd_send_signal\0"
                "prctl\0"
                "rt_sigqueueinfo\0"
                "rt_tgsigqueueinfo\0"
                "setns\0"
                "swapcontext\0" /* Some archs e.g. powerpc32 are using it to do userspace context switches */
                "tgkill\0"
                "times\0"
                "tkill\0"
                "unshare\0"
                "vfork\0"
                "wait4\0"
                "waitid\0"
                "waitpid\0"
        },
        [SYSCALL_FILTER_SET_RAW_IO] = {
                .name = "@raw-io",
                .help = "Raw I/O port access",
                .value =
                "ioperm\0"
                "iopl\0"
                "pciconfig_iobase\0"
                "pciconfig_read\0"
                "pciconfig_write\0"
                "s390_pci_mmio_read\0"
                "s390_pci_mmio_write\0"
        },
        [SYSCALL_FILTER_SET_REBOOT] = {
                .name = "@reboot",
                .help = "Reboot and reboot preparation/kexec",
                .value =
                "kexec_file_load\0"
                "kexec_load\0"
                "reboot\0"
        },
        [SYSCALL_FILTER_SET_RESOURCES] = {
                .name = "@resources",
                .help = "Alter resource settings",
                .value =
                "ioprio_set\0"
                "mbind\0"
                "migrate_pages\0"
                "move_pages\0"
                "nice\0"
                "sched_setaffinity\0"
                "sched_setattr\0"
                "sched_setparam\0"
                "sched_setscheduler\0"
                "set_mempolicy\0"
                "set_mempolicy_home_node\0"
                "setpriority\0"
                "setrlimit\0"
        },
        [SYSCALL_FILTER_SET_SANDBOX] = {
                .name = "@sandbox",
                .help = "Sandbox functionality",
                .value =
                "landlock_add_rule\0"
                "landlock_create_ruleset\0"
                "landlock_restrict_self\0"
                "seccomp\0"
        },
        [SYSCALL_FILTER_SET_SETUID] = {
                .name = "@setuid",
                .help = "Operations for changing user/group credentials",
                .value =
                "setgid\0"
                "setgid32\0"
                "setgroups\0"
                "setgroups32\0"
                "setregid\0"
                "setregid32\0"
                "setresgid\0"
                "setresgid32\0"
                "setresuid\0"
                "setresuid32\0"
                "setreuid\0"
                "setreuid32\0"
                "setuid\0"
                "setuid32\0"
        },
        [SYSCALL_FILTER_SET_SIGNAL] = {
                .name = "@signal",
                .help = "Process signal handling",
                .value =
                "rt_sigaction\0"
                "rt_sigpending\0"
                "rt_sigprocmask\0"
                "rt_sigsuspend\0"
                "rt_sigtimedwait\0"
                "rt_sigtimedwait_time64\0"
                "sigaction\0"
                "sigaltstack\0"
                "signal\0"
                "signalfd\0"
                "signalfd4\0"
                "sigpending\0"
                "sigprocmask\0"
                "sigsuspend\0"
        },
        [SYSCALL_FILTER_SET_SWAP] = {
                .name = "@swap",
                .help = "Enable/disable swap devices",
                .value =
                "swapoff\0"
                "swapon\0"
        },
        [SYSCALL_FILTER_SET_SYNC] = {
                .name = "@sync",
                .help = "Synchronize files and memory to storage",
                .value =
                /* Please also update the list in seccomp_suppress_sync(). */
                "fdatasync\0"
                "fsync\0"
                "msync\0"
                "sync\0"
                "sync_file_range\0"
                "sync_file_range2\0"
                "syncfs\0"
        },
        [SYSCALL_FILTER_SET_SYSTEM_SERVICE] = {
                .name = "@system-service",
                .help = "General system service operations",
                .value =
                "@aio\0"
                "@basic-io\0"
                "@chown\0"
                "@default\0"
                "@file-system\0"
                "@io-event\0"
                "@ipc\0"
                "@keyring\0"
                "@memlock\0"
                "@network-io\0"
                "@process\0"
                "@resources\0"
                "@setuid\0"
                "@signal\0"
                "@sync\0"
                "@timer\0"
                "arm_fadvise64_64\0"
                "capget\0"
                "capset\0"
                "copy_file_range\0"
                "fadvise64\0"
                "fadvise64_64\0"
                "flock\0"
                "get_mempolicy\0"
                "getcpu\0"
                "getpriority\0"
                "ioctl\0"
                "ioprio_get\0"
                "kcmp\0"
                "madvise\0"
                "mremap\0"
                "name_to_handle_at\0"
                "oldolduname\0"
                "olduname\0"
                "personality\0"
                "readahead\0"
                "readdir\0"
                "remap_file_pages\0"
                "sched_get_priority_max\0"
                "sched_get_priority_min\0"
                "sched_getattr\0"
                "sched_getparam\0"
                "sched_getscheduler\0"
                "sched_rr_get_interval\0"
                "sched_rr_get_interval_time64\0"
                "sched_yield\0"
                "sendfile\0"
                "sendfile64\0"
                "setfsgid\0"
                "setfsgid32\0"
                "setfsuid\0"
                "setfsuid32\0"
                "setpgid\0"
                "setsid\0"
                "splice\0"
                "sysinfo\0"
                "tee\0"
                "umask\0"
                "uname\0"
                "userfaultfd\0"
                "vmsplice\0"
        },
        [SYSCALL_FILTER_SET_TIMER] = {
                .name = "@timer",
                .help = "Schedule operations by time",
                .value =
                "alarm\0"
                "getitimer\0"
                "setitimer\0"
                "timer_create\0"
                "timer_delete\0"
                "timer_getoverrun\0"
                "timer_gettime\0"
                "timer_gettime64\0"
                "timer_settime\0"
                "timer_settime64\0"
                "timerfd_create\0"