From 80a47de17eb4084ef035eb4f0321d74ff04c4bca Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 23 Jan 2020 17:01:39 +0100 Subject: [PATCH] syscalls: use gperf for lookup use gperf to generate a perfect hash to lookup syscall names. It improves significantly the complexity for seccomp_syscall_resolve_name.* since it replaces the expensive strcmp for each syscall in the database, with a lookup table. The complexity for syscall_resolve_num is not changed and it uses the linear search, that is anyway less expensive than seccomp_syscall_resolve_name.* as it uses an index for comparison instead of doing a string comparison. On my machine, calling 1000 seccomp_syscall_resolve_name_arch and seccomp_syscall_resolve_num_arch over the entire syscalls DB passed from ~0.45 sec to ~0.06s. Closes: https://github.com/seccomp/libseccomp/issues/207 Signed-off-by: Giuseppe Scrivano --- .travis.yml | 1 + configure.ac | 5 + src/Makefile.am | 38 +- src/arch-aarch64-syscalls.c | 559 -------------------------- src/arch-arm-syscalls.c | 570 -------------------------- src/arch-mips-syscalls.c | 562 -------------------------- src/arch-mips64-syscalls.c | 562 -------------------------- src/arch-mips64n32-syscalls.c | 562 -------------------------- src/arch-parisc-syscalls.c | 542 ------------------------- src/arch-ppc-syscalls.c | 559 -------------------------- src/arch-ppc64-syscalls.c | 559 -------------------------- src/arch-riscv64-syscalls.c | 553 ------------------------- src/arch-s390-syscalls.c | 642 ----------------------------- src/arch-s390x-syscalls.c | 642 ----------------------------- src/arch-x32-syscalls.c | 558 ------------------------- src/arch-x86-syscalls.c | 692 -------------------------------- src/arch-x86_64-syscalls.c | 559 -------------------------- src/generate_syscalls_perf.sh | 14 + src/syscalls.c | 60 +++ src/syscalls.csv | 468 +++++++++++++++++++++ src/syscalls.h | 59 +++ src/syscalls.perf.template | 78 ++++ tests/56-iterate-syscalls.c | 85 ++++ tests/56-iterate-syscalls.py | 58 +++ tests/56-iterate-syscalls.tests | 11 + tests/Makefile.am | 9 +- 26 files changed, 869 insertions(+), 8138 deletions(-) delete mode 100644 src/arch-aarch64-syscalls.c delete mode 100644 src/arch-arm-syscalls.c delete mode 100644 src/arch-mips-syscalls.c delete mode 100644 src/arch-mips64-syscalls.c delete mode 100644 src/arch-mips64n32-syscalls.c delete mode 100644 src/arch-parisc-syscalls.c delete mode 100644 src/arch-ppc-syscalls.c delete mode 100644 src/arch-ppc64-syscalls.c delete mode 100644 src/arch-riscv64-syscalls.c delete mode 100644 src/arch-s390-syscalls.c delete mode 100644 src/arch-s390x-syscalls.c delete mode 100644 src/arch-x32-syscalls.c delete mode 100644 src/arch-x86-syscalls.c delete mode 100644 src/arch-x86_64-syscalls.c create mode 100755 src/generate_syscalls_perf.sh create mode 100644 src/syscalls.c create mode 100644 src/syscalls.csv create mode 100644 src/syscalls.h create mode 100644 src/syscalls.perf.template create mode 100644 tests/56-iterate-syscalls.c create mode 100755 tests/56-iterate-syscalls.py create mode 100644 tests/56-iterate-syscalls.tests diff --git a/.travis.yml b/.travis.yml index 63aa56b3..6b4b9adc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ addons: - valgrind - clang - lcov + - gperf env: global: diff --git a/configure.ac b/configure.ac index 7d80b405..9982423e 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,11 @@ AC_DEFINE_UNQUOTED([ENABLE_PYTHON], [$(test "$enable_python" = yes && echo 1 || echo 0)], [Python bindings build flag.]) +AC_CHECK_TOOL(GPERF, gperf) +if test -z "$GPERF"; then + AC_MSG_ERROR([please install gperf]) +fi + dnl #### dnl coverity checks dnl #### diff --git a/src/Makefile.am b/src/Makefile.am index 47e2f332..15156bc8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -31,20 +31,21 @@ SOURCES_ALL = \ hash.h hash.c \ db.h db.c \ arch.c arch.h \ - arch-x86.h arch-x86.c arch-x86-syscalls.c \ - arch-x86_64.h arch-x86_64.c arch-x86_64-syscalls.c \ - arch-x32.h arch-x32.c arch-x32-syscalls.c \ - arch-arm.h arch-arm.c arch-arm-syscalls.c \ - arch-aarch64.h arch-aarch64.c arch-aarch64-syscalls.c \ - arch-mips.h arch-mips.c arch-mips-syscalls.c \ - arch-mips64.h arch-mips64.c arch-mips64-syscalls.c \ - arch-mips64n32.h arch-mips64n32.c arch-mips64n32-syscalls.c \ - arch-parisc.h arch-parisc.c arch-parisc64.c arch-parisc-syscalls.c \ - arch-ppc.h arch-ppc.c arch-ppc-syscalls.c \ - arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c \ - arch-riscv64.h arch-riscv64.c arch-riscv64-syscalls.c \ - arch-s390.h arch-s390.c arch-s390-syscalls.c \ - arch-s390x.h arch-s390x.c arch-s390x-syscalls.c + arch-x86.h arch-x86.c \ + arch-x86_64.h arch-x86_64.c \ + arch-x32.h arch-x32.c \ + arch-arm.h arch-arm.c \ + arch-aarch64.h arch-aarch64.c \ + arch-mips.h arch-mips.c \ + arch-mips64.h arch-mips64.c \ + arch-mips64n32.h arch-mips64n32.c \ + arch-parisc.h arch-parisc.c arch-parisc64.c \ + arch-ppc.h arch-ppc.c \ + arch-ppc64.h arch-ppc64.c \ + arch-riscv64.h arch-riscv64.c \ + arch-s390.h arch-s390.c \ + arch-s390x.h arch-s390x.c\ + syscalls.c syscalls.perf.c EXTRA_DIST = arch-syscall-validate @@ -68,5 +69,14 @@ libseccomp_la_CFLAGS = ${AM_CFLAGS} ${CODE_COVERAGE_CFLAGS} ${CFLAGS} \ libseccomp_la_LDFLAGS = ${AM_LDFLAGS} ${CODE_COVERAGE_LDFLAGS} ${LDFLAGS} \ -version-number ${VERSION_MAJOR}:${VERSION_MINOR}:${VERSION_MICRO} +EXTRA_DIST += syscalls.perf.c syscalls.perf +CLEANFILES = syscalls.perf.c syscalls.perf + +syscalls.perf: syscalls.csv syscalls.perf.template + ${AM_V_GEN} $(abs_top_srcdir)/src/generate_syscalls_perf.sh + +syscalls.perf.c: syscalls.perf + ${GPERF} -m 100 --null-strings --pic -tCEG -T -S1 $< > $@ + check-build: ${MAKE} ${AM_MAKEFLAGS} ${check_PROGRAMS} diff --git a/src/arch-aarch64-syscalls.c b/src/arch-aarch64-syscalls.c deleted file mode 100644 index 02f25ebc..00000000 --- a/src/arch-aarch64-syscalls.c +++ /dev/null @@ -1,559 +0,0 @@ -/** - * Enhanced Seccomp AArch64 Syscall Table - * - * Copyright (c) 2014 Red Hat - * Author: Marcin Juszkiewicz - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-aarch64.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def aarch64_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", __PNR__newselect }, - { "_sysctl", __PNR__sysctl }, - { "accept", 202 }, - { "accept4", 242 }, - { "access", __PNR_access }, - { "acct", 89 }, - { "add_key", 217 }, - { "adjtimex", 171 }, - { "afs_syscall", __PNR_afs_syscall }, - { "alarm", __PNR_alarm }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", __PNR_bdflush }, - { "bind", 200 }, - { "bpf", 280 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 214 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 90 }, - { "capset", 91 }, - { "chdir", 49 }, - { "chmod", __PNR_chmod }, - { "chown", __PNR_chown }, - { "chown32", __PNR_chown32 }, - { "chroot", 51 }, - { "clock_adjtime", 266 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 114 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 113 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 115 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 112 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 220 }, - { "clone3", __PNR_clone3 }, - { "close", 57 }, - { "connect", 203 }, - { "copy_file_range", 285 }, - { "creat", __PNR_creat }, - { "create_module", __PNR_create_module }, - { "delete_module", 106 }, - { "dup", 23 }, - { "dup2", __PNR_dup2 }, - { "dup3", 24 }, - { "epoll_create", __PNR_epoll_create }, - { "epoll_create1", 20 }, - { "epoll_ctl", 21 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 22 }, - { "epoll_wait", __PNR_epoll_wait }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", __PNR_eventfd }, - { "eventfd2", 19 }, - { "execve", 221 }, - { "execveat", 281 }, - { "exit", 93 }, - { "exit_group", 94 }, - { "faccessat", 48 }, - { "fadvise64", 223 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", 47 }, - { "fanotify_init", 262 }, - { "fanotify_mark", 263 }, - { "fchdir", 50 }, - { "fchmod", 52 }, - { "fchmodat", 53 }, - { "fchown", 55 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 54 }, - { "fcntl", 25 }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", 83 }, - { "fgetxattr", 10 }, - { "finit_module", 273 }, - { "flistxattr", 13 }, - { "flock", 32 }, - { "fork", __PNR_fork }, - { "fremovexattr", 16 }, - { "fsconfig", 431 }, - { "fsetxattr", 7 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 80 }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", 44 }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", 82 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 46 }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", 98 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", __PNR_futimesat }, - { "get_kernel_syms", __PNR_get_kernel_syms }, - { "get_mempolicy", 236 }, - { "get_robust_list", 100 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 168 }, - { "getcwd", 17 }, - { "getdents", __PNR_getdents }, - { "getdents64", 61 }, - { "getegid", 177 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 175 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 176 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 158 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 102 }, - { "getpeername", 205 }, - { "getpgid", 155 }, - { "getpgrp", __PNR_getpgrp }, - { "getpid", 172 }, - { "getpmsg", __PNR_getpmsg }, - { "getppid", 173 }, - { "getpriority", 141 }, - { "getrandom", 278 }, - { "getresgid", 150 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 148 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", __PNR_getrlimit }, - { "getrusage", 165 }, - { "getsid", 156 }, - { "getsockname", 204 }, - { "getsockopt", 209 }, - { "gettid", 178 }, - { "gettimeofday", 169 }, - { "getuid", 174 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 8 }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", 105 }, - { "inotify_add_watch", 27 }, - { "inotify_init", __PNR_inotify_init }, - { "inotify_init1", 26 }, - { "inotify_rm_watch", 28 }, - { "io_cancel", 3 }, - { "io_destroy", 1 }, - { "io_getevents", 4 }, - { "io_pgetevents", 292 }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 0 }, - { "io_submit", 2 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 29 }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", 31 }, - { "ioprio_set", 30 }, - { "ipc", __PNR_ipc }, - { "kcmp", 272 }, - { "kexec_file_load", 294 }, - { "kexec_load", 104 }, - { "keyctl", 219 }, - { "kill", 129 }, - { "lchown", __PNR_lchown }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 9 }, - { "link", __PNR_link }, - { "linkat", 37 }, - { "listen", 201 }, - { "listxattr", 11 }, - { "llistxattr", 12 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 18 }, - { "lremovexattr", 15 }, - { "lseek", 62 }, - { "lsetxattr", 6 }, - { "lstat", __PNR_lstat }, - { "lstat64", __PNR_lstat64 }, - { "madvise", 233 }, - { "mbind", 235 }, - { "membarrier", 283 }, - { "memfd_create", 279 }, - { "migrate_pages", 238 }, - { "mincore", 232 }, - { "mkdir", __PNR_mkdir }, - { "mkdirat", 34 }, - { "mknod", __PNR_mknod }, - { "mknodat", 33 }, - { "mlock", 228 }, - { "mlock2", 284 }, - { "mlockall", 230 }, - { "mmap", 222 }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", 40 }, - { "move_mount", 429 }, - { "move_pages", 239 }, - { "mprotect", 226 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 185 }, - { "mq_notify", 184 }, - { "mq_open", 180 }, - { "mq_timedreceive", 183 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 182 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 181 }, - { "mremap", 216 }, - { "msgctl", 187 }, - { "msgget", 186 }, - { "msgrcv", 188 }, - { "msgsnd", 189 }, - { "msync", 227 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 229 }, - { "munlockall", 231 }, - { "munmap", 215 }, - { "name_to_handle_at", 264 }, - { "nanosleep", 101 }, - { "newfstatat", 79 }, - { "nfsservctl", 42 }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", __PNR_open }, - { "open_by_handle_at", 265 }, - { "open_tree", 428 }, - { "openat", 56 }, - { "pause", __PNR_pause }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 241 }, - { "personality", 92 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", __PNR_pipe }, - { "pipe2", 59 }, - { "pivot_root", 41 }, - { "pkey_alloc", 289 }, - { "pkey_free", 290 }, - { "pkey_mprotect", 288 }, - { "poll", __PNR_poll }, - { "ppoll", 73 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 167 }, - { "pread64", 67 }, - { "preadv", 69 }, - { "preadv2", 286 }, - { "prlimit64", 261 }, - { "process_vm_readv", 270 }, - { "process_vm_writev", 271 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 72 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 117 }, - { "putpmsg", __PNR_putpmsg }, - { "pwrite64", 68 }, - { "pwritev", 70 }, - { "pwritev2", 287 }, - { "query_module", __PNR_query_module }, - { "quotactl", 60 }, - { "read", 63 }, - { "readahead", 213 }, - { "readdir", __PNR_readdir }, - { "readlink", __PNR_readlink }, - { "readlinkat", 78 }, - { "readv", 65 }, - { "reboot", 142 }, - { "recv", __PNR_recv }, - { "recvfrom", 207 }, - { "recvmmsg", 243 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 212 }, - { "remap_file_pages", 234 }, - { "removexattr", 14 }, - { "rename", __PNR_rename }, - { "renameat", 38 }, - { "renameat2", 276 }, - { "request_key", 218 }, - { "restart_syscall", 128 }, - { "rmdir", __PNR_rmdir }, - { "rseq", 293 }, - { "rt_sigaction", 134 }, - { "rt_sigpending", 136 }, - { "rt_sigprocmask", 135 }, - { "rt_sigqueueinfo", 138 }, - { "rt_sigreturn", 139 }, - { "rt_sigsuspend", 133 }, - { "rt_sigtimedwait", 137 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 240 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 125 }, - { "sched_get_priority_min", 126 }, - { "sched_getaffinity", 123 }, - { "sched_getattr", 275 }, - { "sched_getparam", 121 }, - { "sched_getscheduler", 120 }, - { "sched_rr_get_interval", 127 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 122 }, - { "sched_setattr", 274 }, - { "sched_setparam", 118 }, - { "sched_setscheduler", 119 }, - { "sched_yield", 124 }, - { "seccomp", 277 }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", 191 }, - { "semget", 190 }, - { "semop", 193 }, - { "semtimedop", 192 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", 71 }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", 269 }, - { "sendmsg", 211 }, - { "sendto", 206 }, - { "set_mempolicy", 237 }, - { "set_robust_list", 99 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 96 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 162 }, - { "setfsgid", 152 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 151 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 144 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 159 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 161 }, - { "setitimer", 103 }, - { "setns", 268 }, - { "setpgid", 154 }, - { "setpriority", 140 }, - { "setregid", 143 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 149 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 147 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 145 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", __PNR_setrlimit }, - { "setsid", 157 }, - { "setsockopt", 208 }, - { "settimeofday", 170 }, - { "setuid", 146 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 5 }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", 196 }, - { "shmctl", 195 }, - { "shmdt", 197 }, - { "shmget", 194 }, - { "shutdown", 210 }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", 132 }, - { "signal", __PNR_signal }, - { "signalfd", __PNR_signalfd }, - { "signalfd4", 74 }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", 198 }, - { "socketcall", __PNR_socketcall }, - { "socketpair", 199 }, - { "splice", 76 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", __PNR_stat }, - { "stat64", __PNR_stat64 }, - { "statfs", 43 }, - { "statfs64", __PNR_statfs64 }, - { "statx", 291 }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 225 }, - { "swapon", 224 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", __PNR_symlink }, - { "symlinkat", 36 }, - { "sync", 81 }, - { "sync_file_range", 84 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 267 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", __PNR_sysfs }, - { "sysinfo", 179 }, - { "syslog", 116 }, - { "sysmips", __PNR_sysmips }, - { "tee", 77 }, - { "tgkill", 131 }, - { "time", __PNR_time }, - { "timer_create", 107 }, - { "timer_delete", 111 }, - { "timer_getoverrun", 109 }, - { "timer_gettime", 108 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 110 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 85 }, - { "timerfd_gettime", 87 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 86 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 153 }, - { "tkill", 130 }, - { "truncate", 45 }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", 166 }, - { "umount", __PNR_umount }, - { "umount2", 39 }, - { "uname", 160 }, - { "unlink", __PNR_unlink }, - { "unlinkat", 35 }, - { "unshare", 97 }, - { "uselib", __PNR_uselib }, - { "userfaultfd", 282 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", __PNR_ustat }, - { "utime", __PNR_utime }, - { "utimensat", 88 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", __PNR_utimes }, - { "vfork", __PNR_vfork }, - { "vhangup", 58 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 75 }, - { "vserver", __PNR_vserver }, - { "wait4", 260 }, - { "waitid", 95 }, - { "waitpid", __PNR_waitpid }, - { "write", 64 }, - { "writev", 66 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int aarch64_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = aarch64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *aarch64_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = aarch64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *aarch64_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &aarch64_syscall_table[spot]; -} diff --git a/src/arch-arm-syscalls.c b/src/arch-arm-syscalls.c deleted file mode 100644 index 923aae9d..00000000 --- a/src/arch-arm-syscalls.c +++ /dev/null @@ -1,570 +0,0 @@ -/** - * Enhanced Seccomp ARM Syscall Table - * - * Copyright (c) 2013 Red Hat - * Author: Paul Moore - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-arm.h" - -#define __SCMP_NR_OABI_SYSCALL_BASE 0x900000 -#define __SCMP_ARM_NR_BASE 0x0f0000 - -/* NOTE: we currently only support the ARM EABI, more info at the URL below: - * -> http://wiki.embeddedarm.com/wiki/EABI_vs_OABI */ -#if 1 -#define __SCMP_NR_BASE 0 -#else -#define __SCMP_NR_BASE __SCMP_NR_OABI_SYSCALL_BASE -#endif - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def arm_syscall_table[] = { \ - /* NOTE: arm_sync_file_range() and sync_file_range2() share values */ - { "_llseek", (__SCMP_NR_BASE + 140) }, - { "_newselect", (__SCMP_NR_BASE + 142) }, - { "_sysctl", (__SCMP_NR_BASE + 149) }, - { "accept", (__SCMP_NR_BASE + 285) }, - { "accept4", (__SCMP_NR_BASE + 366) }, - { "access", (__SCMP_NR_BASE + 33) }, - { "acct", (__SCMP_NR_BASE + 51) }, - { "add_key", (__SCMP_NR_BASE + 309) }, - { "adjtimex", (__SCMP_NR_BASE + 124) }, - { "afs_syscall", __PNR_afs_syscall }, - { "alarm", __PNR_alarm }, - { "arm_fadvise64_64", (__SCMP_NR_BASE + 270) }, - { "arm_sync_file_range", (__SCMP_NR_BASE + 341) }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", (__SCMP_NR_BASE + 134) }, - { "bind", (__SCMP_NR_BASE + 282) }, - { "bpf", (__SCMP_NR_BASE + 386) }, - { "break", __PNR_break }, - { "breakpoint", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 1)) }, - { "brk", (__SCMP_NR_BASE + 45) }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 2)) }, - { "capget", (__SCMP_NR_BASE + 184) }, - { "capset", (__SCMP_NR_BASE + 185) }, - { "chdir", (__SCMP_NR_BASE + 12) }, - { "chmod", (__SCMP_NR_BASE + 15) }, - { "chown", (__SCMP_NR_BASE + 182) }, - { "chown32", (__SCMP_NR_BASE + 212) }, - { "chroot", (__SCMP_NR_BASE + 61) }, - { "clock_adjtime", (__SCMP_NR_BASE + 372) }, - { "clock_adjtime64", (__SCMP_NR_BASE + 405) }, - { "clock_getres", (__SCMP_NR_BASE + 264) }, - { "clock_getres_time64", (__SCMP_NR_BASE + 406) }, - { "clock_gettime", (__SCMP_NR_BASE + 263) }, - { "clock_gettime64", (__SCMP_NR_BASE + 403) }, - { "clock_nanosleep", (__SCMP_NR_BASE + 265) }, - { "clock_nanosleep_time64", (__SCMP_NR_BASE + 407) }, - { "clock_settime", (__SCMP_NR_BASE + 262) }, - { "clock_settime64", (__SCMP_NR_BASE + 404) }, - { "clone", (__SCMP_NR_BASE + 120) }, - { "clone3", (__SCMP_NR_BASE + 435) }, - { "close", (__SCMP_NR_BASE + 6) }, - { "connect", (__SCMP_NR_BASE + 283) }, - { "copy_file_range", (__SCMP_NR_BASE + 391) }, - { "creat", (__SCMP_NR_BASE + 8) }, - { "create_module", __PNR_create_module }, - { "delete_module", (__SCMP_NR_BASE + 129) }, - { "dup", (__SCMP_NR_BASE + 41) }, - { "dup2", (__SCMP_NR_BASE + 63) }, - { "dup3", (__SCMP_NR_BASE + 358) }, - { "epoll_create", (__SCMP_NR_BASE + 250) }, - { "epoll_create1", (__SCMP_NR_BASE + 357) }, - { "epoll_ctl", (__SCMP_NR_BASE + 251) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (__SCMP_NR_BASE + 346) }, - { "epoll_wait", (__SCMP_NR_BASE + 252) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (__SCMP_NR_BASE + 351) }, - { "eventfd2", (__SCMP_NR_BASE + 356) }, - { "execve", (__SCMP_NR_BASE + 11) }, - { "execveat", (__SCMP_NR_BASE + 387) }, - { "exit", (__SCMP_NR_BASE + 1) }, - { "exit_group", (__SCMP_NR_BASE + 248) }, - { "faccessat", (__SCMP_NR_BASE + 334) }, - { "fadvise64", __PNR_fadvise64 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (__SCMP_NR_BASE + 352) }, - { "fanotify_init", (__SCMP_NR_BASE + 367) }, - { "fanotify_mark", (__SCMP_NR_BASE + 368) }, - { "fchdir", (__SCMP_NR_BASE + 133) }, - { "fchmod", (__SCMP_NR_BASE + 94) }, - { "fchmodat", (__SCMP_NR_BASE + 333) }, - { "fchown", (__SCMP_NR_BASE + 95) }, - { "fchown32", (__SCMP_NR_BASE + 207) }, - { "fchownat", (__SCMP_NR_BASE + 325) }, - { "fcntl", (__SCMP_NR_BASE + 55) }, - { "fcntl64", (__SCMP_NR_BASE + 221) }, - { "fdatasync", (__SCMP_NR_BASE + 148) }, - { "fgetxattr", (__SCMP_NR_BASE + 231) }, - { "finit_module", (__SCMP_NR_BASE + 379) }, - { "flistxattr", (__SCMP_NR_BASE + 234) }, - { "flock", (__SCMP_NR_BASE + 143) }, - { "fork", (__SCMP_NR_BASE + 2) }, - { "fremovexattr", (__SCMP_NR_BASE + 237) }, - { "fsconfig", (__SCMP_NR_BASE + 431) }, - { "fsetxattr", (__SCMP_NR_BASE + 228) }, - { "fsmount", (__SCMP_NR_BASE + 432) }, - { "fsopen", (__SCMP_NR_BASE + 430) }, - { "fspick", (__SCMP_NR_BASE + 433) }, - { "fstat", (__SCMP_NR_BASE + 108) }, - { "fstat64", (__SCMP_NR_BASE + 197) }, - { "fstatat64", (__SCMP_NR_BASE + 327) }, - { "fstatfs", (__SCMP_NR_BASE + 100) }, - { "fstatfs64", (__SCMP_NR_BASE + 267) }, - { "fsync", (__SCMP_NR_BASE + 118) }, - { "ftime", __PNR_ftime }, - { "ftruncate", (__SCMP_NR_BASE + 93) }, - { "ftruncate64", (__SCMP_NR_BASE + 194) }, - { "futex", (__SCMP_NR_BASE + 240) }, - { "futex_time64", (__SCMP_NR_BASE + 422) }, - { "futimesat", (__SCMP_NR_BASE + 326) }, - { "get_kernel_syms", __PNR_get_kernel_syms }, - { "get_mempolicy", (__SCMP_NR_BASE + 320) }, - { "get_robust_list", (__SCMP_NR_BASE + 339) }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 6)) }, - { "getcpu", (__SCMP_NR_BASE + 345) }, - { "getcwd", (__SCMP_NR_BASE + 183) }, - { "getdents", (__SCMP_NR_BASE + 141) }, - { "getdents64", (__SCMP_NR_BASE + 217) }, - { "getegid", (__SCMP_NR_BASE + 50) }, - { "getegid32", (__SCMP_NR_BASE + 202) }, - { "geteuid", (__SCMP_NR_BASE + 49) }, - { "geteuid32", (__SCMP_NR_BASE + 201) }, - { "getgid", (__SCMP_NR_BASE + 47) }, - { "getgid32", (__SCMP_NR_BASE + 200) }, - { "getgroups", (__SCMP_NR_BASE + 80) }, - { "getgroups32", (__SCMP_NR_BASE + 205) }, - { "getitimer", (__SCMP_NR_BASE + 105) }, - { "getpeername", (__SCMP_NR_BASE + 287) }, - { "getpgid", (__SCMP_NR_BASE + 132) }, - { "getpgrp", (__SCMP_NR_BASE + 65) }, - { "getpid", (__SCMP_NR_BASE + 20) }, - { "getpmsg", __PNR_getpmsg }, - { "getppid", (__SCMP_NR_BASE + 64) }, - { "getpriority", (__SCMP_NR_BASE + 96) }, - { "getrandom", (__SCMP_NR_BASE + 384) }, - { "getresgid", (__SCMP_NR_BASE + 171) }, - { "getresgid32", (__SCMP_NR_BASE + 211) }, - { "getresuid", (__SCMP_NR_BASE + 165) }, - { "getresuid32", (__SCMP_NR_BASE + 209) }, - { "getrlimit", __PNR_getrlimit }, - { "getrusage", (__SCMP_NR_BASE + 77) }, - { "getsid", (__SCMP_NR_BASE + 147) }, - { "getsockname", (__SCMP_NR_BASE + 286) }, - { "getsockopt", (__SCMP_NR_BASE + 295) }, - { "gettid", (__SCMP_NR_BASE + 224) }, - { "gettimeofday", (__SCMP_NR_BASE + 78) }, - { "getuid", (__SCMP_NR_BASE + 24) }, - { "getuid32", (__SCMP_NR_BASE + 199) }, - { "getxattr", (__SCMP_NR_BASE + 229) }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", (__SCMP_NR_BASE + 128) }, - { "inotify_add_watch", (__SCMP_NR_BASE + 317) }, - { "inotify_init", (__SCMP_NR_BASE + 316) }, - { "inotify_init1", (__SCMP_NR_BASE + 360) }, - { "inotify_rm_watch", (__SCMP_NR_BASE + 318) }, - { "io_cancel", (__SCMP_NR_BASE + 247) }, - { "io_destroy", (__SCMP_NR_BASE + 244) }, - { "io_getevents", (__SCMP_NR_BASE + 245) }, - { "io_pgetevents", (__SCMP_NR_BASE + 399) }, - { "io_pgetevents_time64", (__SCMP_NR_BASE + 416) }, - { "io_setup", (__SCMP_NR_BASE + 243) }, - { "io_submit", (__SCMP_NR_BASE + 246) }, - { "io_uring_setup", (__SCMP_NR_BASE + 425) }, - { "io_uring_enter", (__SCMP_NR_BASE + 426) }, - { "io_uring_register", (__SCMP_NR_BASE + 427) }, - { "ioctl", (__SCMP_NR_BASE + 54) }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", (__SCMP_NR_BASE + 315) }, - { "ioprio_set", (__SCMP_NR_BASE + 314) }, - { "ipc", __PNR_ipc }, - { "kcmp", (__SCMP_NR_BASE + 378) }, - { "kexec_file_load", (__SCMP_NR_BASE + 401) }, - { "kexec_load", (__SCMP_NR_BASE + 347) }, - { "keyctl", (__SCMP_NR_BASE + 311) }, - { "kill", (__SCMP_NR_BASE + 37) }, - { "lchown", (__SCMP_NR_BASE + 16) }, - { "lchown32", (__SCMP_NR_BASE + 198) }, - { "lgetxattr", (__SCMP_NR_BASE + 230) }, - { "link", (__SCMP_NR_BASE + 9) }, - { "linkat", (__SCMP_NR_BASE + 330) }, - { "listen", (__SCMP_NR_BASE + 284) }, - { "listxattr", (__SCMP_NR_BASE + 232) }, - { "llistxattr", (__SCMP_NR_BASE + 233) }, - { "lock", __PNR_lock }, - { "lookup_dcookie", (__SCMP_NR_BASE + 249) }, - { "lremovexattr", (__SCMP_NR_BASE + 236) }, - { "lseek", (__SCMP_NR_BASE + 19) }, - { "lsetxattr", (__SCMP_NR_BASE + 227) }, - { "lstat", (__SCMP_NR_BASE + 107) }, - { "lstat64", (__SCMP_NR_BASE + 196) }, - { "madvise", (__SCMP_NR_BASE + 220) }, - { "mbind", (__SCMP_NR_BASE + 319) }, - { "membarrier", (__SCMP_NR_BASE + 389) }, - { "memfd_create", (__SCMP_NR_BASE + 385) }, - { "migrate_pages", (__SCMP_NR_BASE + 400) }, - { "mincore", (__SCMP_NR_BASE + 219) }, - { "mkdir", (__SCMP_NR_BASE + 39) }, - { "mkdirat", (__SCMP_NR_BASE + 323) }, - { "mknod", (__SCMP_NR_BASE + 14) }, - { "mknodat", (__SCMP_NR_BASE + 324) }, - { "mlock", (__SCMP_NR_BASE + 150) }, - { "mlock2", (__SCMP_NR_BASE + 390) }, - { "mlockall", (__SCMP_NR_BASE + 152) }, - { "mmap", __PNR_mmap }, - { "mmap2", (__SCMP_NR_BASE + 192) }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", (__SCMP_NR_BASE + 21) }, - { "move_mount", (__SCMP_NR_BASE + 429) }, - { "move_pages", (__SCMP_NR_BASE + 344) }, - { "mprotect", (__SCMP_NR_BASE + 125) }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", (__SCMP_NR_BASE + 279) }, - { "mq_notify", (__SCMP_NR_BASE + 278) }, - { "mq_open", (__SCMP_NR_BASE + 274) }, - { "mq_timedreceive", (__SCMP_NR_BASE + 277) }, - { "mq_timedreceive_time64", (__SCMP_NR_BASE + 419) }, - { "mq_timedsend", (__SCMP_NR_BASE + 276) }, - { "mq_timedsend_time64", (__SCMP_NR_BASE + 418) }, - { "mq_unlink", (__SCMP_NR_BASE + 275) }, - { "mremap", (__SCMP_NR_BASE + 163) }, - { "msgctl", (__SCMP_NR_BASE + 304) }, - { "msgget", (__SCMP_NR_BASE + 303) }, - { "msgrcv", (__SCMP_NR_BASE + 302) }, - { "msgsnd", (__SCMP_NR_BASE + 301) }, - { "msync", (__SCMP_NR_BASE + 144) }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", (__SCMP_NR_BASE + 151) }, - { "munlockall", (__SCMP_NR_BASE + 153) }, - { "munmap", (__SCMP_NR_BASE + 91) }, - { "name_to_handle_at", (__SCMP_NR_BASE + 370) }, - { "nanosleep", (__SCMP_NR_BASE + 162) }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", (__SCMP_NR_BASE + 169) }, - { "nice", (__SCMP_NR_BASE + 34) }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", (__SCMP_NR_BASE + 5) }, - { "open_by_handle_at", (__SCMP_NR_BASE + 371) }, - { "open_tree", (__SCMP_NR_BASE + 428) }, - { "openat", (__SCMP_NR_BASE + 322) }, - { "pause", (__SCMP_NR_BASE + 29) }, - { "pciconfig_iobase", (__SCMP_NR_BASE + 271) }, - { "pciconfig_read", (__SCMP_NR_BASE + 272) }, - { "pciconfig_write", (__SCMP_NR_BASE + 273) }, - { "perf_event_open", (__SCMP_NR_BASE + 364) }, - { "personality", (__SCMP_NR_BASE + 136) }, - { "pidfd_open", (__SCMP_NR_BASE + 434) }, - { "pidfd_send_signal", (__SCMP_NR_BASE + 424) }, - { "pipe", (__SCMP_NR_BASE + 42) }, - { "pipe2", (__SCMP_NR_BASE + 359) }, - { "pivot_root", (__SCMP_NR_BASE + 218) }, - { "pkey_alloc", (__SCMP_NR_BASE + 395) }, - { "pkey_free", (__SCMP_NR_BASE + 396) }, - { "pkey_mprotect", (__SCMP_NR_BASE + 394) }, - { "poll", (__SCMP_NR_BASE + 168) }, - { "ppoll", (__SCMP_NR_BASE + 336) }, - { "ppoll_time64", (__SCMP_NR_BASE + 414) }, - { "prctl", (__SCMP_NR_BASE + 172) }, - { "pread64", (__SCMP_NR_BASE + 180) }, - { "preadv", (__SCMP_NR_BASE + 361) }, - { "preadv2", (__SCMP_NR_BASE + 392) }, - { "prlimit64", (__SCMP_NR_BASE + 369) }, - { "process_vm_readv", (__SCMP_NR_BASE + 376) }, - { "process_vm_writev", (__SCMP_NR_BASE + 377) }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", (__SCMP_NR_BASE + 335) }, - { "pselect6_time64", (__SCMP_NR_BASE + 413) }, - { "ptrace", (__SCMP_NR_BASE + 26) }, - { "putpmsg", __PNR_putpmsg }, - { "pwrite64", (__SCMP_NR_BASE + 181) }, - { "pwritev", (__SCMP_NR_BASE + 362) }, - { "pwritev2", (__SCMP_NR_BASE + 393) }, - { "query_module", __PNR_query_module }, - { "quotactl", (__SCMP_NR_BASE + 131) }, - { "read", (__SCMP_NR_BASE + 3) }, - { "readahead", (__SCMP_NR_BASE + 225) }, - { "readdir", __PNR_readdir }, - { "readlink", (__SCMP_NR_BASE + 85) }, - { "readlinkat", (__SCMP_NR_BASE + 332) }, - { "readv", (__SCMP_NR_BASE + 145) }, - { "reboot", (__SCMP_NR_BASE + 88) }, - { "recv", (__SCMP_NR_BASE + 291) }, - { "recvfrom", (__SCMP_NR_BASE + 292) }, - { "recvmmsg", (__SCMP_NR_BASE + 365) }, - { "recvmmsg_time64", (__SCMP_NR_BASE + 417) }, - { "recvmsg", (__SCMP_NR_BASE + 297) }, - { "remap_file_pages", (__SCMP_NR_BASE + 253) }, - { "removexattr", (__SCMP_NR_BASE + 235) }, - { "rename", (__SCMP_NR_BASE + 38) }, - { "renameat", (__SCMP_NR_BASE + 329) }, - { "renameat2", (__SCMP_NR_BASE + 382) }, - { "request_key", (__SCMP_NR_BASE + 310) }, - { "restart_syscall", (__SCMP_NR_BASE + 0) }, - { "rmdir", (__SCMP_NR_BASE + 40) }, - { "rseq", (__SCMP_NR_BASE + 398) }, - { "rt_sigaction", (__SCMP_NR_BASE + 174) }, - { "rt_sigpending", (__SCMP_NR_BASE + 176) }, - { "rt_sigprocmask", (__SCMP_NR_BASE + 175) }, - { "rt_sigqueueinfo", (__SCMP_NR_BASE + 178) }, - { "rt_sigreturn", (__SCMP_NR_BASE + 173) }, - { "rt_sigsuspend", (__SCMP_NR_BASE + 179) }, - { "rt_sigtimedwait", (__SCMP_NR_BASE + 177) }, - { "rt_sigtimedwait_time64", (__SCMP_NR_BASE + 421) }, - { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 363) }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", (__SCMP_NR_BASE + 159) }, - { "sched_get_priority_min", (__SCMP_NR_BASE + 160) }, - { "sched_getaffinity", (__SCMP_NR_BASE + 242) }, - { "sched_getattr", (__SCMP_NR_BASE + 381) }, - { "sched_getparam", (__SCMP_NR_BASE + 155) }, - { "sched_getscheduler", (__SCMP_NR_BASE + 157) }, - { "sched_rr_get_interval", (__SCMP_NR_BASE + 161) }, - { "sched_rr_get_interval_time64", (__SCMP_NR_BASE + 423) }, - { "sched_setaffinity", (__SCMP_NR_BASE + 241) }, - { "sched_setattr", (__SCMP_NR_BASE + 380) }, - { "sched_setparam", (__SCMP_NR_BASE + 154) }, - { "sched_setscheduler", (__SCMP_NR_BASE + 156) }, - { "sched_yield", (__SCMP_NR_BASE + 158) }, - { "seccomp", (__SCMP_NR_BASE + 383) }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", (__SCMP_NR_BASE + 300) }, - { "semget", (__SCMP_NR_BASE + 299) }, - { "semop", (__SCMP_NR_BASE + 298) }, - { "semtimedop", (__SCMP_NR_BASE + 312) }, - { "semtimedop_time64", (__SCMP_NR_BASE + 420) }, - { "send", (__SCMP_NR_BASE + 289) }, - { "sendfile", (__SCMP_NR_BASE + 187) }, - { "sendfile64", (__SCMP_NR_BASE + 239) }, - { "sendmmsg", (__SCMP_NR_BASE + 374) }, - { "sendmsg", (__SCMP_NR_BASE + 296) }, - { "sendto", (__SCMP_NR_BASE + 290) }, - { "set_mempolicy", (__SCMP_NR_BASE + 321) }, - { "set_robust_list", (__SCMP_NR_BASE + 338) }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", (__SCMP_NR_BASE + 256) }, - { "set_tls", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 5)) }, - { "setdomainname", (__SCMP_NR_BASE + 121) }, - { "setfsgid", (__SCMP_NR_BASE + 139) }, - { "setfsgid32", (__SCMP_NR_BASE + 216) }, - { "setfsuid", (__SCMP_NR_BASE + 138) }, - { "setfsuid32", (__SCMP_NR_BASE + 215) }, - { "setgid", (__SCMP_NR_BASE + 46) }, - { "setgid32", (__SCMP_NR_BASE + 214) }, - { "setgroups", (__SCMP_NR_BASE + 81) }, - { "setgroups32", (__SCMP_NR_BASE + 206) }, - { "sethostname", (__SCMP_NR_BASE + 74) }, - { "setitimer", (__SCMP_NR_BASE + 104) }, - { "setns", (__SCMP_NR_BASE + 375) }, - { "setpgid", (__SCMP_NR_BASE + 57) }, - { "setpriority", (__SCMP_NR_BASE + 97) }, - { "setregid", (__SCMP_NR_BASE + 71) }, - { "setregid32", (__SCMP_NR_BASE + 204) }, - { "setresgid", (__SCMP_NR_BASE + 170) }, - { "setresgid32", (__SCMP_NR_BASE + 210) }, - { "setresuid", (__SCMP_NR_BASE + 164) }, - { "setresuid32", (__SCMP_NR_BASE + 208) }, - { "setreuid", (__SCMP_NR_BASE + 70) }, - { "setreuid32", (__SCMP_NR_BASE + 203) }, - { "setrlimit", (__SCMP_NR_BASE + 75) }, - { "setsid", (__SCMP_NR_BASE + 66) }, - { "setsockopt", (__SCMP_NR_BASE + 294) }, - { "settimeofday", (__SCMP_NR_BASE + 79) }, - { "setuid", (__SCMP_NR_BASE + 23) }, - { "setuid32", (__SCMP_NR_BASE + 213) }, - { "setxattr", (__SCMP_NR_BASE + 226) }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", (__SCMP_NR_BASE + 305) }, - { "shmctl", (__SCMP_NR_BASE + 308) }, - { "shmdt", (__SCMP_NR_BASE + 306) }, - { "shmget", (__SCMP_NR_BASE + 307) }, - { "shutdown", (__SCMP_NR_BASE + 293) }, - { "sigaction", (__SCMP_NR_BASE + 67) }, - { "sigaltstack", (__SCMP_NR_BASE + 186) }, - { "signal", __PNR_signal }, - { "signalfd", (__SCMP_NR_BASE + 349) }, - { "signalfd4", (__SCMP_NR_BASE + 355) }, - { "sigpending", (__SCMP_NR_BASE + 73) }, - { "sigprocmask", (__SCMP_NR_BASE + 126) }, - { "sigreturn", (__SCMP_NR_BASE + 119) }, - { "sigsuspend", (__SCMP_NR_BASE + 72) }, - { "socket", (__SCMP_NR_BASE + 281) }, - { "socketcall", __PNR_socketcall }, - { "socketpair", (__SCMP_NR_BASE + 288) }, - { "splice", (__SCMP_NR_BASE + 340) }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", (__SCMP_NR_BASE + 106) }, - { "stat64", (__SCMP_NR_BASE + 195) }, - { "statfs", (__SCMP_NR_BASE + 99) }, - { "statfs64", (__SCMP_NR_BASE + 266) }, - { "statx", (__SCMP_NR_BASE + 397) }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", (__SCMP_NR_BASE + 115) }, - { "swapon", (__SCMP_NR_BASE + 87) }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", (__SCMP_NR_BASE + 83) }, - { "symlinkat", (__SCMP_NR_BASE + 331) }, - { "sync", (__SCMP_NR_BASE + 36) }, - { "sync_file_range", __PNR_sync_file_range }, - { "sync_file_range2", (__SCMP_NR_BASE + 341) }, - { "syncfs", (__SCMP_NR_BASE + 373) }, - { "syscall", (__PNR_syscall) }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", (__SCMP_NR_BASE + 135) }, - { "sysinfo", (__SCMP_NR_BASE + 116) }, - { "syslog", (__SCMP_NR_BASE + 103) }, - { "sysmips", __PNR_sysmips }, - { "tee", (__SCMP_NR_BASE + 342) }, - { "tgkill", (__SCMP_NR_BASE + 268) }, - { "time", __PNR_time }, - { "timer_create", (__SCMP_NR_BASE + 257) }, - { "timer_delete", (__SCMP_NR_BASE + 261) }, - { "timer_getoverrun", (__SCMP_NR_BASE + 260) }, - { "timer_gettime", (__SCMP_NR_BASE + 259) }, - { "timer_gettime64", (__SCMP_NR_BASE + 408) }, - { "timer_settime", (__SCMP_NR_BASE + 258) }, - { "timer_settime64", (__SCMP_NR_BASE + 409) }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", (__SCMP_NR_BASE + 350) }, - { "timerfd_gettime", (__SCMP_NR_BASE + 354) }, - { "timerfd_gettime64", (__SCMP_NR_BASE + 410) }, - { "timerfd_settime", (__SCMP_NR_BASE + 353) }, - { "timerfd_settime64", (__SCMP_NR_BASE + 411) }, - { "times", (__SCMP_NR_BASE + 43) }, - { "tkill", (__SCMP_NR_BASE + 238) }, - { "truncate", (__SCMP_NR_BASE + 92) }, - { "truncate64", (__SCMP_NR_BASE + 193) }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", (__SCMP_NR_BASE + 191) }, - { "ulimit", __PNR_ulimit }, - { "umask", (__SCMP_NR_BASE + 60) }, - { "umount", __PNR_umount }, - { "umount2", (__SCMP_NR_BASE + 52) }, - { "uname", (__SCMP_NR_BASE + 122) }, - { "unlink", (__SCMP_NR_BASE + 10) }, - { "unlinkat", (__SCMP_NR_BASE + 328) }, - { "unshare", (__SCMP_NR_BASE + 337) }, - { "uselib", (__SCMP_NR_BASE + 86) }, - { "userfaultfd", (__SCMP_NR_BASE + 388) }, - { "usr26", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 3)) }, - { "usr32", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 4)) }, - { "ustat", (__SCMP_NR_BASE + 62) }, - { "utime", __PNR_utime }, - { "utimensat", (__SCMP_NR_BASE + 348) }, - { "utimensat_time64", (__SCMP_NR_BASE + 412) }, - { "utimes", (__SCMP_NR_BASE + 269) }, - { "vfork", (__SCMP_NR_BASE + 190) }, - { "vhangup", (__SCMP_NR_BASE + 111) }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (__SCMP_NR_BASE + 343) }, - { "vserver", (__SCMP_NR_BASE + 313) }, - { "wait4", (__SCMP_NR_BASE + 114) }, - { "waitid", (__SCMP_NR_BASE + 280) }, - { "waitpid", __PNR_waitpid }, - { "write", (__SCMP_NR_BASE + 4) }, - { "writev", (__SCMP_NR_BASE + 146) }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int arm_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = arm_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *arm_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = arm_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *arm_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &arm_syscall_table[spot]; -} diff --git a/src/arch-mips-syscalls.c b/src/arch-mips-syscalls.c deleted file mode 100644 index c0c5d409..00000000 --- a/src/arch-mips-syscalls.c +++ /dev/null @@ -1,562 +0,0 @@ -/** - * Enhanced Seccomp MIPS Specific Code - * - * Copyright (c) 2014 Imagination Technologies Ltd. - * Author: Markos Chandras - * - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-mips.h" - -/* O32 ABI */ -#define __SCMP_NR_BASE 4000 - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def mips_syscall_table[] = { \ - { "_llseek", (__SCMP_NR_BASE + 140) }, - { "_newselect", (__SCMP_NR_BASE + 142) }, - { "_sysctl", (__SCMP_NR_BASE + 153) }, - { "accept", (__SCMP_NR_BASE + 168) }, - { "accept4", (__SCMP_NR_BASE + 334) }, - { "access", (__SCMP_NR_BASE + 33) }, - { "acct", (__SCMP_NR_BASE + 51) }, - { "add_key", (__SCMP_NR_BASE + 280) }, - { "adjtimex", (__SCMP_NR_BASE + 124) }, - { "afs_syscall", __SCMP_NR_BASE + 137 }, - { "alarm", (__SCMP_NR_BASE + 27) }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", (__SCMP_NR_BASE + 134) }, - { "bind", (__SCMP_NR_BASE + 169) }, - { "bpf", (__SCMP_NR_BASE + 355) }, - { "break", __SCMP_NR_BASE + 17 }, - { "breakpoint", __PNR_breakpoint }, - { "brk", (__SCMP_NR_BASE + 45) }, - { "cachectl", (__SCMP_NR_BASE + 148) }, - { "cacheflush", (__SCMP_NR_BASE + 147) }, - { "capget", (__SCMP_NR_BASE + 204) }, - { "capset", (__SCMP_NR_BASE + 205) }, - { "chdir", (__SCMP_NR_BASE + 12) }, - { "chmod", (__SCMP_NR_BASE + 15) }, - { "chown", (__SCMP_NR_BASE + 202) }, - { "chown32", (__PNR_chown32) }, - { "chroot", (__SCMP_NR_BASE + 61) }, - { "clock_adjtime", (__SCMP_NR_BASE + 341) }, - { "clock_adjtime64", (__SCMP_NR_BASE + 405) }, - { "clock_getres", (__SCMP_NR_BASE + 264) }, - { "clock_getres_time64", (__SCMP_NR_BASE + 406) }, - { "clock_gettime", (__SCMP_NR_BASE + 263) }, - { "clock_gettime64", (__SCMP_NR_BASE + 403) }, - { "clock_nanosleep", (__SCMP_NR_BASE + 265) }, - { "clock_nanosleep_time64", (__SCMP_NR_BASE + 407) }, - { "clock_settime", (__SCMP_NR_BASE + 262) }, - { "clock_settime64", (__SCMP_NR_BASE + 404) }, - { "clone", (__SCMP_NR_BASE + 120) }, - { "clone3", (__SCMP_NR_BASE + 435) }, - { "close", (__SCMP_NR_BASE + 6) }, - { "connect", (__SCMP_NR_BASE + 170) }, - { "copy_file_range", (__SCMP_NR_BASE + 360) }, - { "creat", (__SCMP_NR_BASE + 8) }, - { "create_module", __SCMP_NR_BASE + 127 }, - { "delete_module", (__SCMP_NR_BASE + 129) }, - { "dup", (__SCMP_NR_BASE + 41) }, - { "dup2", (__SCMP_NR_BASE + 63) }, - { "dup3", (__SCMP_NR_BASE + 327) }, - { "epoll_create", (__SCMP_NR_BASE + 248) }, - { "epoll_create1", (__SCMP_NR_BASE + 326) }, - { "epoll_ctl", (__SCMP_NR_BASE + 249) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (__SCMP_NR_BASE + 313) }, - { "epoll_wait", (__SCMP_NR_BASE + 250) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (__SCMP_NR_BASE + 319) }, - { "eventfd2", (__SCMP_NR_BASE + 325) }, - { "execve", (__SCMP_NR_BASE + 11) }, - { "execveat", (__SCMP_NR_BASE + 356) }, - { "exit", (__SCMP_NR_BASE + 1) }, - { "exit_group", (__SCMP_NR_BASE + 246) }, - { "faccessat", (__SCMP_NR_BASE + 300) }, - { "fadvise64", __SCMP_NR_BASE + 254 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (__SCMP_NR_BASE + 320) }, - { "fanotify_init", (__SCMP_NR_BASE + 336) }, - { "fanotify_mark", (__SCMP_NR_BASE + 337) }, - { "fchdir", (__SCMP_NR_BASE + 133) }, - { "fchmod", (__SCMP_NR_BASE + 94) }, - { "fchmodat", (__SCMP_NR_BASE + 299) }, - { "fchown", (__SCMP_NR_BASE + 95) }, - { "fchown32", (__PNR_fchown32) }, - { "fchownat", (__SCMP_NR_BASE + 291) }, - { "fcntl", (__SCMP_NR_BASE + 55) }, - { "fcntl64", (__SCMP_NR_BASE + 220) }, - { "fdatasync", (__SCMP_NR_BASE + 152) }, - { "fgetxattr", (__SCMP_NR_BASE + 229) }, - { "finit_module", (__SCMP_NR_BASE + 348) }, - { "flistxattr", (__SCMP_NR_BASE + 232) }, - { "flock", (__SCMP_NR_BASE + 143) }, - { "fork", (__SCMP_NR_BASE + 2) }, - { "fremovexattr", (__SCMP_NR_BASE + 235) }, - { "fsconfig", (__SCMP_NR_BASE + 431) }, - { "fsetxattr", (__SCMP_NR_BASE + 226) }, - { "fsmount", (__SCMP_NR_BASE + 432) }, - { "fsopen", (__SCMP_NR_BASE + 430) }, - { "fspick", (__SCMP_NR_BASE + 433) }, - { "fstat", (__SCMP_NR_BASE + 108) }, - { "fstat64", (__SCMP_NR_BASE + 215) }, - { "fstatat64", (__SCMP_NR_BASE + 293) }, - { "fstatfs", (__SCMP_NR_BASE + 100) }, - { "fstatfs64", (__SCMP_NR_BASE + 256) }, - { "fsync", (__SCMP_NR_BASE + 118) }, - { "ftime", (__SCMP_NR_BASE + 35) }, - { "ftruncate", (__SCMP_NR_BASE + 93) }, - { "ftruncate64", (__SCMP_NR_BASE + 212) }, - { "futex", (__SCMP_NR_BASE + 238) }, - { "futex_time64", (__SCMP_NR_BASE + 422) }, - { "futimesat", (__SCMP_NR_BASE + 292) }, - { "get_kernel_syms", (__SCMP_NR_BASE + 130) }, - { "get_mempolicy", (__SCMP_NR_BASE + 269) }, - { "get_robust_list", (__SCMP_NR_BASE + 310) }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", (__SCMP_NR_BASE + 312) }, - { "getcwd", (__SCMP_NR_BASE + 203) }, - { "getdents", (__SCMP_NR_BASE + 141) }, - { "getdents64", (__SCMP_NR_BASE + 219) }, - { "getegid", (__SCMP_NR_BASE + 50) }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", (__SCMP_NR_BASE + 49) }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", (__SCMP_NR_BASE + 47) }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", (__SCMP_NR_BASE + 80) }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", (__SCMP_NR_BASE + 105) }, - { "getpeername", (__SCMP_NR_BASE + 171) }, - { "getpgid", (__SCMP_NR_BASE + 132) }, - { "getpgrp", (__SCMP_NR_BASE + 65) }, - { "getpid", (__SCMP_NR_BASE + 20) }, - { "getpmsg", (__SCMP_NR_BASE + 208) }, - { "getppid", (__SCMP_NR_BASE + 64) }, - { "getpriority", (__SCMP_NR_BASE + 96) }, - { "getrandom", (__SCMP_NR_BASE + 353) }, - { "getresgid", (__SCMP_NR_BASE + 191) }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", (__SCMP_NR_BASE + 186) }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", (__SCMP_NR_BASE + 76) }, - { "getrusage", (__SCMP_NR_BASE + 77) }, - { "getsid", (__SCMP_NR_BASE + 151) }, - { "getsockname", (__SCMP_NR_BASE + 172) }, - { "getsockopt", (__SCMP_NR_BASE + 173) }, - { "gettid", (__SCMP_NR_BASE + 222) }, - { "gettimeofday", (__SCMP_NR_BASE + 78) }, - { "getuid", (__SCMP_NR_BASE + 24) }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", (__SCMP_NR_BASE + 227) }, - { "gtty", (__SCMP_NR_BASE + 32) }, - { "idle", (__SCMP_NR_BASE + 112) }, - { "init_module", (__SCMP_NR_BASE + 128) }, - { "inotify_add_watch", (__SCMP_NR_BASE + 285) }, - { "inotify_init", (__SCMP_NR_BASE + 284) }, - { "inotify_init1", (__SCMP_NR_BASE + 329) }, - { "inotify_rm_watch", (__SCMP_NR_BASE + 286) }, - { "io_cancel", (__SCMP_NR_BASE + 245) }, - { "io_destroy", (__SCMP_NR_BASE + 242) }, - { "io_getevents", (__SCMP_NR_BASE + 243) }, - { "io_pgetevents", (__SCMP_NR_BASE + 368) }, - { "io_pgetevents_time64", (__SCMP_NR_BASE + 416) }, - { "io_setup", (__SCMP_NR_BASE + 241) }, - { "io_submit", (__SCMP_NR_BASE + 244) }, - { "io_uring_setup", (__SCMP_NR_BASE + 425) }, - { "io_uring_enter", (__SCMP_NR_BASE + 426) }, - { "io_uring_register", (__SCMP_NR_BASE + 427) }, - { "ioctl", (__SCMP_NR_BASE + 54) }, - { "ioperm", (__SCMP_NR_BASE + 101) }, - { "iopl", (__SCMP_NR_BASE + 110) }, - { "ioprio_get", (__SCMP_NR_BASE + 315) }, - { "ioprio_set", (__SCMP_NR_BASE + 314) }, - { "ipc", (__SCMP_NR_BASE + 117) }, - { "kcmp", (__SCMP_NR_BASE + 347) }, - { "kexec_file_load", __PNR_kexec_file_load }, - { "kexec_load", (__SCMP_NR_BASE + 311) }, - { "keyctl", (__SCMP_NR_BASE + 282) }, - { "kill", (__SCMP_NR_BASE + 37) }, - { "lchown", (__SCMP_NR_BASE + 16) }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", (__SCMP_NR_BASE + 228) }, - { "link", (__SCMP_NR_BASE + 9) }, - { "linkat", (__SCMP_NR_BASE + 296) }, - { "listen", (__SCMP_NR_BASE + 174) }, - { "listxattr", (__SCMP_NR_BASE + 230) }, - { "llistxattr", (__SCMP_NR_BASE + 231) }, - { "lock", (__SCMP_NR_BASE + 53) }, - { "lookup_dcookie", (__SCMP_NR_BASE + 247) }, - { "lremovexattr", (__SCMP_NR_BASE + 234) }, - { "lseek", (__SCMP_NR_BASE + 19) }, - { "lsetxattr", (__SCMP_NR_BASE + 225) }, - { "lstat", (__SCMP_NR_BASE + 107) }, - { "lstat64", (__SCMP_NR_BASE + 214) }, - { "madvise", (__SCMP_NR_BASE + 218) }, - { "mbind", (__SCMP_NR_BASE + 268) }, - { "membarrier", (__SCMP_NR_BASE + 358) }, - { "memfd_create", (__SCMP_NR_BASE + 354) }, - { "migrate_pages", (__SCMP_NR_BASE + 287) }, - { "mincore", (__SCMP_NR_BASE + 217) }, - { "mkdir", (__SCMP_NR_BASE + 39) }, - { "mkdirat", (__SCMP_NR_BASE + 289) }, - { "mknod", (__SCMP_NR_BASE + 14) }, - { "mknodat", (__SCMP_NR_BASE + 290) }, - { "mlock", (__SCMP_NR_BASE + 154) }, - { "mlock2", (__SCMP_NR_BASE + 359) }, - { "mlockall", (__SCMP_NR_BASE + 156) }, - { "mmap", (__SCMP_NR_BASE + 90) }, - { "mmap2", (__SCMP_NR_BASE + 210) }, - { "modify_ldt", (__SCMP_NR_BASE + 123) }, - { "mount", (__SCMP_NR_BASE + 21) }, - { "move_mount", (__SCMP_NR_BASE + 429) }, - { "move_pages", (__SCMP_NR_BASE + 308) }, - { "mprotect", (__SCMP_NR_BASE + 125) }, - { "mpx", (__SCMP_NR_BASE + 56) }, - { "mq_getsetattr", (__SCMP_NR_BASE + 276) }, - { "mq_notify", (__SCMP_NR_BASE + 275) }, - { "mq_open", (__SCMP_NR_BASE + 271) }, - { "mq_timedreceive", (__SCMP_NR_BASE + 274) }, - { "mq_timedreceive_time64", (__SCMP_NR_BASE + 419) }, - { "mq_timedsend", (__SCMP_NR_BASE + 273) }, - { "mq_timedsend_time64", (__SCMP_NR_BASE + 418) }, - { "mq_unlink", (__SCMP_NR_BASE + 272) }, - { "mremap", (__SCMP_NR_BASE + 167) }, - { "msgctl", (__SCMP_NR_BASE + 402) }, - { "msgget", (__SCMP_NR_BASE + 399) }, - { "msgrcv", (__SCMP_NR_BASE + 401) }, - { "msgsnd", (__SCMP_NR_BASE + 400) }, - { "msync", (__SCMP_NR_BASE + 144) }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", (__SCMP_NR_BASE + 155) }, - { "munlockall", (__SCMP_NR_BASE + 157) }, - { "munmap", (__SCMP_NR_BASE + 91) }, - { "name_to_handle_at", (__SCMP_NR_BASE + 339) }, - { "nanosleep", (__SCMP_NR_BASE + 166) }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", (__SCMP_NR_BASE + 189) }, - { "nice", (__SCMP_NR_BASE + 34) }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", (__SCMP_NR_BASE + 5) }, - { "open_by_handle_at", (__SCMP_NR_BASE + 340) }, - { "open_tree", (__SCMP_NR_BASE + 428) }, - { "openat", (__SCMP_NR_BASE + 288) }, - { "pause", (__SCMP_NR_BASE + 29) }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", (__SCMP_NR_BASE + 333) }, - { "personality", (__SCMP_NR_BASE + 136) }, - { "pidfd_open", (__SCMP_NR_BASE + 434) }, - { "pidfd_send_signal", (__SCMP_NR_BASE + 424) }, - { "pipe", (__SCMP_NR_BASE + 42) }, - { "pipe2", (__SCMP_NR_BASE + 328) }, - { "pivot_root", (__SCMP_NR_BASE + 216) }, - { "pkey_alloc", (__SCMP_NR_BASE + 364) }, - { "pkey_free", (__SCMP_NR_BASE + 365) }, - { "pkey_mprotect", (__SCMP_NR_BASE + 363) }, - { "poll", (__SCMP_NR_BASE + 188) }, - { "ppoll", (__SCMP_NR_BASE + 302) }, - { "ppoll_time64", (__SCMP_NR_BASE + 414) }, - { "prctl", (__SCMP_NR_BASE + 192) }, - { "pread64", (__SCMP_NR_BASE + 200) }, - { "preadv", (__SCMP_NR_BASE + 330) }, - { "preadv2", (__SCMP_NR_BASE + 361) }, - { "prlimit64", (__SCMP_NR_BASE + 338) }, - { "process_vm_readv", (__SCMP_NR_BASE + 345) }, - { "process_vm_writev", (__SCMP_NR_BASE + 346) }, - { "prof", (__SCMP_NR_BASE + 44) }, - { "profil", (__SCMP_NR_BASE + 98) }, - { "pselect6", (__SCMP_NR_BASE + 301) }, - { "pselect6_time64", (__SCMP_NR_BASE + 413) }, - { "ptrace", (__SCMP_NR_BASE + 26) }, - { "putpmsg", (__SCMP_NR_BASE + 209) }, - { "pwrite64", (__SCMP_NR_BASE + 201) }, - { "pwritev", (__SCMP_NR_BASE + 331) }, - { "pwritev2", (__SCMP_NR_BASE + 362) }, - { "query_module", (__SCMP_NR_BASE + 187) }, - { "quotactl", (__SCMP_NR_BASE + 131) }, - { "read", (__SCMP_NR_BASE + 3) }, - { "readahead", (__SCMP_NR_BASE + 223) }, - { "readdir", (__SCMP_NR_BASE + 89) }, - { "readlink", (__SCMP_NR_BASE + 85) }, - { "readlinkat", (__SCMP_NR_BASE + 298) }, - { "readv", (__SCMP_NR_BASE + 145) }, - { "reboot", (__SCMP_NR_BASE + 88) }, - { "recv", (__SCMP_NR_BASE + 175) }, - { "recvfrom", (__SCMP_NR_BASE + 176) }, - { "recvmmsg", (__SCMP_NR_BASE + 335) }, - { "recvmmsg_time64", (__SCMP_NR_BASE + 417) }, - { "recvmsg", (__SCMP_NR_BASE + 177) }, - { "remap_file_pages", (__SCMP_NR_BASE + 251) }, - { "removexattr", (__SCMP_NR_BASE + 233) }, - { "rename", (__SCMP_NR_BASE + 38) }, - { "renameat", (__SCMP_NR_BASE + 295) }, - { "renameat2", (__SCMP_NR_BASE + 351) }, - { "request_key", (__SCMP_NR_BASE + 281) }, - { "restart_syscall", (__SCMP_NR_BASE + 253) }, - { "rmdir", (__SCMP_NR_BASE + 40) }, - { "rseq", (__SCMP_NR_BASE + 367) }, - { "rt_sigaction", (__SCMP_NR_BASE + 194) }, - { "rt_sigpending", (__SCMP_NR_BASE + 196) }, - { "rt_sigprocmask", (__SCMP_NR_BASE + 195) }, - { "rt_sigqueueinfo", (__SCMP_NR_BASE + 198) }, - { "rt_sigreturn", (__SCMP_NR_BASE + 193) }, - { "rt_sigsuspend", (__SCMP_NR_BASE + 199) }, - { "rt_sigtimedwait", (__SCMP_NR_BASE + 197) }, - { "rt_sigtimedwait_time64", (__SCMP_NR_BASE + 421) }, - { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 332) }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", (__SCMP_NR_BASE + 163) }, - { "sched_get_priority_min", (__SCMP_NR_BASE + 164) }, - { "sched_getaffinity", (__SCMP_NR_BASE + 240) }, - { "sched_getattr", (__SCMP_NR_BASE + 350) }, - { "sched_getparam", (__SCMP_NR_BASE + 159) }, - { "sched_getscheduler", (__SCMP_NR_BASE + 161) }, - { "sched_rr_get_interval", (__SCMP_NR_BASE + 165) }, - { "sched_rr_get_interval_time64", (__SCMP_NR_BASE + 423) }, - { "sched_setaffinity", (__SCMP_NR_BASE + 239) }, - { "sched_setattr", (__SCMP_NR_BASE + 349) }, - { "sched_setparam", (__SCMP_NR_BASE + 158) }, - { "sched_setscheduler", (__SCMP_NR_BASE + 160) }, - { "sched_yield", (__SCMP_NR_BASE + 162) }, - { "seccomp", (__SCMP_NR_BASE + 352) }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", (__SCMP_NR_BASE + 394) }, - { "semget", (__SCMP_NR_BASE + 393) }, - { "semop", __PNR_semop }, - { "semtimedop", __PNR_semtimedop }, - { "semtimedop_time64", (__SCMP_NR_BASE + 420) }, - { "send", (__SCMP_NR_BASE + 178) }, - { "sendfile", (__SCMP_NR_BASE + 207) }, - { "sendfile64", (__SCMP_NR_BASE + 237) }, - { "sendmmsg", (__SCMP_NR_BASE + 343) }, - { "sendmsg", (__SCMP_NR_BASE + 179) }, - { "sendto", (__SCMP_NR_BASE + 180) }, - { "set_mempolicy", (__SCMP_NR_BASE + 270) }, - { "set_robust_list", (__SCMP_NR_BASE + 309) }, - { "set_thread_area", (__SCMP_NR_BASE + 283) }, - { "set_tid_address", (__SCMP_NR_BASE + 252) }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", (__SCMP_NR_BASE + 121) }, - { "setfsgid", (__SCMP_NR_BASE + 139) }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", (__SCMP_NR_BASE + 138) }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", (__SCMP_NR_BASE + 46) }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", (__SCMP_NR_BASE + 81) }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", (__SCMP_NR_BASE + 74) }, - { "setitimer", (__SCMP_NR_BASE + 104) }, - { "setns", (__SCMP_NR_BASE + 344) }, - { "setpgid", (__SCMP_NR_BASE + 57) }, - { "setpriority", (__SCMP_NR_BASE + 97) }, - { "setregid", (__SCMP_NR_BASE + 71) }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", (__SCMP_NR_BASE + 190) }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", (__SCMP_NR_BASE + 185) }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", (__SCMP_NR_BASE + 70) }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", (__SCMP_NR_BASE + 75) }, - { "setsid", (__SCMP_NR_BASE + 66) }, - { "setsockopt", (__SCMP_NR_BASE + 181) }, - { "settimeofday", (__SCMP_NR_BASE + 79) }, - { "setuid", (__SCMP_NR_BASE + 23) }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", (__SCMP_NR_BASE + 224) }, - { "sgetmask", (__SCMP_NR_BASE + 68) }, - { "shmat", (__SCMP_NR_BASE + 397) }, - { "shmctl", (__SCMP_NR_BASE + 396) }, - { "shmdt", (__SCMP_NR_BASE + 398) }, - { "shmget", (__SCMP_NR_BASE + 395) }, - { "shutdown", (__SCMP_NR_BASE + 182) }, - { "sigaction", (__SCMP_NR_BASE + 67) }, - { "sigaltstack", (__SCMP_NR_BASE + 206) }, - { "signal", (__SCMP_NR_BASE + 48) }, - { "signalfd", (__SCMP_NR_BASE + 317) }, - { "signalfd4", (__SCMP_NR_BASE + 324) }, - { "sigpending", (__SCMP_NR_BASE + 73) }, - { "sigprocmask", (__SCMP_NR_BASE + 126) }, - { "sigreturn", (__SCMP_NR_BASE + 119) }, - { "sigsuspend", (__SCMP_NR_BASE + 72) }, - { "socket", (__SCMP_NR_BASE + 183) }, - { "socketcall", (__SCMP_NR_BASE + 102) }, - { "socketpair", (__SCMP_NR_BASE + 184) }, - { "splice", (__SCMP_NR_BASE + 304) }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", (__SCMP_NR_BASE + 69) }, - { "stat", (__SCMP_NR_BASE + 106) }, - { "stat64", (__SCMP_NR_BASE + 213) }, - { "statfs", (__SCMP_NR_BASE + 99) }, - { "statfs64", (__SCMP_NR_BASE + 255) }, - { "statx", (__SCMP_NR_BASE + 366) }, - { "stime", (__SCMP_NR_BASE + 25) }, - { "stty", (__SCMP_NR_BASE + 31) }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", (__SCMP_NR_BASE + 115) }, - { "swapon", (__SCMP_NR_BASE + 87) }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", (__SCMP_NR_BASE + 83) }, - { "symlinkat", (__SCMP_NR_BASE + 297) }, - { "sync", (__SCMP_NR_BASE + 36) }, - { "sync_file_range", (__SCMP_NR_BASE + 305) }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", (__SCMP_NR_BASE + 342) }, - { "syscall", (__SCMP_NR_BASE + 0) }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", (__SCMP_NR_BASE + 135) }, - { "sysinfo", (__SCMP_NR_BASE + 116) }, - { "syslog", (__SCMP_NR_BASE + 103) }, - { "sysmips", (__SCMP_NR_BASE + 149) }, - { "tee", (__SCMP_NR_BASE + 306) }, - { "tgkill", (__SCMP_NR_BASE + 266) }, - { "time", (__SCMP_NR_BASE + 13) }, - { "timer_create", (__SCMP_NR_BASE + 257) }, - { "timer_delete", (__SCMP_NR_BASE + 261) }, - { "timer_getoverrun", (__SCMP_NR_BASE + 260) }, - { "timer_gettime", (__SCMP_NR_BASE + 259) }, - { "timer_gettime64", (__SCMP_NR_BASE + 408) }, - { "timer_settime", (__SCMP_NR_BASE + 258) }, - { "timer_settime64", (__SCMP_NR_BASE + 409) }, - { "timerfd", (__SCMP_NR_BASE + 318) }, - { "timerfd_create", (__SCMP_NR_BASE + 321) }, - { "timerfd_gettime", (__SCMP_NR_BASE + 322) }, - { "timerfd_gettime64", (__SCMP_NR_BASE + 410) }, - { "timerfd_settime", (__SCMP_NR_BASE + 323) }, - { "timerfd_settime64", (__SCMP_NR_BASE + 411) }, - { "times", (__SCMP_NR_BASE + 43) }, - { "tkill", (__SCMP_NR_BASE + 236) }, - { "truncate", (__SCMP_NR_BASE + 92) }, - { "truncate64", (__SCMP_NR_BASE + 211) }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", (__SCMP_NR_BASE + 58) }, - { "umask", (__SCMP_NR_BASE + 60) }, - { "umount", (__SCMP_NR_BASE + 22) }, - { "umount2", (__SCMP_NR_BASE + 52) }, - { "uname", (__SCMP_NR_BASE + 122) }, - { "unlink", (__SCMP_NR_BASE + 10) }, - { "unlinkat", (__SCMP_NR_BASE + 294) }, - { "unshare", (__SCMP_NR_BASE + 303) }, - { "uselib", (__SCMP_NR_BASE + 86) }, - { "userfaultfd", (__SCMP_NR_BASE + 357) }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", (__SCMP_NR_BASE + 62) }, - { "utime", (__SCMP_NR_BASE + 30) }, - { "utimensat", (__SCMP_NR_BASE + 316) }, - { "utimensat_time64", (__SCMP_NR_BASE + 412) }, - { "utimes", (__SCMP_NR_BASE + 267) }, - { "vfork", __PNR_vfork }, - { "vhangup", (__SCMP_NR_BASE + 111) }, - { "vm86", (__SCMP_NR_BASE + 113) }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (__SCMP_NR_BASE + 307) }, - { "vserver", (__SCMP_NR_BASE + 277) }, - { "wait4", (__SCMP_NR_BASE + 114) }, - { "waitid", (__SCMP_NR_BASE + 278) }, - { "waitpid", (__SCMP_NR_BASE + 7) }, - { "write", (__SCMP_NR_BASE + 4) }, - { "writev", (__SCMP_NR_BASE + 146) }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int mips_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *mips_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *mips_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &mips_syscall_table[spot]; -} diff --git a/src/arch-mips64-syscalls.c b/src/arch-mips64-syscalls.c deleted file mode 100644 index af23ff4c..00000000 --- a/src/arch-mips64-syscalls.c +++ /dev/null @@ -1,562 +0,0 @@ -/** - * Enhanced Seccomp MIPS64 Specific Code - * - * Copyright (c) 2014 Red Hat - * Author: Paul Moore - * - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-mips64.h" - -/* 64 ABI */ -#define __SCMP_NR_BASE 5000 - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def mips64_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", (__SCMP_NR_BASE + 22) }, - { "_sysctl", (__SCMP_NR_BASE + 152) }, - { "accept", (__SCMP_NR_BASE + 42) }, - { "accept4", (__SCMP_NR_BASE + 293) }, - { "access", (__SCMP_NR_BASE + 20) }, - { "acct", (__SCMP_NR_BASE + 158) }, - { "add_key", (__SCMP_NR_BASE + 239) }, - { "adjtimex", (__SCMP_NR_BASE + 154) }, - { "afs_syscall", (__SCMP_NR_BASE + 176) }, - { "alarm", (__SCMP_NR_BASE + 37) }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", __PNR_bdflush }, - { "bind", (__SCMP_NR_BASE + 48) }, - { "bpf", (__SCMP_NR_BASE + 315) }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", (__SCMP_NR_BASE + 12) }, - { "cachectl", (__SCMP_NR_BASE + 198) }, - { "cacheflush", (__SCMP_NR_BASE + 197) }, - { "capget", (__SCMP_NR_BASE + 123) }, - { "capset", (__SCMP_NR_BASE + 124) }, - { "chdir", (__SCMP_NR_BASE + 78) }, - { "chmod", (__SCMP_NR_BASE + 88) }, - { "chown", (__SCMP_NR_BASE + 90) }, - { "chown32", __PNR_chown32 }, - { "chroot", (__SCMP_NR_BASE + 156) }, - { "clock_adjtime", (__SCMP_NR_BASE + 300) }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", (__SCMP_NR_BASE + 223) }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", (__SCMP_NR_BASE + 222) }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", (__SCMP_NR_BASE + 224) }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", (__SCMP_NR_BASE + 221) }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", (__SCMP_NR_BASE + 55) }, - { "clone3", (__SCMP_NR_BASE + 435) }, - { "close", (__SCMP_NR_BASE + 3) }, - { "connect", (__SCMP_NR_BASE + 41) }, - { "copy_file_range", (__SCMP_NR_BASE + 320) }, - { "creat", (__SCMP_NR_BASE + 83) }, - { "create_module", (__SCMP_NR_BASE + 167) }, - { "delete_module", (__SCMP_NR_BASE + 169) }, - { "dup", (__SCMP_NR_BASE + 31) }, - { "dup2", (__SCMP_NR_BASE + 32) }, - { "dup3", (__SCMP_NR_BASE + 286) }, - { "epoll_create", (__SCMP_NR_BASE + 207) }, - { "epoll_create1", (__SCMP_NR_BASE + 285) }, - { "epoll_ctl", (__SCMP_NR_BASE + 208) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (__SCMP_NR_BASE + 272) }, - { "epoll_wait", (__SCMP_NR_BASE + 209) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (__SCMP_NR_BASE + 278) }, - { "eventfd2", (__SCMP_NR_BASE + 284) }, - { "execve", (__SCMP_NR_BASE + 57) }, - { "execveat", (__SCMP_NR_BASE + 316) }, - { "exit", (__SCMP_NR_BASE + 58) }, - { "exit_group", (__SCMP_NR_BASE + 205) }, - { "faccessat", (__SCMP_NR_BASE + 259) }, - { "fadvise64", (__SCMP_NR_BASE + 215) }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (__SCMP_NR_BASE + 279) }, - { "fanotify_init", (__SCMP_NR_BASE + 295) }, - { "fanotify_mark", (__SCMP_NR_BASE + 296) }, - { "fchdir", (__SCMP_NR_BASE + 79) }, - { "fchmod", (__SCMP_NR_BASE + 89) }, - { "fchmodat", (__SCMP_NR_BASE + 258) }, - { "fchown", (__SCMP_NR_BASE + 91) }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", (__SCMP_NR_BASE + 250) }, - { "fcntl", (__SCMP_NR_BASE + 70) }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", (__SCMP_NR_BASE + 73) }, - { "fgetxattr", (__SCMP_NR_BASE + 185) }, - { "finit_module", (__SCMP_NR_BASE + 307) }, - { "flistxattr", (__SCMP_NR_BASE + 188) }, - { "flock", (__SCMP_NR_BASE + 71) }, - { "fork", (__SCMP_NR_BASE + 56) }, - { "fremovexattr", (__SCMP_NR_BASE + 191) }, - { "fsconfig", (__SCMP_NR_BASE + 431) }, - { "fsetxattr", (__SCMP_NR_BASE + 182) }, - { "fsmount", (__SCMP_NR_BASE + 432) }, - { "fsopen", (__SCMP_NR_BASE + 430) }, - { "fspick", (__SCMP_NR_BASE + 433) }, - { "fstat", (__SCMP_NR_BASE + 5) }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstat64 }, - { "fstatfs", (__SCMP_NR_BASE + 135) }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", (__SCMP_NR_BASE + 72) }, - { "ftime", __PNR_ftime }, - { "ftruncate", (__SCMP_NR_BASE + 75) }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", (__SCMP_NR_BASE + 194) }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", (__SCMP_NR_BASE + 251) }, - { "get_kernel_syms", (__SCMP_NR_BASE + 170) }, - { "get_mempolicy", (__SCMP_NR_BASE + 228) }, - { "get_robust_list", (__SCMP_NR_BASE + 269) }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", (__SCMP_NR_BASE + 271) }, - { "getcwd", (__SCMP_NR_BASE + 77) }, - { "getdents", (__SCMP_NR_BASE + 76) }, - { "getdents64", (__SCMP_NR_BASE + 308) }, - { "getegid", (__SCMP_NR_BASE + 106) }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", (__SCMP_NR_BASE + 105) }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", (__SCMP_NR_BASE + 102) }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", (__SCMP_NR_BASE + 113) }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", (__SCMP_NR_BASE + 35) }, - { "getpeername", (__SCMP_NR_BASE + 51) }, - { "getpgid", (__SCMP_NR_BASE + 119) }, - { "getpgrp", (__SCMP_NR_BASE + 109) }, - { "getpid", (__SCMP_NR_BASE + 38) }, - { "getpmsg", (__SCMP_NR_BASE + 174) }, - { "getppid", (__SCMP_NR_BASE + 108) }, - { "getpriority", (__SCMP_NR_BASE + 137) }, - { "getrandom", (__SCMP_NR_BASE + 313) }, - { "getresgid", (__SCMP_NR_BASE + 118) }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", (__SCMP_NR_BASE + 116) }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", (__SCMP_NR_BASE + 95) }, - { "getrusage", (__SCMP_NR_BASE + 96) }, - { "getsid", (__SCMP_NR_BASE + 122) }, - { "getsockname", (__SCMP_NR_BASE + 50) }, - { "getsockopt", (__SCMP_NR_BASE + 54) }, - { "gettid", (__SCMP_NR_BASE + 178) }, - { "gettimeofday", (__SCMP_NR_BASE + 94) }, - { "getuid", (__SCMP_NR_BASE + 100) }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", (__SCMP_NR_BASE + 183) }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", (__SCMP_NR_BASE + 168) }, - { "inotify_add_watch", (__SCMP_NR_BASE + 244) }, - { "inotify_init", (__SCMP_NR_BASE + 243) }, - { "inotify_init1", (__SCMP_NR_BASE + 288) }, - { "inotify_rm_watch", (__SCMP_NR_BASE + 245) }, - { "io_cancel", (__SCMP_NR_BASE + 204) }, - { "io_destroy", (__SCMP_NR_BASE + 201) }, - { "io_getevents", (__SCMP_NR_BASE + 202) }, - { "io_pgetevents", (__SCMP_NR_BASE + 328) }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", (__SCMP_NR_BASE + 200) }, - { "io_submit", (__SCMP_NR_BASE + 203) }, - { "io_uring_setup", (__SCMP_NR_BASE + 425) }, - { "io_uring_enter", (__SCMP_NR_BASE + 426) }, - { "io_uring_register", (__SCMP_NR_BASE + 427) }, - { "ioctl", (__SCMP_NR_BASE + 15) }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", (__SCMP_NR_BASE + 274) }, - { "ioprio_set", (__SCMP_NR_BASE + 273) }, - { "ipc", __PNR_ipc }, - { "kcmp", (__SCMP_NR_BASE + 306) }, - { "kexec_file_load", __PNR_kexec_file_load }, - { "kexec_load", (__SCMP_NR_BASE + 270) }, - { "keyctl", (__SCMP_NR_BASE + 241) }, - { "kill", (__SCMP_NR_BASE + 60) }, - { "lchown", (__SCMP_NR_BASE + 92) }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", (__SCMP_NR_BASE + 184) }, - { "link", (__SCMP_NR_BASE + 84) }, - { "linkat", (__SCMP_NR_BASE + 255) }, - { "listen", (__SCMP_NR_BASE + 49) }, - { "listxattr", (__SCMP_NR_BASE + 186) }, - { "llistxattr", (__SCMP_NR_BASE + 187) }, - { "lock", __PNR_lock }, - { "lookup_dcookie", (__SCMP_NR_BASE + 206) }, - { "lremovexattr", (__SCMP_NR_BASE + 190) }, - { "lseek", (__SCMP_NR_BASE + 8) }, - { "lsetxattr", (__SCMP_NR_BASE + 181) }, - { "lstat", (__SCMP_NR_BASE + 6) }, - { "lstat64", __PNR_lstat64 }, - { "madvise", (__SCMP_NR_BASE + 27) }, - { "mbind", (__SCMP_NR_BASE + 227) }, - { "membarrier", (__SCMP_NR_BASE + 318) }, - { "memfd_create", (__SCMP_NR_BASE + 314) }, - { "migrate_pages", (__SCMP_NR_BASE + 246) }, - { "mincore", (__SCMP_NR_BASE + 26) }, - { "mkdir", (__SCMP_NR_BASE + 81) }, - { "mkdirat", (__SCMP_NR_BASE + 248) }, - { "mknod", (__SCMP_NR_BASE + 131) }, - { "mknodat", (__SCMP_NR_BASE + 249) }, - { "mlock", (__SCMP_NR_BASE + 146) }, - { "mlock2", (__SCMP_NR_BASE + 319) }, - { "mlockall", (__SCMP_NR_BASE + 148) }, - { "mmap", (__SCMP_NR_BASE + 9) }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", (__SCMP_NR_BASE + 160) }, - { "move_mount", (__SCMP_NR_BASE + 429) }, - { "move_pages", (__SCMP_NR_BASE + 267) }, - { "mprotect", (__SCMP_NR_BASE + 10) }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", (__SCMP_NR_BASE + 235) }, - { "mq_notify", (__SCMP_NR_BASE + 234) }, - { "mq_open", (__SCMP_NR_BASE + 230) }, - { "mq_timedreceive", (__SCMP_NR_BASE + 233) }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", (__SCMP_NR_BASE + 232) }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", (__SCMP_NR_BASE + 231) }, - { "mremap", (__SCMP_NR_BASE + 24) }, - { "msgctl", (__SCMP_NR_BASE + 69) }, - { "msgget", (__SCMP_NR_BASE + 66) }, - { "msgrcv", (__SCMP_NR_BASE + 68) }, - { "msgsnd", (__SCMP_NR_BASE + 67) }, - { "msync", (__SCMP_NR_BASE + 25) }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", (__SCMP_NR_BASE + 147) }, - { "munlockall", (__SCMP_NR_BASE + 149) }, - { "munmap", (__SCMP_NR_BASE + 11) }, - { "name_to_handle_at", (__SCMP_NR_BASE + 298) }, - { "nanosleep", (__SCMP_NR_BASE + 34) }, - { "newfstatat", (__SCMP_NR_BASE + 252) }, - { "nfsservctl", (__SCMP_NR_BASE + 173) }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", (__SCMP_NR_BASE + 2) }, - { "open_by_handle_at", (__SCMP_NR_BASE + 299) }, - { "open_tree", (__SCMP_NR_BASE + 428) }, - { "openat", (__SCMP_NR_BASE + 247) }, - { "pause", (__SCMP_NR_BASE + 33) }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", (__SCMP_NR_BASE + 292) }, - { "personality", (__SCMP_NR_BASE + 132) }, - { "pidfd_open", (__SCMP_NR_BASE + 434) }, - { "pidfd_send_signal", (__SCMP_NR_BASE + 424) }, - { "pipe", (__SCMP_NR_BASE + 21) }, - { "pipe2", (__SCMP_NR_BASE + 287) }, - { "pivot_root", (__SCMP_NR_BASE + 151) }, - { "pkey_alloc", (__SCMP_NR_BASE + 324) }, - { "pkey_free", (__SCMP_NR_BASE + 325) }, - { "pkey_mprotect", (__SCMP_NR_BASE + 323) }, - { "poll", (__SCMP_NR_BASE + 7) }, - { "ppoll", (__SCMP_NR_BASE + 261) }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", (__SCMP_NR_BASE + 153) }, - { "pread64", (__SCMP_NR_BASE + 16) }, - { "preadv", (__SCMP_NR_BASE + 289) }, - { "preadv2", (__SCMP_NR_BASE + 321) }, - { "prlimit64", (__SCMP_NR_BASE + 297) }, - { "process_vm_readv", (__SCMP_NR_BASE + 304) }, - { "process_vm_writev", (__SCMP_NR_BASE + 305) }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", (__SCMP_NR_BASE + 260) }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", (__SCMP_NR_BASE + 99) }, - { "putpmsg", (__SCMP_NR_BASE + 175) }, - { "pwrite64", (__SCMP_NR_BASE + 17) }, - { "pwritev", (__SCMP_NR_BASE + 290) }, - { "pwritev2", (__SCMP_NR_BASE + 322) }, - { "query_module", (__SCMP_NR_BASE + 171) }, - { "quotactl", (__SCMP_NR_BASE + 172) }, - { "read", (__SCMP_NR_BASE + 0) }, - { "readahead", (__SCMP_NR_BASE + 179) }, - { "readdir", __PNR_readdir }, - { "readlink", (__SCMP_NR_BASE + 87) }, - { "readlinkat", (__SCMP_NR_BASE + 257) }, - { "readv", (__SCMP_NR_BASE + 18) }, - { "reboot", (__SCMP_NR_BASE + 164) }, - { "recv", __PNR_recv }, - { "recvfrom", (__SCMP_NR_BASE + 44) }, - { "recvmmsg", (__SCMP_NR_BASE + 294) }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", (__SCMP_NR_BASE + 46) }, - { "remap_file_pages", (__SCMP_NR_BASE + 210) }, - { "removexattr", (__SCMP_NR_BASE + 189) }, - { "rename", (__SCMP_NR_BASE + 80) }, - { "renameat", (__SCMP_NR_BASE + 254) }, - { "renameat2", (__SCMP_NR_BASE + 311) }, - { "request_key", (__SCMP_NR_BASE + 240) }, - { "restart_syscall", (__SCMP_NR_BASE + 213) }, - { "rmdir", (__SCMP_NR_BASE + 82) }, - { "rseq", (__SCMP_NR_BASE + 327) }, - { "rt_sigaction", (__SCMP_NR_BASE + 13) }, - { "rt_sigpending", (__SCMP_NR_BASE + 125) }, - { "rt_sigprocmask", (__SCMP_NR_BASE + 14) }, - { "rt_sigqueueinfo", (__SCMP_NR_BASE + 127) }, - { "rt_sigreturn", (__SCMP_NR_BASE + 211) }, - { "rt_sigsuspend", (__SCMP_NR_BASE + 128) }, - { "rt_sigtimedwait", (__SCMP_NR_BASE + 126) }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 291) }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", (__SCMP_NR_BASE + 143) }, - { "sched_get_priority_min", (__SCMP_NR_BASE + 144) }, - { "sched_getaffinity", (__SCMP_NR_BASE + 196) }, - { "sched_getattr", (__SCMP_NR_BASE + 310) }, - { "sched_getparam", (__SCMP_NR_BASE + 140) }, - { "sched_getscheduler", (__SCMP_NR_BASE + 142) }, - { "sched_rr_get_interval", (__SCMP_NR_BASE + 145) }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", (__SCMP_NR_BASE + 195) }, - { "sched_setattr", (__SCMP_NR_BASE + 309) }, - { "sched_setparam", (__SCMP_NR_BASE + 139) }, - { "sched_setscheduler", (__SCMP_NR_BASE + 141) }, - { "sched_yield", (__SCMP_NR_BASE + 23) }, - { "seccomp", (__SCMP_NR_BASE + 312) }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", (__SCMP_NR_BASE + 64) }, - { "semget", (__SCMP_NR_BASE + 62) }, - { "semop", (__SCMP_NR_BASE + 63) }, - { "semtimedop", (__SCMP_NR_BASE + 214) }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", (__SCMP_NR_BASE + 39) }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", (__SCMP_NR_BASE + 302) }, - { "sendmsg", (__SCMP_NR_BASE + 45) }, - { "sendto", (__SCMP_NR_BASE + 43) }, - { "set_mempolicy", (__SCMP_NR_BASE + 229) }, - { "set_robust_list", (__SCMP_NR_BASE + 268) }, - { "set_thread_area", (__SCMP_NR_BASE + 242) }, - { "set_tid_address", (__SCMP_NR_BASE + 212) }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", (__SCMP_NR_BASE + 166) }, - { "setfsgid", (__SCMP_NR_BASE + 121) }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", (__SCMP_NR_BASE + 120) }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", (__SCMP_NR_BASE + 104) }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", (__SCMP_NR_BASE + 114) }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", (__SCMP_NR_BASE + 165) }, - { "setitimer", (__SCMP_NR_BASE + 36) }, - { "setns", (__SCMP_NR_BASE + 303) }, - { "setpgid", (__SCMP_NR_BASE + 107) }, - { "setpriority", (__SCMP_NR_BASE + 138) }, - { "setregid", (__SCMP_NR_BASE + 112) }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", (__SCMP_NR_BASE + 117) }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", (__SCMP_NR_BASE + 115) }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", (__SCMP_NR_BASE + 111) }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", (__SCMP_NR_BASE + 155) }, - { "setsid", (__SCMP_NR_BASE + 110) }, - { "setsockopt", (__SCMP_NR_BASE + 53) }, - { "settimeofday", (__SCMP_NR_BASE + 159) }, - { "setuid", (__SCMP_NR_BASE + 103) }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", (__SCMP_NR_BASE + 180) }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", (__SCMP_NR_BASE + 29) }, - { "shmctl", (__SCMP_NR_BASE + 30) }, - { "shmdt", (__SCMP_NR_BASE + 65) }, - { "shmget", (__SCMP_NR_BASE + 28) }, - { "shutdown", (__SCMP_NR_BASE + 47) }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", (__SCMP_NR_BASE + 129) }, - { "signal", __PNR_signal }, - { "signalfd", (__SCMP_NR_BASE + 276) }, - { "signalfd4", (__SCMP_NR_BASE + 283) }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", (__SCMP_NR_BASE + 40) }, - { "socketcall", __PNR_socketcall }, - { "socketpair", (__SCMP_NR_BASE + 52) }, - { "splice", (__SCMP_NR_BASE + 263) }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", (__SCMP_NR_BASE + 4) }, - { "stat64", __PNR_stat64 }, - { "statfs", (__SCMP_NR_BASE + 134) }, - { "statfs64", __PNR_statfs64 }, - { "statx", (__SCMP_NR_BASE + 326) }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", (__SCMP_NR_BASE + 163) }, - { "swapon", (__SCMP_NR_BASE + 162) }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", (__SCMP_NR_BASE + 86) }, - { "symlinkat", (__SCMP_NR_BASE + 256) }, - { "sync", (__SCMP_NR_BASE + 157) }, - { "sync_file_range", (__SCMP_NR_BASE + 264) }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", (__SCMP_NR_BASE + 301) }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", (__SCMP_NR_BASE + 136) }, - { "sysinfo", (__SCMP_NR_BASE + 97) }, - { "syslog", (__SCMP_NR_BASE + 101) }, - { "sysmips", (__SCMP_NR_BASE + 199) }, - { "tee", (__SCMP_NR_BASE + 265) }, - { "tgkill", (__SCMP_NR_BASE + 225) }, - { "time", __PNR_time }, - { "timer_create", (__SCMP_NR_BASE + 216) }, - { "timer_delete", (__SCMP_NR_BASE + 220) }, - { "timer_getoverrun", (__SCMP_NR_BASE + 219) }, - { "timer_gettime", (__SCMP_NR_BASE + 218) }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", (__SCMP_NR_BASE + 217) }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", (__SCMP_NR_BASE + 277) }, - { "timerfd_create", (__SCMP_NR_BASE + 280) }, - { "timerfd_gettime", (__SCMP_NR_BASE + 281) }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", (__SCMP_NR_BASE + 282) }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", (__SCMP_NR_BASE + 98) }, - { "tkill", (__SCMP_NR_BASE + 192) }, - { "truncate", (__SCMP_NR_BASE + 74) }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", (__SCMP_NR_BASE + 93) }, - { "umount", __PNR_umount }, - { "umount2", (__SCMP_NR_BASE + 161) }, - { "uname", (__SCMP_NR_BASE + 61) }, - { "unlink", (__SCMP_NR_BASE + 85) }, - { "unlinkat", (__SCMP_NR_BASE + 253) }, - { "unshare", (__SCMP_NR_BASE + 262) }, - { "uselib", __PNR_uselib }, - { "userfaultfd", (__SCMP_NR_BASE + 317) }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", (__SCMP_NR_BASE + 133) }, - { "utime", (__SCMP_NR_BASE + 130) }, - { "utimensat", (__SCMP_NR_BASE + 275) }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", (__SCMP_NR_BASE + 226) }, - { "vfork", __PNR_vfork }, - { "vhangup", (__SCMP_NR_BASE + 150) }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (__SCMP_NR_BASE + 266) }, - { "vserver", (__SCMP_NR_BASE + 236) }, - { "wait4", (__SCMP_NR_BASE + 59) }, - { "waitid", (__SCMP_NR_BASE + 237) }, - { "waitpid", __PNR_waitpid }, - { "write", (__SCMP_NR_BASE + 1) }, - { "writev", (__SCMP_NR_BASE + 19) }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int mips64_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *mips64_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *mips64_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &mips64_syscall_table[spot]; -} diff --git a/src/arch-mips64n32-syscalls.c b/src/arch-mips64n32-syscalls.c deleted file mode 100644 index 2159bccc..00000000 --- a/src/arch-mips64n32-syscalls.c +++ /dev/null @@ -1,562 +0,0 @@ -/** - * Enhanced Seccomp MIPS Specific Code - * - * Copyright (c) 2014 Red Hat - * Author: Paul Moore - * - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-mips64n32.h" - -/* N32 ABI */ -#define __SCMP_NR_BASE 6000 - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def mips64n32_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", (__SCMP_NR_BASE + 22) }, - { "_sysctl", (__SCMP_NR_BASE + 152) }, - { "accept", (__SCMP_NR_BASE + 42) }, - { "accept4", (__SCMP_NR_BASE + 297) }, - { "access", (__SCMP_NR_BASE + 20) }, - { "acct", (__SCMP_NR_BASE + 158) }, - { "add_key", (__SCMP_NR_BASE + 243) }, - { "adjtimex", (__SCMP_NR_BASE + 154) }, - { "afs_syscall", (__SCMP_NR_BASE + 176) }, - { "alarm", (__SCMP_NR_BASE + 37) }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", __PNR_bdflush }, - { "bind", (__SCMP_NR_BASE + 48) }, - { "bpf", (__SCMP_NR_BASE + 319) }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", (__SCMP_NR_BASE + 12) }, - { "cachectl", (__SCMP_NR_BASE + 198) }, - { "cacheflush", (__SCMP_NR_BASE + 197) }, - { "capget", (__SCMP_NR_BASE + 123) }, - { "capset", (__SCMP_NR_BASE + 124) }, - { "chdir", (__SCMP_NR_BASE + 78) }, - { "chmod", (__SCMP_NR_BASE + 88) }, - { "chown", (__SCMP_NR_BASE + 90) }, - { "chown32", __PNR_chown32 }, - { "chroot", (__SCMP_NR_BASE + 156) }, - { "clock_adjtime", (__SCMP_NR_BASE + 305) }, - { "clock_adjtime64", (__SCMP_NR_BASE + 405) }, - { "clock_getres", (__SCMP_NR_BASE + 227) }, - { "clock_getres_time64", (__SCMP_NR_BASE + 406) }, - { "clock_gettime", (__SCMP_NR_BASE + 226) }, - { "clock_gettime64", (__SCMP_NR_BASE + 403) }, - { "clock_nanosleep", (__SCMP_NR_BASE + 228) }, - { "clock_nanosleep_time64", (__SCMP_NR_BASE + 407) }, - { "clock_settime", (__SCMP_NR_BASE + 225) }, - { "clock_settime64", (__SCMP_NR_BASE + 404) }, - { "clone", (__SCMP_NR_BASE + 55) }, - { "clone3", (__SCMP_NR_BASE + 435) }, - { "close", (__SCMP_NR_BASE + 3) }, - { "connect", (__SCMP_NR_BASE + 41) }, - { "copy_file_range", (__SCMP_NR_BASE + 324) }, - { "creat", (__SCMP_NR_BASE + 83) }, - { "create_module", (__SCMP_NR_BASE + 167) }, - { "delete_module", (__SCMP_NR_BASE + 169) }, - { "dup", (__SCMP_NR_BASE + 31) }, - { "dup2", (__SCMP_NR_BASE + 32) }, - { "dup3", (__SCMP_NR_BASE + 290) }, - { "epoll_create", (__SCMP_NR_BASE + 207) }, - { "epoll_create1", (__SCMP_NR_BASE + 289) }, - { "epoll_ctl", (__SCMP_NR_BASE + 208) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (__SCMP_NR_BASE + 276) }, - { "epoll_wait", (__SCMP_NR_BASE + 209) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (__SCMP_NR_BASE + 282) }, - { "eventfd2", (__SCMP_NR_BASE + 288) }, - { "execve", (__SCMP_NR_BASE + 57) }, - { "execveat", (__SCMP_NR_BASE + 320) }, - { "exit", (__SCMP_NR_BASE + 58) }, - { "exit_group", (__SCMP_NR_BASE + 205) }, - { "faccessat", (__SCMP_NR_BASE + 263) }, - { "fadvise64", (__SCMP_NR_BASE + 216) }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (__SCMP_NR_BASE + 283) }, - { "fanotify_init", (__SCMP_NR_BASE + 300) }, - { "fanotify_mark", (__SCMP_NR_BASE + 301) }, - { "fchdir", (__SCMP_NR_BASE + 79) }, - { "fchmod", (__SCMP_NR_BASE + 89) }, - { "fchmodat", (__SCMP_NR_BASE + 262) }, - { "fchown", (__SCMP_NR_BASE + 91) }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", (__SCMP_NR_BASE + 254) }, - { "fcntl", (__SCMP_NR_BASE + 70) }, - { "fcntl64", (__SCMP_NR_BASE + 212) }, - { "fdatasync", (__SCMP_NR_BASE + 73) }, - { "fgetxattr", (__SCMP_NR_BASE + 185) }, - { "finit_module", (__SCMP_NR_BASE + 312) }, - { "flistxattr", (__SCMP_NR_BASE + 188) }, - { "flock", (__SCMP_NR_BASE + 71) }, - { "fork", (__SCMP_NR_BASE + 56) }, - { "fremovexattr", (__SCMP_NR_BASE + 191) }, - { "fsconfig", (__SCMP_NR_BASE + 431) }, - { "fsetxattr", (__SCMP_NR_BASE + 182) }, - { "fsmount", (__SCMP_NR_BASE + 432) }, - { "fsopen", (__SCMP_NR_BASE + 430) }, - { "fspick", (__SCMP_NR_BASE + 433) }, - { "fstat", (__SCMP_NR_BASE + 5) }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstat64 }, - { "fstatfs", (__SCMP_NR_BASE + 135) }, - { "fstatfs64", (__SCMP_NR_BASE + 218) }, - { "fsync", (__SCMP_NR_BASE + 72) }, - { "ftime", __PNR_ftime }, - { "ftruncate", (__SCMP_NR_BASE + 75) }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", (__SCMP_NR_BASE + 194) }, - { "futex_time64", (__SCMP_NR_BASE + 422) }, - { "futimesat", (__SCMP_NR_BASE + 255) }, - { "get_kernel_syms", (__SCMP_NR_BASE + 170) }, - { "get_mempolicy", (__SCMP_NR_BASE + 232) }, - { "get_robust_list", (__SCMP_NR_BASE + 273) }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", (__SCMP_NR_BASE + 275) }, - { "getcwd", (__SCMP_NR_BASE + 77) }, - { "getdents", (__SCMP_NR_BASE + 76) }, - { "getdents64", (__SCMP_NR_BASE + 299) }, - { "getegid", (__SCMP_NR_BASE + 106) }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", (__SCMP_NR_BASE + 105) }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", (__SCMP_NR_BASE + 102) }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", (__SCMP_NR_BASE + 113) }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", (__SCMP_NR_BASE + 35) }, - { "getpeername", (__SCMP_NR_BASE + 51) }, - { "getpgid", (__SCMP_NR_BASE + 119) }, - { "getpgrp", (__SCMP_NR_BASE + 109) }, - { "getpid", (__SCMP_NR_BASE + 38) }, - { "getpmsg", (__SCMP_NR_BASE + 174) }, - { "getppid", (__SCMP_NR_BASE + 108) }, - { "getpriority", (__SCMP_NR_BASE + 137) }, - { "getrandom", (__SCMP_NR_BASE + 317) }, - { "getresgid", (__SCMP_NR_BASE + 118) }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", (__SCMP_NR_BASE + 116) }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", (__SCMP_NR_BASE + 95) }, - { "getrusage", (__SCMP_NR_BASE + 96) }, - { "getsid", (__SCMP_NR_BASE + 122) }, - { "getsockname", (__SCMP_NR_BASE + 50) }, - { "getsockopt", (__SCMP_NR_BASE + 54) }, - { "gettid", (__SCMP_NR_BASE + 178) }, - { "gettimeofday", (__SCMP_NR_BASE + 94) }, - { "getuid", (__SCMP_NR_BASE + 100) }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", (__SCMP_NR_BASE + 183) }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", (__SCMP_NR_BASE + 168) }, - { "inotify_add_watch", (__SCMP_NR_BASE + 248) }, - { "inotify_init", (__SCMP_NR_BASE + 247) }, - { "inotify_init1", (__SCMP_NR_BASE + 292) }, - { "inotify_rm_watch", (__SCMP_NR_BASE + 249) }, - { "io_cancel", (__SCMP_NR_BASE + 204) }, - { "io_destroy", (__SCMP_NR_BASE + 201) }, - { "io_getevents", (__SCMP_NR_BASE + 202) }, - { "io_pgetevents", (__SCMP_NR_BASE + 332) }, - { "io_pgetevents_time64", (__SCMP_NR_BASE + 416) }, - { "io_setup", (__SCMP_NR_BASE + 200) }, - { "io_submit", (__SCMP_NR_BASE + 203) }, - { "io_uring_setup", (__SCMP_NR_BASE + 425) }, - { "io_uring_enter", (__SCMP_NR_BASE + 426) }, - { "io_uring_register", (__SCMP_NR_BASE + 427) }, - { "ioctl", (__SCMP_NR_BASE + 15) }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", (__SCMP_NR_BASE + 278) }, - { "ioprio_set", (__SCMP_NR_BASE + 277) }, - { "ipc", __PNR_ipc }, - { "kcmp", (__SCMP_NR_BASE + 311) }, - { "kexec_file_load", __PNR_kexec_file_load }, - { "kexec_load", (__SCMP_NR_BASE + 274) }, - { "keyctl", (__SCMP_NR_BASE + 245) }, - { "kill", (__SCMP_NR_BASE + 60) }, - { "lchown", (__SCMP_NR_BASE + 92) }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", (__SCMP_NR_BASE + 184) }, - { "link", (__SCMP_NR_BASE + 84) }, - { "linkat", (__SCMP_NR_BASE + 259) }, - { "listen", (__SCMP_NR_BASE + 49) }, - { "listxattr", (__SCMP_NR_BASE + 186) }, - { "llistxattr", (__SCMP_NR_BASE + 187) }, - { "lock", __PNR_lock }, - { "lookup_dcookie", (__SCMP_NR_BASE + 206) }, - { "lremovexattr", (__SCMP_NR_BASE + 190) }, - { "lseek", (__SCMP_NR_BASE + 8) }, - { "lsetxattr", (__SCMP_NR_BASE + 181) }, - { "lstat", (__SCMP_NR_BASE + 6) }, - { "lstat64", __PNR_lstat64 }, - { "madvise", (__SCMP_NR_BASE + 27) }, - { "mbind", (__SCMP_NR_BASE + 231) }, - { "membarrier", (__SCMP_NR_BASE + 322) }, - { "memfd_create", (__SCMP_NR_BASE + 318) }, - { "migrate_pages", (__SCMP_NR_BASE + 250) }, - { "mincore", (__SCMP_NR_BASE + 26) }, - { "mkdir", (__SCMP_NR_BASE + 81) }, - { "mkdirat", (__SCMP_NR_BASE + 252) }, - { "mknod", (__SCMP_NR_BASE + 131) }, - { "mknodat", (__SCMP_NR_BASE + 253) }, - { "mlock", (__SCMP_NR_BASE + 146) }, - { "mlock2", (__SCMP_NR_BASE + 323) }, - { "mlockall", (__SCMP_NR_BASE + 148) }, - { "mmap", (__SCMP_NR_BASE + 9) }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", (__SCMP_NR_BASE + 160) }, - { "move_mount", (__SCMP_NR_BASE + 429) }, - { "move_pages", (__SCMP_NR_BASE + 271) }, - { "mprotect", (__SCMP_NR_BASE + 10) }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", (__SCMP_NR_BASE + 239) }, - { "mq_notify", (__SCMP_NR_BASE + 238) }, - { "mq_open", (__SCMP_NR_BASE + 234) }, - { "mq_timedreceive", (__SCMP_NR_BASE + 237) }, - { "mq_timedreceive_time64", (__SCMP_NR_BASE + 419) }, - { "mq_timedsend", (__SCMP_NR_BASE + 236) }, - { "mq_timedsend_time64", (__SCMP_NR_BASE + 418) }, - { "mq_unlink", (__SCMP_NR_BASE + 235) }, - { "mremap", (__SCMP_NR_BASE + 24) }, - { "msgctl", (__SCMP_NR_BASE + 69) }, - { "msgget", (__SCMP_NR_BASE + 66) }, - { "msgrcv", (__SCMP_NR_BASE + 68) }, - { "msgsnd", (__SCMP_NR_BASE + 67) }, - { "msync", (__SCMP_NR_BASE + 25) }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", (__SCMP_NR_BASE + 147) }, - { "munlockall", (__SCMP_NR_BASE + 149) }, - { "munmap", (__SCMP_NR_BASE + 11) }, - { "name_to_handle_at", (__SCMP_NR_BASE + 303) }, - { "nanosleep", (__SCMP_NR_BASE + 34) }, - { "newfstatat", (__SCMP_NR_BASE + 256) }, - { "nfsservctl", (__SCMP_NR_BASE + 173) }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", (__SCMP_NR_BASE + 2) }, - { "open_by_handle_at", (__SCMP_NR_BASE + 304) }, - { "open_tree", (__SCMP_NR_BASE + 428) }, - { "openat", (__SCMP_NR_BASE + 251) }, - { "pause", (__SCMP_NR_BASE + 33) }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", (__SCMP_NR_BASE + 296) }, - { "personality", (__SCMP_NR_BASE + 132) }, - { "pidfd_open", (__SCMP_NR_BASE + 434) }, - { "pidfd_send_signal", (__SCMP_NR_BASE + 424) }, - { "pipe", (__SCMP_NR_BASE + 21) }, - { "pipe2", (__SCMP_NR_BASE + 291) }, - { "pivot_root", (__SCMP_NR_BASE + 151) }, - { "pkey_alloc", (__SCMP_NR_BASE + 328) }, - { "pkey_free", (__SCMP_NR_BASE + 329) }, - { "pkey_mprotect", (__SCMP_NR_BASE + 327) }, - { "poll", (__SCMP_NR_BASE + 7) }, - { "ppoll", (__SCMP_NR_BASE + 265) }, - { "ppoll_time64", (__SCMP_NR_BASE + 414) }, - { "prctl", (__SCMP_NR_BASE + 153) }, - { "pread64", (__SCMP_NR_BASE + 16) }, - { "preadv", (__SCMP_NR_BASE + 293) }, - { "preadv2", (__SCMP_NR_BASE + 325) }, - { "prlimit64", (__SCMP_NR_BASE + 302) }, - { "process_vm_readv", (__SCMP_NR_BASE + 309) }, - { "process_vm_writev", (__SCMP_NR_BASE + 310) }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", (__SCMP_NR_BASE + 264) }, - { "pselect6_time64", (__SCMP_NR_BASE + 413) }, - { "ptrace", (__SCMP_NR_BASE + 99) }, - { "putpmsg", (__SCMP_NR_BASE + 175) }, - { "pwrite64", (__SCMP_NR_BASE + 17) }, - { "pwritev", (__SCMP_NR_BASE + 294) }, - { "pwritev2", (__SCMP_NR_BASE + 326) }, - { "query_module", (__SCMP_NR_BASE + 171) }, - { "quotactl", (__SCMP_NR_BASE + 172) }, - { "read", (__SCMP_NR_BASE + 0) }, - { "readahead", (__SCMP_NR_BASE + 179) }, - { "readdir", __PNR_readdir }, - { "readlink", (__SCMP_NR_BASE + 87) }, - { "readlinkat", (__SCMP_NR_BASE + 261) }, - { "readv", (__SCMP_NR_BASE + 18) }, - { "reboot", (__SCMP_NR_BASE + 164) }, - { "recv", __PNR_recv }, - { "recvfrom", (__SCMP_NR_BASE + 44) }, - { "recvmmsg", (__SCMP_NR_BASE + 298) }, - { "recvmmsg_time64", (__SCMP_NR_BASE + 417) }, - { "recvmsg", (__SCMP_NR_BASE + 46) }, - { "remap_file_pages", (__SCMP_NR_BASE + 210) }, - { "removexattr", (__SCMP_NR_BASE + 189) }, - { "rename", (__SCMP_NR_BASE + 80) }, - { "renameat", (__SCMP_NR_BASE + 258) }, - { "renameat2", (__SCMP_NR_BASE + 315) }, - { "request_key", (__SCMP_NR_BASE + 244) }, - { "restart_syscall", (__SCMP_NR_BASE + 214) }, - { "rmdir", (__SCMP_NR_BASE + 82) }, - { "rseq", (__SCMP_NR_BASE + 331) }, - { "rt_sigaction", (__SCMP_NR_BASE + 13) }, - { "rt_sigpending", (__SCMP_NR_BASE + 125) }, - { "rt_sigprocmask", (__SCMP_NR_BASE + 14) }, - { "rt_sigqueueinfo", (__SCMP_NR_BASE + 127) }, - { "rt_sigreturn", (__SCMP_NR_BASE + 211) }, - { "rt_sigsuspend", (__SCMP_NR_BASE + 128) }, - { "rt_sigtimedwait", (__SCMP_NR_BASE + 126) }, - { "rt_sigtimedwait_time64", (__SCMP_NR_BASE + 421) }, - { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 295) }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", (__SCMP_NR_BASE + 143) }, - { "sched_get_priority_min", (__SCMP_NR_BASE + 144) }, - { "sched_getaffinity", (__SCMP_NR_BASE + 196) }, - { "sched_getattr", (__SCMP_NR_BASE + 314) }, - { "sched_getparam", (__SCMP_NR_BASE + 140) }, - { "sched_getscheduler", (__SCMP_NR_BASE + 142) }, - { "sched_rr_get_interval", (__SCMP_NR_BASE + 145) }, - { "sched_rr_get_interval_time64", (__SCMP_NR_BASE + 423) }, - { "sched_setaffinity", (__SCMP_NR_BASE + 195) }, - { "sched_setattr", (__SCMP_NR_BASE + 313) }, - { "sched_setparam", (__SCMP_NR_BASE + 139) }, - { "sched_setscheduler", (__SCMP_NR_BASE + 141) }, - { "sched_yield", (__SCMP_NR_BASE + 23) }, - { "seccomp", (__SCMP_NR_BASE + 316) }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", (__SCMP_NR_BASE + 64) }, - { "semget", (__SCMP_NR_BASE + 62) }, - { "semop", (__SCMP_NR_BASE + 63) }, - { "semtimedop", (__SCMP_NR_BASE + 215) }, - { "semtimedop_time64", (__SCMP_NR_BASE + 420) }, - { "send", __PNR_send }, - { "sendfile", (__SCMP_NR_BASE + 39) }, - { "sendfile64", (__SCMP_NR_BASE + 219) }, - { "sendmmsg", (__SCMP_NR_BASE + 307) }, - { "sendmsg", (__SCMP_NR_BASE + 45) }, - { "sendto", (__SCMP_NR_BASE + 43) }, - { "set_mempolicy", (__SCMP_NR_BASE + 233) }, - { "set_robust_list", (__SCMP_NR_BASE + 272) }, - { "set_thread_area", (__SCMP_NR_BASE + 246) }, - { "set_tid_address", (__SCMP_NR_BASE + 213) }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", (__SCMP_NR_BASE + 166) }, - { "setfsgid", (__SCMP_NR_BASE + 121) }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", (__SCMP_NR_BASE + 120) }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", (__SCMP_NR_BASE + 104) }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", (__SCMP_NR_BASE + 114) }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", (__SCMP_NR_BASE + 165) }, - { "setitimer", (__SCMP_NR_BASE + 36) }, - { "setns", (__SCMP_NR_BASE + 308) }, - { "setpgid", (__SCMP_NR_BASE + 107) }, - { "setpriority", (__SCMP_NR_BASE + 138) }, - { "setregid", (__SCMP_NR_BASE + 112) }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", (__SCMP_NR_BASE + 117) }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", (__SCMP_NR_BASE + 115) }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", (__SCMP_NR_BASE + 111) }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", (__SCMP_NR_BASE + 155) }, - { "setsid", (__SCMP_NR_BASE + 110) }, - { "setsockopt", (__SCMP_NR_BASE + 53) }, - { "settimeofday", (__SCMP_NR_BASE + 159) }, - { "setuid", (__SCMP_NR_BASE + 103) }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", (__SCMP_NR_BASE + 180) }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", (__SCMP_NR_BASE + 29) }, - { "shmctl", (__SCMP_NR_BASE + 30) }, - { "shmdt", (__SCMP_NR_BASE + 65) }, - { "shmget", (__SCMP_NR_BASE + 28) }, - { "shutdown", (__SCMP_NR_BASE + 47) }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", (__SCMP_NR_BASE + 129) }, - { "signal", __PNR_signal }, - { "signalfd", (__SCMP_NR_BASE + 280) }, - { "signalfd4", (__SCMP_NR_BASE + 287) }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", (__SCMP_NR_BASE + 40) }, - { "socketcall", __PNR_socketcall }, - { "socketpair", (__SCMP_NR_BASE + 52) }, - { "splice", (__SCMP_NR_BASE + 267) }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", (__SCMP_NR_BASE + 4) }, - { "stat64", __PNR_stat64 }, - { "statfs", (__SCMP_NR_BASE + 134) }, - { "statfs64", (__SCMP_NR_BASE + 217) }, - { "statx", (__SCMP_NR_BASE + 330) }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", (__SCMP_NR_BASE + 163) }, - { "swapon", (__SCMP_NR_BASE + 162) }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", (__SCMP_NR_BASE + 86) }, - { "symlinkat", (__SCMP_NR_BASE + 260) }, - { "sync", (__SCMP_NR_BASE + 157) }, - { "sync_file_range", (__SCMP_NR_BASE + 268) }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", (__SCMP_NR_BASE + 306) }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", (__SCMP_NR_BASE + 136) }, - { "sysinfo", (__SCMP_NR_BASE + 97) }, - { "syslog", (__SCMP_NR_BASE + 101) }, - { "sysmips", (__SCMP_NR_BASE + 199) }, - { "tee", (__SCMP_NR_BASE + 269) }, - { "tgkill", (__SCMP_NR_BASE + 229) }, - { "time", __PNR_time }, - { "timer_create", (__SCMP_NR_BASE + 220) }, - { "timer_delete", (__SCMP_NR_BASE + 224) }, - { "timer_getoverrun", (__SCMP_NR_BASE + 223) }, - { "timer_gettime", (__SCMP_NR_BASE + 222) }, - { "timer_gettime64", (__SCMP_NR_BASE + 408) }, - { "timer_settime", (__SCMP_NR_BASE + 221) }, - { "timer_settime64", (__SCMP_NR_BASE + 409) }, - { "timerfd", (__SCMP_NR_BASE + 281) }, - { "timerfd_create", (__SCMP_NR_BASE + 284) }, - { "timerfd_gettime", (__SCMP_NR_BASE + 285) }, - { "timerfd_gettime64", (__SCMP_NR_BASE + 410) }, - { "timerfd_settime", (__SCMP_NR_BASE + 286) }, - { "timerfd_settime64", (__SCMP_NR_BASE + 411) }, - { "times", (__SCMP_NR_BASE + 98) }, - { "tkill", (__SCMP_NR_BASE + 192) }, - { "truncate", (__SCMP_NR_BASE + 74) }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", (__SCMP_NR_BASE + 93) }, - { "umount", __PNR_umount }, - { "umount2", (__SCMP_NR_BASE + 161) }, - { "uname", (__SCMP_NR_BASE + 61) }, - { "unlink", (__SCMP_NR_BASE + 85) }, - { "unlinkat", (__SCMP_NR_BASE + 257) }, - { "unshare", (__SCMP_NR_BASE + 266) }, - { "uselib", __PNR_uselib }, - { "userfaultfd", (__SCMP_NR_BASE + 321) }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", (__SCMP_NR_BASE + 133) }, - { "utime", (__SCMP_NR_BASE + 130) }, - { "utimensat", (__SCMP_NR_BASE + 279) }, - { "utimensat_time64", (__SCMP_NR_BASE + 412) }, - { "utimes", (__SCMP_NR_BASE + 230) }, - { "vfork", __PNR_vfork }, - { "vhangup", (__SCMP_NR_BASE + 150) }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (__SCMP_NR_BASE + 270) }, - { "vserver", (__SCMP_NR_BASE + 240) }, - { "wait4", (__SCMP_NR_BASE + 59) }, - { "waitid", (__SCMP_NR_BASE + 241) }, - { "waitpid", __PNR_waitpid }, - { "write", (__SCMP_NR_BASE + 1) }, - { "writev", (__SCMP_NR_BASE + 19) }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int mips64n32_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips64n32_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *mips64n32_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = mips64n32_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *mips64n32_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &mips64n32_syscall_table[spot]; -} diff --git a/src/arch-parisc-syscalls.c b/src/arch-parisc-syscalls.c deleted file mode 100644 index c516c16e..00000000 --- a/src/arch-parisc-syscalls.c +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright (c) 2016 Helge Deller - * Author: Helge Deller - */ - -#include - -#include - -#include "arch.h" -#include "arch-parisc.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def parisc_syscall_table[] = { \ - { "_llseek", 140 }, - { "_newselect", 142 }, - { "_sysctl", 149 }, - { "accept", 35 }, - { "accept4", 320 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 264 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", 134 }, - { "bind", 22 }, - { "bpf", 341 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 106 }, - { "capset", 107 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 180 }, - { "chown32", __PNR_chown32 }, - { "chroot", 61 }, - { "clock_adjtime", 324 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 257 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 256 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 258 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 255 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 120 }, - { "clone3", __PNR_clone3 }, - { "close", 6 }, - { "connect", 31 }, - { "copy_file_range", 346 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 312 }, - { "epoll_create", 224 }, - { "epoll_create1", 311 }, - { "epoll_ctl", 225 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 297 }, - { "epoll_wait", 226 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 304 }, - { "eventfd2", 310 }, - { "execve", 11 }, - { "execveat", 342 }, - { "exit", 1 }, - { "exit_group", 222 }, - { "faccessat", 287 }, - { "fadvise64", __PNR_fadvise64 }, - { "fadvise64_64", 236 }, - { "fallocate", 305 }, - { "fanotify_init", 322 }, - { "fanotify_mark", 323 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 286 }, - { "fchown", 95 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 278 }, - { "fcntl", 55 }, - { "fcntl64", 202 }, - { "fdatasync", 148 }, - { "fgetxattr", 243 }, - { "finit_module", 333 }, - { "flistxattr", 246 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 249 }, - { "fsconfig", __PNR_fsconfig }, - { "fsetxattr", 240 }, - { "fsmount", __PNR_fsmount }, - { "fsopen", __PNR_fsopen }, - { "fspick", __PNR_fspick }, - { "fstat", 28 }, - { "fstat64", 112 }, - { "fstatat64", 280 }, - { "fstatfs", 100 }, - { "fstatfs64", 299 }, - { "fsync", 118 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 93 }, - { "ftruncate64", 200 }, - { "futex", 210 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", 279 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 261 }, - { "get_robust_list", 290 }, - { "get_thread_area", 214 }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 296 }, - { "getcwd", 110 }, - { "getdents", 141 }, - { "getdents64", 201 }, - { "getegid", 50 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 49 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 47 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 80 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 105 }, - { "getpeername", 53 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 196 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 339 }, - { "getresgid", 171 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 165 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 76 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 44 }, - { "getsockopt", 182 }, - { "gettid", 206 }, - { "gettimeofday", 78 }, - { "getuid", 24 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 241 }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", 128 }, - { "inotify_add_watch", 270 }, - { "inotify_init", 269 }, - { "inotify_init1", 314 }, - { "inotify_rm_watch", 271 }, - { "io_cancel", 219 }, - { "io_destroy", 216 }, - { "io_getevents", 217 }, - { "io_pgetevents", __PNR_io_pgetevents }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 215 }, - { "io_submit", 218 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", 268 }, - { "ioprio_set", 267 }, - { "ipc", __PNR_ipc }, - { "kcmp", 332 }, - { "kexec_file_load", __PNR_kexec_file_load }, - { "kexec_load", 300 }, - { "keyctl", 266 }, - { "kill", 37 }, - { "lchown", 16 }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 242 }, - { "link", 9 }, - { "linkat", 283 }, - { "listen", 32 }, - { "listxattr", 244 }, - { "llistxattr", 245 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 223 }, - { "lremovexattr", 248 }, - { "lseek", 19 }, - { "lsetxattr", 239 }, - { "lstat", 84 }, - { "lstat64", 198 }, - { "madvise", 119 }, - { "mbind", 260 }, - { "membarrier", 343 }, - { "memfd_create", 340 }, - { "migrate_pages", 272 }, - { "mincore", 72 }, - { "mkdir", 39 }, - { "mkdirat", 276 }, - { "mknod", 14 }, - { "mknodat", 277 }, - { "mlock", 150 }, - { "mlock2", 345 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", 89 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", 21 }, - { "move_mount", __PNR_move_mount }, - { "move_pages", 295 }, - { "mprotect", 125 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 234 }, - { "mq_notify", 233 }, - { "mq_open", 229 }, - { "mq_timedreceive", 232 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 231 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 230 }, - { "mremap", 163 }, - { "msgctl", 191 }, - { "msgget", 190 }, - { "msgrcv", 189 }, - { "msgsnd", 188 }, - { "msync", 144 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 325 }, - { "nanosleep", 162 }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", 169 }, - { "nice", 34 }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 326 }, - { "open_tree", __PNR_open_tree }, - { "openat", 275 }, - { "pause", 29 }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 318 }, - { "personality", 136 }, - { "pidfd_open", __PNR_pidfd_open }, - { "pidfd_send_signal", __PNR_pidfd_send_signal }, - { "pipe", 42 }, - { "pipe2", 313 }, - { "pivot_root", 67 }, - { "pkey_alloc", __PNR_pkey_alloc }, - { "pkey_free", __PNR_pkey_free }, - { "pkey_mprotect", __PNR_pkey_mprotect }, - { "poll", 168 }, - { "ppoll", 274 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 172 }, - { "pread64", 108 }, - { "preadv", 315 }, - { "preadv2", 347 }, - { "prlimit64", 321 }, - { "process_vm_readv", 330 }, - { "process_vm_writev", 331 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 273 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 26 }, - { "putpmsg", 197 }, - { "pwrite64", 109 }, - { "pwritev", 316 }, - { "pwritev2", 348 }, - { "query_module", 167 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 207 }, - { "readdir", __PNR_readdir }, - { "readlink", 85 }, - { "readlinkat", 285 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", 98 }, - { "recvfrom", 123 }, - { "recvmmsg", 319 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 184 }, - { "remap_file_pages", 227 }, - { "removexattr", 247 }, - { "rename", 38 }, - { "renameat", 282 }, - { "renameat2", 337 }, - { "request_key", 265 }, - { "restart_syscall", 0 }, - { "rmdir", 40 }, - { "rseq", __PNR_rseq }, - { "rt_sigaction", 174 }, - { "rt_sigpending", 176 }, - { "rt_sigprocmask", 175 }, - { "rt_sigqueueinfo", 178 }, - { "rt_sigreturn", 173 }, - { "rt_sigsuspend", 179 }, - { "rt_sigtimedwait", 177 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 317 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 212 }, - { "sched_getattr", 335 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 211 }, - { "sched_setattr", 334 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 338 }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", 187 }, - { "semget", 186 }, - { "semop", 185 }, - { "semtimedop", 228 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", 58 }, - { "sendfile", 122 }, - { "sendfile64", 209 }, - { "sendmmsg", 329 }, - { "sendmsg", 183 }, - { "sendto", 82 }, - { "set_mempolicy", 262 }, - { "set_robust_list", 289 }, - { "set_thread_area", 213 }, - { "set_tid_address", 237 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 139 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 138 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 46 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 81 }, - { "setgroups32", __PNR_setgroups32}, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 328 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 71 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 170 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 164 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 70 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 181 }, - { "settimeofday", 79 }, - { "setuid", 23 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 238 }, - { "sgetmask", 68 }, - { "shmat", 192 }, - { "shmctl", 195 }, - { "shmdt", 193 }, - { "shmget", 194 }, - { "shutdown", 117 }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", 166 }, - { "signal", 48 }, - { "signalfd", 302 }, - { "signalfd4", 309 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", 17 }, - { "socketcall", __PNR_socketcall }, - { "socketpair", 56 }, - { "splice", 291 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", 69 }, - { "stat", 18 }, - { "stat64", 101 }, - { "statfs", 99 }, - { "statfs64", 298 }, - { "statx", 349 }, - { "stime", 25 }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", 83 }, - { "symlinkat", 284 }, - { "sync", 36 }, - { "sync_file_range", 292 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 327 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 293 }, - { "tgkill", 259 }, - { "time", 13 }, - { "timer_create", 250 }, - { "timer_delete", 254 }, - { "timer_getoverrun", 253 }, - { "timer_gettime", 252 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 251 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", 303 }, - { "timerfd_create", 306 }, - { "timerfd_gettime", 308 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 307 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 43 }, - { "tkill", 208 }, - { "truncate", 92 }, - { "truncate64", 199 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", 60 }, - { "umount", __PNR_umount }, - { "umount2", 52 }, - { "uname", 59 }, - { "unlink", 10 }, - { "unlinkat", 281 }, - { "unshare", 288 }, - { "uselib", 86 }, - { "userfaultfd", 344 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 301 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", 336 }, - { "vfork", 113 }, - { "vhangup", 111 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 294 }, - { "vserver", 263 }, - { "wait4", 114 }, - { "waitid", 235 }, - { "waitpid", 7 }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int parisc_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = parisc_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *parisc_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = parisc_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *parisc_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &parisc_syscall_table[spot]; -} diff --git a/src/arch-ppc-syscalls.c b/src/arch-ppc-syscalls.c deleted file mode 100644 index fbfa1df3..00000000 --- a/src/arch-ppc-syscalls.c +++ /dev/null @@ -1,559 +0,0 @@ -/** - * Enhanced Seccomp PPC Specific Code - * - * Copyright (c) 2015 Freescale - * Author: Bogdan Purcareata - * - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-ppc.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def ppc_syscall_table[] = { \ - { "_llseek", 140 }, - { "_newselect", 142 }, - { "_sysctl", 149 }, - { "accept", 330 }, - { "accept4", 344 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 269 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", 134 }, - { "bind", 327 }, - { "bpf", 361 }, - { "break", 17 }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 183 }, - { "capset", 184 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 181 }, - { "chown32", __PNR_chown32 }, - { "chroot", 61 }, - { "clock_adjtime", 347 }, - { "clock_adjtime64", 405 }, - { "clock_getres", 247 }, - { "clock_getres_time64", 406 }, - { "clock_gettime", 246 }, - { "clock_gettime64", 403 }, - { "clock_nanosleep", 248 }, - { "clock_nanosleep_time64", 407 }, - { "clock_settime", 245 }, - { "clock_settime64", 404 }, - { "clone", 120 }, - { "clone3", 435 }, - { "close", 6 }, - { "connect", 328 }, - { "copy_file_range", 379 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 316 }, - { "epoll_create", 236 }, - { "epoll_create1", 315 }, - { "epoll_ctl", 237 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 303 }, - { "epoll_wait", 238 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 307 }, - { "eventfd2", 314 }, - { "execve", 11 }, - { "execveat", 362 }, - { "exit", 1 }, - { "exit_group", 234 }, - { "faccessat", 298 }, - { "fadvise64", 233 }, - { "fadvise64_64", 254 }, - { "fallocate", 309 }, - { "fanotify_init", 323 }, - { "fanotify_mark", 324 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 297 }, - { "fchown", 95 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 289 }, - { "fcntl", 55 }, - { "fcntl64", 204 }, - { "fdatasync", 148 }, - { "fgetxattr", 214 }, - { "finit_module", 353 }, - { "flistxattr", 217 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 220 }, - { "fsconfig", 431 }, - { "fsetxattr", 211 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 108 }, - { "fstat64", 197 }, - { "fstatat64", 291 }, - { "fstatfs", 100 }, - { "fstatfs64", 253 }, - { "fsync", 118 }, - { "ftime", 35 }, - { "ftruncate", 93 }, - { "ftruncate64", 194 }, - { "futex", 221 }, - { "futex_time64", 422 }, - { "futimesat", 290 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 260 }, - { "get_robust_list", 299 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 302 }, - { "getcwd", 182 }, - { "getdents", 141 }, - { "getdents64", 202 }, - { "getegid", 50 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 49 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 47 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 80 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 105 }, - { "getpeername", 332 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 187 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 359 }, - { "getresgid", 170 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 165 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 76 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 331 }, - { "getsockopt", 340 }, - { "gettid", 207 }, - { "gettimeofday", 78 }, - { "getuid", 24 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 212 }, - { "gtty", 32 }, - { "idle", 112 }, - { "init_module", 128 }, - { "inotify_add_watch", 276 }, - { "inotify_init", 275 }, - { "inotify_init1", 318 }, - { "inotify_rm_watch", 277 }, - { "io_cancel", 231 }, - { "io_destroy", 228 }, - { "io_getevents", 229 }, - { "io_pgetevents", 388 }, - { "io_pgetevents_time64", 416 }, - { "io_setup", 227 }, - { "io_submit", 230 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", 101 }, - { "iopl", 110 }, - { "ioprio_get", 274 }, - { "ioprio_set", 273 }, - { "ipc", 117 }, - { "kcmp", 354 }, - { "kexec_file_load", 382 }, - { "kexec_load", 268 }, - { "keyctl", 271 }, - { "kill", 37 }, - { "lchown", 16 }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 213 }, - { "link", 9 }, - { "linkat", 294 }, - { "listen", 329 }, - { "listxattr", 215 }, - { "llistxattr", 216 }, - { "lock", 53 }, - { "lookup_dcookie", 235 }, - { "lremovexattr", 219 }, - { "lseek", 19 }, - { "lsetxattr", 210 }, - { "lstat", 107 }, - { "lstat64", 196 }, - { "madvise", 205 }, - { "mbind", 259 }, - { "membarrier", 365 }, - { "memfd_create", 360 }, - { "migrate_pages", 258 }, - { "mincore", 206 }, - { "mkdir", 39 }, - { "mkdirat", 287 }, - { "mknod", 14 }, - { "mknodat", 288 }, - { "mlock", 150 }, - { "mlock2", 378 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", 192 }, - { "modify_ldt", 123 }, - { "mount", 21 }, - { "move_mount", 429 }, - { "move_pages", 301 }, - { "mprotect", 125 }, - { "mpx", 56 }, - { "mq_getsetattr", 267 }, - { "mq_notify", 266 }, - { "mq_open", 262 }, - { "mq_timedreceive", 265 }, - { "mq_timedreceive_time64", 419 }, - { "mq_timedsend", 264 }, - { "mq_timedsend_time64", 418 }, - { "mq_unlink", 263 }, - { "mremap", 163 }, - { "msgctl", 402 }, - { "msgget", 399 }, - { "msgrcv", 401 }, - { "msgsnd", 400 }, - { "msync", 144 }, - { "multiplexer", 201 }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 345 }, - { "nanosleep", 162 }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", 168 }, - { "nice", 34 }, - { "oldfstat", 28 }, - { "oldlstat", 84 }, - { "oldolduname", 59 }, - { "oldstat", 18 }, - { "olduname", 109 }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 346 }, - { "open_tree", 428 }, - { "openat", 286 }, - { "pause", 29 }, - { "pciconfig_iobase", 200 }, - { "pciconfig_read", 198 }, - { "pciconfig_write", 199 }, - { "perf_event_open", 319 }, - { "personality", 136 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 42 }, - { "pipe2", 317 }, - { "pivot_root", 203 }, - { "pkey_alloc", 384 }, - { "pkey_free", 385 }, - { "pkey_mprotect", 386 }, - { "poll", 167 }, - { "ppoll", 281 }, - { "ppoll_time64", 414 }, - { "prctl", 171 }, - { "pread64", 179 }, - { "preadv", 320 }, - { "preadv2", 380 }, - { "prlimit64", 325 }, - { "process_vm_readv", 351 }, - { "process_vm_writev", 352 }, - { "prof", 44 }, - { "profil", 98 }, - { "pselect6", 280 }, - { "pselect6_time64", 413 }, - { "ptrace", 26 }, - { "putpmsg", 188 }, - { "pwrite64", 180 }, - { "pwritev", 321 }, - { "pwritev2", 381 }, - { "query_module", 166 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 191 }, - { "readdir", 89 }, - { "readlink", 85 }, - { "readlinkat", 296 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", 336 }, - { "recvfrom", 337 }, - { "recvmmsg", 343 }, - { "recvmmsg_time64", 417 }, - { "recvmsg", 342 }, - { "remap_file_pages", 239 }, - { "removexattr", 218 }, - { "rename", 38 }, - { "renameat", 293 }, - { "renameat2", 357 }, - { "request_key", 270 }, - { "restart_syscall", 0 }, - { "rmdir", 40 }, - { "rseq", 387 }, - { "rt_sigaction", 173 }, - { "rt_sigpending", 175 }, - { "rt_sigprocmask", 174 }, - { "rt_sigqueueinfo", 177 }, - { "rt_sigreturn", 172 }, - { "rt_sigsuspend", 178 }, - { "rt_sigtimedwait", 176 }, - { "rt_sigtimedwait_time64", 421 }, - { "rt_tgsigqueueinfo", 322 }, - { "rtas", 255 }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 223 }, - { "sched_getattr", 356 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", 423 }, - { "sched_setaffinity", 222 }, - { "sched_setattr", 355 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 358 }, - { "security", __PNR_security }, - { "select", 82 }, - { "semctl", 394 }, - { "semget", 393 }, - { "semop", __PNR_semop }, - { "semtimedop", __PNR_semtimedop }, - { "semtimedop_time64", 420 }, - { "send", 334 }, - { "sendfile", 186 }, - { "sendfile64", 226 }, - { "sendmmsg", 349 }, - { "sendmsg", 341 }, - { "sendto", 335 }, - { "set_mempolicy", 261 }, - { "set_robust_list", 300 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 232 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 139 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 138 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 46 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 81 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 350 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 71 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 169 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 164 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 70 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 339 }, - { "settimeofday", 79 }, - { "setuid", 23 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 209 }, - { "sgetmask", 68 }, - { "shmat", 397 }, - { "shmctl", 396 }, - { "shmdt", 398 }, - { "shmget", 395 }, - { "shutdown", 338 }, - { "sigaction", 67 }, - { "sigaltstack", 185 }, - { "signal", 48 }, - { "signalfd", 305 }, - { "signalfd4", 313 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", 119 }, - { "sigsuspend", 72 }, - { "socket", 326 }, - { "socketcall", 102 }, - { "socketpair", 333 }, - { "splice", 283 }, - { "spu_create", 279 }, - { "spu_run", 278 }, - { "ssetmask", 69 }, - { "stat", 106 }, - { "stat64", 195 }, - { "statfs", 99 }, - { "statfs64", 252 }, - { "statx", 383}, - { "stime", 25 }, - { "stty", 31 }, - { "subpage_prot", 310 }, - { "swapcontext", 249 }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", 363 }, - { "symlink", 83 }, - { "symlinkat", 295 }, - { "sync", 36 }, - { "sync_file_range", __PNR_sync_file_range }, - { "sync_file_range2", 308 }, - { "syncfs", 348 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", 256 }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 284 }, - { "tgkill", 250 }, - { "time", 13 }, - { "timer_create", 240 }, - { "timer_delete", 244 }, - { "timer_getoverrun", 243 }, - { "timer_gettime", 242 }, - { "timer_gettime64", 408 }, - { "timer_settime", 241 }, - { "timer_settime64", 409 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 306 }, - { "timerfd_gettime", 312 }, - { "timerfd_gettime64", 410 }, - { "timerfd_settime", 311 }, - { "timerfd_settime64", 411 }, - { "times", 43 }, - { "tkill", 208 }, - { "truncate", 92 }, - { "truncate64", 193 }, - { "tuxcall", 225 }, - { "ugetrlimit", 190 }, - { "ulimit", 58 }, - { "umask", 60 }, - { "umount", 22 }, - { "umount2", 52 }, - { "uname", 122 }, - { "unlink", 10 }, - { "unlinkat", 292 }, - { "unshare", 282 }, - { "uselib", 86 }, - { "userfaultfd", 364 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 304 }, - { "utimensat_time64", 412 }, - { "utimes", 251 }, - { "vfork", 189 }, - { "vhangup", 111 }, - { "vm86", 113 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 285 }, - { "vserver", __PNR_vserver }, - { "wait4", 114 }, - { "waitid", 272 }, - { "waitpid", 7 }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int ppc_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = ppc_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *ppc_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = ppc_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *ppc_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &ppc_syscall_table[spot]; -} diff --git a/src/arch-ppc64-syscalls.c b/src/arch-ppc64-syscalls.c deleted file mode 100644 index 41f82afa..00000000 --- a/src/arch-ppc64-syscalls.c +++ /dev/null @@ -1,559 +0,0 @@ -/** - * Enhanced Seccomp PPC64 Specific Code - * - * Copyright (c) 2014 Red Hat - * Author: Paul Moore - * - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-ppc64.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def ppc64_syscall_table[] = { \ - { "_llseek", 140 }, - { "_newselect", 142 }, - { "_sysctl", 149 }, - { "accept", 330 }, - { "accept4", 344 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 269 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", 134 }, - { "bind", 327 }, - { "bpf", 361 }, - { "break", 17 }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 183 }, - { "capset", 184 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 181 }, - { "chown32", __PNR_chown32 }, - { "chroot", 61 }, - { "clock_adjtime", 347 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 247 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 246 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 248 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 245 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 120 }, - { "clone3", 435 }, - { "close", 6 }, - { "connect", 328 }, - { "copy_file_range", 379 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 316 }, - { "epoll_create", 236 }, - { "epoll_create1", 315 }, - { "epoll_ctl", 237 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 303 }, - { "epoll_wait", 238 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 307 }, - { "eventfd2", 314 }, - { "execve", 11 }, - { "execveat", 362 }, - { "exit", 1 }, - { "exit_group", 234 }, - { "faccessat", 298 }, - { "fadvise64", 233 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", 309 }, - { "fanotify_init", 323 }, - { "fanotify_mark", 324 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 297 }, - { "fchown", 95 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 289 }, - { "fcntl", 55 }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", 148 }, - { "fgetxattr", 214 }, - { "finit_module", 353 }, - { "flistxattr", 217 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 220 }, - { "fsconfig", 431 }, - { "fsetxattr", 211 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 108 }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", 100 }, - { "fstatfs64", 253 }, - { "fsync", 118 }, - { "ftime", 35 }, - { "ftruncate", 93 }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", 221 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", 290 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 260 }, - { "get_robust_list", 299 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 302 }, - { "getcwd", 182 }, - { "getdents", 141 }, - { "getdents64", 202 }, - { "getegid", 50 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 49 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 47 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 80 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 105 }, - { "getpeername", 332 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 187 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 359 }, - { "getresgid", 170 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 165 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 76 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 331 }, - { "getsockopt", 340 }, - { "gettid", 207 }, - { "gettimeofday", 78 }, - { "getuid", 24 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 212 }, - { "gtty", 32 }, - { "idle", 112 }, - { "init_module", 128 }, - { "inotify_add_watch", 276 }, - { "inotify_init", 275 }, - { "inotify_init1", 318 }, - { "inotify_rm_watch", 277 }, - { "io_cancel", 231 }, - { "io_destroy", 228 }, - { "io_getevents", 229 }, - { "io_pgetevents", 388 }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 227 }, - { "io_submit", 230 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", 101 }, - { "iopl", 110 }, - { "ioprio_get", 274 }, - { "ioprio_set", 273 }, - { "ipc", 117 }, - { "kcmp", 354 }, - { "kexec_file_load", 382 }, - { "kexec_load", 268 }, - { "keyctl", 271 }, - { "kill", 37 }, - { "lchown", 16 }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 213 }, - { "link", 9 }, - { "linkat", 294 }, - { "listen", 329 }, - { "listxattr", 215 }, - { "llistxattr", 216 }, - { "lock", 53 }, - { "lookup_dcookie", 235 }, - { "lremovexattr", 219 }, - { "lseek", 19 }, - { "lsetxattr", 210 }, - { "lstat", 107 }, - { "lstat64", __PNR_lstat64 }, - { "madvise", 205 }, - { "mbind", 259 }, - { "membarrier", 365 }, - { "memfd_create", 360 }, - { "migrate_pages", 258 }, - { "mincore", 206 }, - { "mkdir", 39 }, - { "mkdirat", 287 }, - { "mknod", 14 }, - { "mknodat", 288 }, - { "mlock", 150 }, - { "mlock2", 378 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", 123 }, - { "mount", 21 }, - { "move_mount", 429 }, - { "move_pages", 301 }, - { "mprotect", 125 }, - { "mpx", 56 }, - { "mq_getsetattr", 267 }, - { "mq_notify", 266 }, - { "mq_open", 262 }, - { "mq_timedreceive", 265 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 264 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 263 }, - { "mremap", 163 }, - { "msgctl", 402 }, - { "msgget", 399 }, - { "msgrcv", 401 }, - { "msgsnd", 400 }, - { "msync", 144 }, - { "multiplexer", 201 }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 345 }, - { "nanosleep", 162 }, - { "newfstatat", 291 }, - { "nfsservctl", 168 }, - { "nice", 34 }, - { "oldfstat", 28 }, - { "oldlstat", 84 }, - { "oldolduname", 59 }, - { "oldstat", 18 }, - { "olduname", 109 }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 346 }, - { "open_tree", 428 }, - { "openat", 286 }, - { "pause", 29 }, - { "pciconfig_iobase", 200 }, - { "pciconfig_read", 198 }, - { "pciconfig_write", 199 }, - { "perf_event_open", 319 }, - { "personality", 136 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 42 }, - { "pipe2", 317 }, - { "pivot_root", 203 }, - { "pkey_alloc", 384 }, - { "pkey_free", 385 }, - { "pkey_mprotect", 386 }, - { "poll", 167 }, - { "ppoll", 281 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 171 }, - { "pread64", 179 }, - { "preadv", 320 }, - { "preadv2", 380 }, - { "prlimit64", 325 }, - { "process_vm_readv", 351 }, - { "process_vm_writev", 352 }, - { "prof", 44 }, - { "profil", 98 }, - { "pselect6", 280 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 26 }, - { "putpmsg", 188 }, - { "pwrite64", 180 }, - { "pwritev", 321 }, - { "pwritev2", 381 }, - { "query_module", 166 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 191 }, - { "readdir", 89 }, - { "readlink", 85 }, - { "readlinkat", 296 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", 336 }, - { "recvfrom", 337 }, - { "recvmmsg", 343 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 342 }, - { "remap_file_pages", 239 }, - { "removexattr", 218 }, - { "rename", 38 }, - { "renameat", 293 }, - { "renameat2", 357 }, - { "request_key", 270 }, - { "restart_syscall", 0 }, - { "rmdir", 40 }, - { "rseq", 387 }, - { "rt_sigaction", 173 }, - { "rt_sigpending", 175 }, - { "rt_sigprocmask", 174 }, - { "rt_sigqueueinfo", 177 }, - { "rt_sigreturn", 172 }, - { "rt_sigsuspend", 178 }, - { "rt_sigtimedwait", 176 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 322 }, - { "rtas", 255 }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 223 }, - { "sched_getattr", 356 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 222 }, - { "sched_setattr", 355 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 358 }, - { "security", __PNR_security }, - { "select", 82 }, - { "semctl", 394 }, - { "semget", 393 }, - { "semop", __PNR_semop }, - { "semtimedop", 392 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", 334 }, - { "sendfile", 186 }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", 349 }, - { "sendmsg", 341 }, - { "sendto", 335 }, - { "set_mempolicy", 261 }, - { "set_robust_list", 300 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 232 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 139 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 138 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 46 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 81 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 350 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 71 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 169 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 164 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 70 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 339 }, - { "settimeofday", 79 }, - { "setuid", 23 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 209 }, - { "sgetmask", 68 }, - { "shmat", 397 }, - { "shmctl", 396 }, - { "shmdt", 398 }, - { "shmget", 395 }, - { "shutdown", 338 }, - { "sigaction", 67 }, - { "sigaltstack", 185 }, - { "signal", 48 }, - { "signalfd", 305 }, - { "signalfd4", 313 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", 119 }, - { "sigsuspend", 72 }, - { "socket", 326 }, - { "socketcall", 102 }, - { "socketpair", 333 }, - { "splice", 283 }, - { "spu_create", 279 }, - { "spu_run", 278 }, - { "ssetmask", 69 }, - { "stat", 106 }, - { "stat64", __PNR_stat64 }, - { "statfs", 99 }, - { "statfs64", 252 }, - { "statx", 383}, - { "stime", 25 }, - { "stty", 31 }, - { "subpage_prot", 310 }, - { "swapcontext", 249 }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", 363 }, - { "symlink", 83 }, - { "symlinkat", 295 }, - { "sync", 36 }, - { "sync_file_range", __PNR_sync_file_range }, - { "sync_file_range2", 308 }, - { "syncfs", 348 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", 256 }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 284 }, - { "tgkill", 250 }, - { "time", 13 }, - { "timer_create", 240 }, - { "timer_delete", 244 }, - { "timer_getoverrun", 243 }, - { "timer_gettime", 242 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 241 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 306 }, - { "timerfd_gettime", 312 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 311 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 43 }, - { "tkill", 208 }, - { "truncate", 92 }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", 225 }, - { "ugetrlimit", 190 }, - { "ulimit", 58 }, - { "umask", 60 }, - { "umount", 22 }, - { "umount2", 52 }, - { "uname", 122 }, - { "unlink", 10 }, - { "unlinkat", 292 }, - { "unshare", 282 }, - { "uselib", 86 }, - { "userfaultfd", 364 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 304 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", 251 }, - { "vfork", 189 }, - { "vhangup", 111 }, - { "vm86", 113 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 285 }, - { "vserver", __PNR_vserver }, - { "wait4", 114 }, - { "waitid", 272 }, - { "waitpid", 7 }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int ppc64_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = ppc64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *ppc64_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = ppc64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *ppc64_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &ppc64_syscall_table[spot]; -} diff --git a/src/arch-riscv64-syscalls.c b/src/arch-riscv64-syscalls.c deleted file mode 100644 index ceebecec..00000000 --- a/src/arch-riscv64-syscalls.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-riscv64.h" - -/* NOTE: based on Linux 5.4 */ -const struct arch_syscall_def riscv64_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", __PNR__newselect }, - { "_sysctl", __PNR__sysctl }, - { "accept", 202 }, - { "accept4", 242 }, - { "access", __PNR_access }, - { "acct", 89 }, - { "add_key", 217 }, - { "adjtimex", 171 }, - { "afs_syscall", __PNR_afs_syscall }, - { "alarm", __PNR_alarm }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", __PNR_bdflush }, - { "bind", 200 }, - { "bpf", 280 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 214 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 90 }, - { "capset", 91 }, - { "chdir", 49 }, - { "chmod", __PNR_chmod }, - { "chown", __PNR_chown }, - { "chown32", __PNR_chown32 }, - { "chroot", 51 }, - { "clock_adjtime", 266 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 114 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 113 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 115 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 112 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 220 }, - { "clone3", 435 }, - { "close", 57 }, - { "connect", 203 }, - { "copy_file_range", 285 }, - { "creat", __PNR_creat }, - { "create_module", __PNR_create_module }, - { "delete_module", 106 }, - { "dup", 23 }, - { "dup2", __PNR_dup2 }, - { "dup3", 24 }, - { "epoll_create", __PNR_epoll_create }, - { "epoll_create1", 20 }, - { "epoll_ctl", 21 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 22 }, - { "epoll_wait", __PNR_epoll_wait }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", __PNR_eventfd }, - { "eventfd2", 19 }, - { "execve", 221 }, - { "execveat", 281 }, - { "exit", 93 }, - { "exit_group", 94 }, - { "faccessat", 48 }, - { "fadvise64", 223 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", 47 }, - { "fanotify_init", 262 }, - { "fanotify_mark", 263 }, - { "fchdir", 50 }, - { "fchmod", 52 }, - { "fchmodat", 53 }, - { "fchown", 55 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 54 }, - { "fcntl", 25 }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", 83 }, - { "fgetxattr", 10 }, - { "finit_module", 273 }, - { "flistxattr", 13 }, - { "flock", 32 }, - { "fork", __PNR_fork }, - { "fremovexattr", 16 }, - { "fsconfig", 431 }, - { "fsetxattr", 7 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 80 }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", 44 }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", 82 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 46 }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", 98 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", __PNR_futimesat }, - { "get_kernel_syms", __PNR_get_kernel_syms }, - { "get_mempolicy", 236 }, - { "get_robust_list", 100 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 168 }, - { "getcwd", 17 }, - { "getdents", __PNR_getdents }, - { "getdents64", 61 }, - { "getegid", 177 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 175 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 176 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 158 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 102 }, - { "getpeername", 205 }, - { "getpgid", 155 }, - { "getpgrp", __PNR_getpgrp }, - { "getpid", 172 }, - { "getpmsg", __PNR_getpmsg }, - { "getppid", 173 }, - { "getpriority", 141 }, - { "getrandom", 278 }, - { "getresgid", 150 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 148 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 163 }, - { "getrusage", 165 }, - { "getsid", 156 }, - { "getsockname", 204 }, - { "getsockopt", 209 }, - { "gettid", 178 }, - { "gettimeofday", 169 }, - { "getuid", 174 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 8 }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", 105 }, - { "inotify_add_watch", 27 }, - { "inotify_init", __PNR_inotify_init }, - { "inotify_init1", 26 }, - { "inotify_rm_watch", 28 }, - { "io_cancel", 3 }, - { "io_destroy", 1 }, - { "io_getevents", 4 }, - { "io_pgetevents", 292 }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 0 }, - { "io_submit", 2 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "io_uring_setup", 425 }, - { "ioctl", 29 }, - { "ioperm", __PNR_ioperm }, - { "iopl", __PNR_iopl }, - { "ioprio_get", 31 }, - { "ioprio_set", 30 }, - { "ipc", __PNR_ipc }, - { "kcmp", 272 }, - { "kexec_file_load", 294 }, - { "kexec_load", 104 }, - { "keyctl", 219 }, - { "kill", 129 }, - { "lchown", __PNR_lchown }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 9 }, - { "link", __PNR_link }, - { "linkat", 37 }, - { "listen", 201 }, - { "listxattr", 11 }, - { "llistxattr", 12 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 18 }, - { "lremovexattr", 15 }, - { "lseek", 62 }, - { "lsetxattr", 6 }, - { "lstat", __PNR_lstat }, - { "lstat64", __PNR_lstat64 }, - { "madvise", 233 }, - { "mbind", 235 }, - { "membarrier", 283 }, - { "memfd_create", 279 }, - { "migrate_pages", 238 }, - { "mincore", 232 }, - { "mkdir", __PNR_mkdir }, - { "mkdirat", 34 }, - { "mknod", __PNR_mknod }, - { "mknodat", 33 }, - { "mlock", 228 }, - { "mlock2", 284 }, - { "mlockall", 230 }, - { "mmap", 222 }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", 40 }, - { "move_mount", 429 }, - { "move_pages", 239 }, - { "mprotect", 226 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 185 }, - { "mq_notify", 184 }, - { "mq_open", 180 }, - { "mq_timedreceive", 183 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 182 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 181 }, - { "mremap", 216 }, - { "msgctl", 187 }, - { "msgget", 186 }, - { "msgrcv", 188 }, - { "msgsnd", 189 }, - { "msync", 227 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 229 }, - { "munlockall", 231 }, - { "munmap", 215 }, - { "name_to_handle_at", 264 }, - { "nanosleep", 101 }, - { "newfstatat", 79 }, - { "nfsservctl", 42 }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", __PNR_open }, - { "open_by_handle_at", 265 }, - { "open_tree", 428 }, - { "openat", 56 }, - { "pause", __PNR_pause }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 241 }, - { "personality", 92 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", __PNR_pipe }, - { "pipe2", 59 }, - { "pivot_root", 41 }, - { "pkey_alloc", 289 }, - { "pkey_free", 290 }, - { "pkey_mprotect", 288 }, - { "poll", __PNR_poll }, - { "ppoll", 73 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 167 }, - { "pread64", 67 }, - { "preadv", 69 }, - { "preadv2", 286 }, - { "prlimit64", 261 }, - { "process_vm_readv", 270 }, - { "process_vm_writev", 271 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 72 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 117 }, - { "putpmsg", __PNR_putpmsg }, - { "pwrite64", 68 }, - { "pwritev", 70 }, - { "pwritev2", 287 }, - { "query_module", __PNR_query_module }, - { "quotactl", 60 }, - { "read", 63 }, - { "readahead", 213 }, - { "readdir", __PNR_readdir }, - { "readlink", __PNR_readlink }, - { "readlinkat", 78 }, - { "readv", 65 }, - { "reboot", 142 }, - { "recv", __PNR_recv }, - { "recvfrom", 207 }, - { "recvmmsg", 243 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 212 }, - { "remap_file_pages", 234 }, - { "removexattr", 14 }, - { "rename", __PNR_rename }, - { "renameat", __PNR_renameat }, - { "renameat2", 276 }, - { "request_key", 218 }, - { "restart_syscall", 128 }, - { "rmdir", __PNR_rmdir }, - { "riscv_flush_icache", 244 }, - { "rseq", 293 }, - { "rt_sigaction", 134 }, - { "rt_sigpending", 136 }, - { "rt_sigprocmask", 135 }, - { "rt_sigqueueinfo", 138 }, - { "rt_sigreturn", 139 }, - { "rt_sigsuspend", 133 }, - { "rt_sigtimedwait", 137 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 240 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 125 }, - { "sched_get_priority_min", 126 }, - { "sched_getaffinity", 123 }, - { "sched_getattr", 275 }, - { "sched_getparam", 121 }, - { "sched_getscheduler", 120 }, - { "sched_rr_get_interval", 127 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 122 }, - { "sched_setattr", 274 }, - { "sched_setparam", 118 }, - { "sched_setscheduler", 119 }, - { "sched_yield", 124 }, - { "seccomp", 277 }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", 191 }, - { "semget", 190 }, - { "semop", 193 }, - { "semtimedop", 192 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", 71 }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", 269 }, - { "sendmsg", 211 }, - { "sendto", 206 }, - { "set_mempolicy", 237 }, - { "set_robust_list", 99 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 96 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 162 }, - { "setfsgid", 152 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 151 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 144 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 159 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 161 }, - { "setitimer", 103 }, - { "setns", 268 }, - { "setpgid", 154 }, - { "setpriority", 140 }, - { "setregid", 143 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 149 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 147 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 145 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 164 }, - { "setsid", 157 }, - { "setsockopt", 208 }, - { "settimeofday", 170 }, - { "setuid", 146 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 5 }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", 196 }, - { "shmctl", 195 }, - { "shmdt", 197 }, - { "shmget", 194 }, - { "shutdown", 210 }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", 132 }, - { "signal", __PNR_signal }, - { "signalfd", __PNR_signalfd }, - { "signalfd4", 74 }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", 198 }, - { "socketcall", __PNR_socketcall }, - { "socketpair", 199 }, - { "splice", 76 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", __PNR_stat }, - { "stat64", __PNR_stat64 }, - { "statfs", 43 }, - { "statfs64", __PNR_statfs64 }, - { "statx", 291 }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 225 }, - { "swapon", 224 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", __PNR_symlink }, - { "symlinkat", 36 }, - { "sync", 81 }, - { "sync_file_range", 84 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 267 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", __PNR_sysfs }, - { "sysinfo", 179 }, - { "syslog", 116 }, - { "sysmips", __PNR_sysmips }, - { "tee", 77 }, - { "tgkill", 131 }, - { "time", __PNR_time }, - { "timer_create", 107 }, - { "timer_delete", 111 }, - { "timer_getoverrun", 109 }, - { "timer_gettime", 108 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 110 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 85 }, - { "timerfd_gettime", 87 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 86 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 153 }, - { "tkill", 130 }, - { "truncate", 45 }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", 166 }, - { "umount", __PNR_umount }, - { "umount2", 39 }, - { "uname", 160 }, - { "unlink", __PNR_unlink }, - { "unlinkat", 35 }, - { "unshare", 97 }, - { "uselib", __PNR_uselib }, - { "userfaultfd", 282 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", __PNR_ustat }, - { "utime", __PNR_utime }, - { "utimensat", 88 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", __PNR_utimes }, - { "vfork", __PNR_vfork }, - { "vhangup", 58 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 75 }, - { "vserver", __PNR_vserver }, - { "wait4", 260 }, - { "waitid", 95 }, - { "waitpid", __PNR_waitpid }, - { "write", 64 }, - { "writev", 66 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int riscv64_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = riscv64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *riscv64_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = riscv64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *riscv64_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &riscv64_syscall_table[spot]; -} diff --git a/src/arch-s390-syscalls.c b/src/arch-s390-syscalls.c deleted file mode 100644 index 6dd84db5..00000000 --- a/src/arch-s390-syscalls.c +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright 2015 IBM - * Author: Jan Willeke - */ - -#include - -#include - -#include "arch.h" -#include "arch-s390.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def s390_syscall_table[] = { \ - { "_llseek", 140 }, - { "_newselect", 142 }, - { "_sysctl", 149 }, - { "accept", __PNR_accept }, - { "accept4", 364 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 278 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", 134 }, - { "bind", 361 }, - { "bpf", 351 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 184 }, - { "capset", 185 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 182 }, - { "chown32", 212 }, - { "chroot", 61 }, - { "clock_adjtime", 337 }, - { "clock_adjtime64", 405 }, - { "clock_getres", 261 }, - { "clock_getres_time64", 406 }, - { "clock_gettime", 260 }, - { "clock_gettime64", 403 }, - { "clock_nanosleep", 262 }, - { "clock_nanosleep_time64", 407 }, - { "clock_settime", 259 }, - { "clock_settime64", 404 }, - { "clone", 120 }, - { "clone3", 435 }, - { "close", 6 }, - { "connect", 362 }, - { "copy_file_range", 375 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 326 }, - { "epoll_create", 249 }, - { "epoll_create1", 327 }, - { "epoll_ctl", 250 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 312 }, - { "epoll_wait", 251 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 318 }, - { "eventfd2", 323 }, - { "execve", 11 }, - { "execveat", 354 }, - { "exit", 1 }, - { "exit_group", 248 }, - { "faccessat", 300 }, - { "fadvise64", 253 }, - { "fadvise64_64", 264 }, - { "fallocate", 314 }, - { "fanotify_init", 332 }, - { "fanotify_mark", 333 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 299 }, - { "fchown", 95 }, - { "fchown32", 207 }, - { "fchownat", 291 }, - { "fcntl", 55 }, - { "fcntl64", 221 }, - { "fdatasync", 148 }, - { "fgetxattr", 229 }, - { "finit_module", 344 }, - { "flistxattr", 232 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 235 }, - { "fsconfig", 431 }, - { "fsetxattr", 226 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 108 }, - { "fstat64", 197 }, - { "fstatat64", 293 }, - { "fstatfs", 100 }, - { "fstatfs64", 266 }, - { "fsync", 118 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 93 }, - { "ftruncate64", 194 }, - { "futex", 238 }, - { "futex_time64", 422 }, - { "futimesat", 292 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 269 }, - { "get_robust_list", 305 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 311 }, - { "getcwd", 183 }, - { "getdents", 141 }, - { "getdents64", 220 }, - { "getegid", 50 }, - { "getegid32", 202 }, - { "geteuid", 49 }, - { "geteuid32", 201 }, - { "getgid", 47 }, - { "getgid32", 200 }, - { "getgroups", 80 }, - { "getgroups32", 205 }, - { "getitimer", 105 }, - { "getpeername", 368 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 188 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 349 }, - { "getresgid", 171 }, - { "getresgid32", 211 }, - { "getresuid", 165 }, - { "getresuid32", 209 }, - { "getrlimit", 76 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 367 }, - { "getsockopt", 365 }, - { "gettid", 236 }, - { "gettimeofday", 78 }, - { "getuid", 24 }, - { "getuid32", 199 }, - { "getxattr", 227 }, - { "gtty", __PNR_gtty }, - { "idle", 112 }, - { "init_module", 128 }, - { "inotify_add_watch", 285 }, - { "inotify_init", 284 }, - { "inotify_init1", 324 }, - { "inotify_rm_watch", 286 }, - { "io_cancel", 247 }, - { "io_destroy", 244 }, - { "io_getevents", 245 }, - { "io_pgetevents", 382 }, - { "io_pgetevents_time64", 416 }, - { "io_setup", 243 }, - { "io_submit", 246 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", 101 }, - { "iopl", __PNR_iopl }, - { "ioprio_get", 283 }, - { "ioprio_set", 282 }, - { "ipc", 117 }, - { "kcmp", 343 }, - { "kexec_file_load", 381 }, - { "kexec_load", 277 }, - { "keyctl", 280 }, - { "kill", 37 }, - { "lchown", 16 }, - { "lchown32", 198 }, - { "lgetxattr", 228 }, - { "link", 9 }, - { "linkat", 296 }, - { "listen", 363 }, - { "listxattr", 230 }, - { "llistxattr", 231 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 110 }, - { "lremovexattr", 234 }, - { "lseek", 19 }, - { "lsetxattr", 225 }, - { "lstat", 107 }, - { "lstat64", 196 }, - { "madvise", 219 }, - { "mbind", 268 }, - { "membarrier", 356 }, - { "memfd_create", 350 }, - { "migrate_pages", 287 }, - { "mincore", 218 }, - { "mkdir", 39 }, - { "mkdirat", 289 }, - { "mknod", 14 }, - { "mknodat", 290 }, - { "mlock", 150 }, - { "mlock2", 374 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", 192 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", 21 }, - { "move_mount", 429 }, - { "move_pages", 310 }, - { "mprotect", 125 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 276 }, - { "mq_notify", 275 }, - { "mq_open", 271 }, - { "mq_timedreceive", 274 }, - { "mq_timedreceive_time64", 419 }, - { "mq_timedsend", 273 }, - { "mq_timedsend_time64", 418 }, - { "mq_unlink", 272 }, - { "mremap", 163 }, - { "msgctl", 402 }, - { "msgget", 399 }, - { "msgrcv", 401 }, - { "msgsnd", 400 }, - { "msync", 144 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 335 }, - { "nanosleep", 162 }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", 169 }, - { "nice", 34 }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 336 }, - { "open_tree", 428 }, - { "openat", 288 }, - { "pause", 29 }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 331 }, - { "personality", 136 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 42 }, - { "pipe2", 325 }, - { "pivot_root", 217 }, - { "pkey_alloc", 385 }, - { "pkey_free", 386 }, - { "pkey_mprotect", 384 }, - { "poll", 168 }, - { "ppoll", 302 }, - { "ppoll_time64", 414 }, - { "prctl", 172 }, - { "pread64", 180 }, - { "preadv", 328 }, - { "preadv2", 376 }, - { "prlimit64", 334 }, - { "process_vm_readv", 340 }, - { "process_vm_writev", 341 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 301 }, - { "pselect6_time64", 413 }, - { "ptrace", 26 }, - { "putpmsg", 189 }, - { "pwrite64", 181 }, - { "pwritev", 329 }, - { "pwritev2", 377 }, - { "query_module", 167 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 222 }, - { "readdir", 89 }, - { "readlink", 85 }, - { "readlinkat", 298 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", __PNR_recv }, - { "recvfrom", 371 }, - { "recvmmsg", 357 }, - { "recvmmsg_time64", 417 }, - { "recvmsg", 372 }, - { "remap_file_pages", 267 }, - { "removexattr", 233 }, - { "rename", 38 }, - { "renameat", 295 }, - { "renameat2", 347 }, - { "request_key", 279 }, - { "restart_syscall", 7 }, - { "rmdir", 40 }, - { "rseq", 383 }, - { "rt_sigaction", 174 }, - { "rt_sigpending", 176 }, - { "rt_sigprocmask", 175 }, - { "rt_sigqueueinfo", 178 }, - { "rt_sigreturn", 173 }, - { "rt_sigsuspend", 179 }, - { "rt_sigtimedwait", 177 }, - { "rt_sigtimedwait_time64", 421 }, - { "rt_tgsigqueueinfo", 330 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", 378 }, - { "s390_pci_mmio_read", 353 }, - { "s390_pci_mmio_write", 352 }, - { "s390_runtime_instr", 342 }, - { "s390_sthyi", 380 }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 240 }, - { "sched_getattr", 346 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", 423 }, - { "sched_setaffinity", 239 }, - { "sched_setattr", 345 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 348 }, - { "security", __PNR_security }, - { "select", __PNR_select }, - { "semctl", 394 }, - { "semget", 393 }, - { "semop", __PNR_semop }, - { "semtimedop", __PNR_semtimedop }, - { "semtimedop_time64", 420 }, - { "send", __PNR_send }, - { "sendfile", 187 }, - { "sendfile64", 223 }, - { "sendmmsg", 358 }, - { "sendmsg", 370 }, - { "sendto", 369 }, - { "set_mempolicy", 270 }, - { "set_robust_list", 304 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 252 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 139 }, - { "setfsgid32", 216 }, - { "setfsuid", 138 }, - { "setfsuid32", 215 }, - { "setgid", 46 }, - { "setgid32", 214 }, - { "setgroups", 81 }, - { "setgroups32", 206 }, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 339 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 71 }, - { "setregid32", 204 }, - { "setresgid", 170 }, - { "setresgid32", 210 }, - { "setresuid", 164 }, - { "setresuid32", 208 }, - { "setreuid", 70 }, - { "setreuid32", 203 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 366 }, - { "settimeofday", 79 }, - { "setuid", 23 }, - { "setuid32", 213 }, - { "setxattr", 224 }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", 397 }, - { "shmctl", 396 }, - { "shmdt", 398 }, - { "shmget", 395 }, - { "shutdown", 373 }, - { "sigaction", 67 }, - { "sigaltstack", 186 }, - { "signal", 48 }, - { "signalfd", 316 }, - { "signalfd4", 322 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", 119 }, - { "sigsuspend", 72 }, - { "socket", 359 }, - { "socketcall", 102 }, - { "socketpair", 360 }, - { "splice", 306 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", 106 }, - { "stat64", 195 }, - { "statfs", 99 }, - { "statfs64", 265 }, - { "statx", 379 }, - { "stime", 25 }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", 83 }, - { "symlinkat", 297 }, - { "sync", 36 }, - { "sync_file_range", 307 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 338 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 308 }, - { "tgkill", 241 }, - { "time", 13 }, - { "timer_create", 254 }, - { "timer_delete", 258 }, - { "timer_getoverrun", 257 }, - { "timer_gettime", 256 }, - { "timer_gettime64", 408 }, - { "timer_settime", 255 }, - { "timer_settime64", 409 }, - { "timerfd", 317 }, - { "timerfd_create", 319 }, - { "timerfd_gettime", 321 }, - { "timerfd_gettime64", 410 }, - { "timerfd_settime", 320 }, - { "timerfd_settime64", 411 }, - { "times", 43 }, - { "tkill", 237 }, - { "truncate", 92 }, - { "truncate64", 193 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", 191 }, - { "ulimit", __PNR_ulimit }, - { "umask", 60 }, - { "umount", 22 }, - { "umount2", 52 }, - { "uname", 122 }, - { "unlink", 10 }, - { "unlinkat", 294 }, - { "unshare", 303 }, - { "uselib", 86 }, - { "userfaultfd", 355 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 315 }, - { "utimensat_time64", 412 }, - { "utimes", 313 }, - { "vfork", 190 }, - { "vhangup", 111 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 309 }, - { "vserver", __PNR_vserver }, - { "wait4", 114 }, - { "waitid", 281 }, - { "waitpid", __PNR_waitpid }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int s390_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = s390_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (strcmp(name, "accept") == 0) - return __PNR_accept; - if (strcmp(name, "accept4") == 0) - return __PNR_accept4; - else if (strcmp(name, "bind") == 0) - return __PNR_bind; - else if (strcmp(name, "connect") == 0) - return __PNR_connect; - else if (strcmp(name, "getpeername") == 0) - return __PNR_getpeername; - else if (strcmp(name, "getsockname") == 0) - return __PNR_getsockname; - else if (strcmp(name, "getsockopt") == 0) - return __PNR_getsockopt; - else if (strcmp(name, "listen") == 0) - return __PNR_listen; - else if (strcmp(name, "recv") == 0) - return __PNR_recv; - else if (strcmp(name, "recvfrom") == 0) - return __PNR_recvfrom; - else if (strcmp(name, "recvmsg") == 0) - return __PNR_recvmsg; - else if (strcmp(name, "recvmmsg") == 0) - return __PNR_recvmmsg; - else if (strcmp(name, "send") == 0) - return __PNR_send; - else if (strcmp(name, "sendmsg") == 0) - return __PNR_sendmsg; - else if (strcmp(name, "sendmmsg") == 0) - return __PNR_sendmmsg; - else if (strcmp(name, "sendto") == 0) - return __PNR_sendto; - else if (strcmp(name, "setsockopt") == 0) - return __PNR_setsockopt; - else if (strcmp(name, "shmat") == 0) - return __PNR_shmat; - else if (strcmp(name, "shmdt") == 0) - return __PNR_shmdt; - else if (strcmp(name, "shmget") == 0) - return __PNR_shmget; - else if (strcmp(name, "shmctl") == 0) - return __PNR_shmctl; - else if (strcmp(name, "shutdown") == 0) - return __PNR_shutdown; - else if (strcmp(name, "socket") == 0) - return __PNR_socket; - else if (strcmp(name, "socketpair") == 0) - return __PNR_socketpair; - - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *s390_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = s390_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (num == __PNR_accept) - return "accept"; - else if (num == __PNR_accept4) - return "accept4"; - else if (num == __PNR_bind) - return "bind"; - else if (num == __PNR_connect) - return "connect"; - else if (num == __PNR_getpeername) - return "getpeername"; - else if (num == __PNR_getsockname) - return "getsockname"; - else if (num == __PNR_getsockopt) - return "getsockopt"; - else if (num == __PNR_listen) - return "listen"; - else if (num == __PNR_recv) - return "recv"; - else if (num == __PNR_recvfrom) - return "recvfrom"; - else if (num == __PNR_recvmsg) - return "recvmsg"; - else if (num == __PNR_recvmmsg) - return "recvmmsg"; - else if (num == __PNR_send) - return "send"; - else if (num == __PNR_sendmsg) - return "sendmsg"; - else if (num == __PNR_sendmmsg) - return "sendmmsg"; - else if (num == __PNR_sendto) - return "sendto"; - else if (num == __PNR_setsockopt) - return "setsockopt"; - else if (num == __PNR_shmat) - return "shmat"; - else if (num == __PNR_shmdt) - return "shmdt"; - else if (num == __PNR_shmget) - return "shmget"; - else if (num == __PNR_shmctl) - return "shmctl"; - else if (num == __PNR_shutdown) - return "shutdown"; - else if (num == __PNR_socket) - return "socket"; - else if (num == __PNR_socketpair) - return "socketpair"; - - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *s390_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &s390_syscall_table[spot]; -} diff --git a/src/arch-s390x-syscalls.c b/src/arch-s390x-syscalls.c deleted file mode 100644 index 703eaf12..00000000 --- a/src/arch-s390x-syscalls.c +++ /dev/null @@ -1,642 +0,0 @@ -/* - * Copyright 2015 IBM - * Author: Jan Willeke - */ - -#include - -#include - -#include "arch.h" -#include "arch-s390x.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def s390x_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", __PNR__newselect }, - { "_sysctl", 149 }, - { "accept", __PNR_accept }, - { "accept4", 364 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 278 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", __PNR_arch_prctl }, - { "bdflush", 134 }, - { "bind", 361 }, - { "bpf", 351 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 184 }, - { "capset", 185 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 212 }, - { "chown32", __PNR_chown32 }, - { "chroot", 61 }, - { "clock_adjtime", 337 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 261 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 260 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 262 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 259 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 120 }, - { "clone3", 435 }, - { "close", 6 }, - { "connect", 362 }, - { "copy_file_range", 375 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 326 }, - { "epoll_create", 249 }, - { "epoll_create1", 327 }, - { "epoll_ctl", 250 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 312 }, - { "epoll_wait", 251 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 318 }, - { "eventfd2", 323 }, - { "execve", 11 }, - { "execveat", 354 }, - { "exit", 1 }, - { "exit_group", 248 }, - { "faccessat", 300 }, - { "fadvise64", 253 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", 314 }, - { "fanotify_init", 332 }, - { "fanotify_mark", 333 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 299 }, - { "fchown", 207 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 291 }, - { "fcntl", 55 }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", 148 }, - { "fgetxattr", 229 }, - { "finit_module", 344 }, - { "flistxattr", 232 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 235 }, - { "fsconfig", 431 }, - { "fsetxattr", 226 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 108 }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", 100 }, - { "fstatfs64", 266 }, - { "fsync", 118 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 93 }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", 238 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", 292 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 269 }, - { "get_robust_list", 305 }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 311 }, - { "getcwd", 183 }, - { "getdents", 141 }, - { "getdents64", 220 }, - { "getegid", 202 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 201 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 200 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 205 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 105 }, - { "getpeername", 368 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 188 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 349 }, - { "getresgid", 211 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 209 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 191 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 367 }, - { "getsockopt", 365 }, - { "gettid", 236 }, - { "gettimeofday", 78 }, - { "getuid", 199 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 227 }, - { "gtty", __PNR_gtty }, - { "idle", 112 }, - { "init_module", 128 }, - { "inotify_add_watch", 285 }, - { "inotify_init", 284 }, - { "inotify_init1", 324 }, - { "inotify_rm_watch", 286 }, - { "io_cancel", 247 }, - { "io_destroy", 244 }, - { "io_getevents", 245 }, - { "io_pgetevents", 382 }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 243 }, - { "io_submit", 246 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", __PNR_ioperm}, - { "iopl", __PNR_iopl }, - { "ioprio_get", 283 }, - { "ioprio_set", 282 }, - { "ipc", 117 }, - { "kcmp", 343 }, - { "kexec_file_load", 381 }, - { "kexec_load", 277 }, - { "keyctl", 280 }, - { "kill", 37 }, - { "lchown", 198 }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 228 }, - { "link", 9 }, - { "linkat", 296 }, - { "listen", 363 }, - { "listxattr", 230 }, - { "llistxattr", 231 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 110 }, - { "lremovexattr", 234 }, - { "lseek", 19 }, - { "lsetxattr", 225 }, - { "lstat", 107 }, - { "lstat64", __PNR_lstat64 }, - { "madvise", 219 }, - { "mbind", 268 }, - { "membarrier", 356 }, - { "memfd_create", 350 }, - { "migrate_pages", 287 }, - { "mincore", 218 }, - { "mkdir", 39 }, - { "mkdirat", 289 }, - { "mknod", 14 }, - { "mknodat", 290 }, - { "mlock", 150 }, - { "mlock2", 374 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", __PNR_modify_ldt }, - { "mount", 21 }, - { "move_mount", 429 }, - { "move_pages", 310 }, - { "mprotect", 125 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 276 }, - { "mq_notify", 275 }, - { "mq_open", 271 }, - { "mq_timedreceive", 274 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 273 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 272 }, - { "mremap", 163 }, - { "msgctl", 402 }, - { "msgget", 399 }, - { "msgrcv", 401 }, - { "msgsnd", 400 }, - { "msync", 144 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 335 }, - { "nanosleep", 162 }, - { "newfstatat", 293 }, - { "nfsservctl", 169 }, - { "nice", 34 }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 336 }, - { "open_tree", 428 }, - { "openat", 288 }, - { "pause", 29 }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 331 }, - { "personality", 136 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 42 }, - { "pipe2", 325 }, - { "pivot_root", 217 }, - { "pkey_alloc", 385 }, - { "pkey_free", 386 }, - { "pkey_mprotect", 384 }, - { "poll", 168 }, - { "ppoll", 302 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 172 }, - { "pread64", 180 }, - { "preadv", 328 }, - { "preadv2", 376 }, - { "prlimit64", 334 }, - { "process_vm_readv", 340 }, - { "process_vm_writev", 341 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 301 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 26 }, - { "putpmsg", 189 }, - { "pwrite64", 181 }, - { "pwritev", 329 }, - { "pwritev2", 377 }, - { "query_module", 167 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 222 }, - { "readdir", 89 }, - { "readlink", 85 }, - { "readlinkat", 298 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", __PNR_recv }, - { "recvfrom", 371 }, - { "recvmmsg", 357 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 372 }, - { "remap_file_pages", 267 }, - { "removexattr", 233 }, - { "rename", 38 }, - { "renameat", 295 }, - { "renameat2", 347 }, - { "request_key", 279 }, - { "restart_syscall", 7 }, - { "rmdir", 40 }, - { "rseq", 383 }, - { "rt_sigaction", 174 }, - { "rt_sigpending", 176 }, - { "rt_sigprocmask", 175 }, - { "rt_sigqueueinfo", 178 }, - { "rt_sigreturn", 173 }, - { "rt_sigsuspend", 179 }, - { "rt_sigtimedwait", 177 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 330 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", 378 }, - { "s390_pci_mmio_read", 353 }, - { "s390_pci_mmio_write", 352 }, - { "s390_runtime_instr", 342 }, - { "s390_sthyi", 380 }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 240 }, - { "sched_getattr", 346 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 239 }, - { "sched_setattr", 345 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 348 }, - { "security", __PNR_security }, - { "select", 142 }, - { "semctl", 394 }, - { "semget", 393 }, - { "semop", __PNR_semop }, - { "semtimedop", 392 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", 187 }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", 358 }, - { "sendmsg", 370 }, - { "sendto", 369 }, - { "set_mempolicy", 270 }, - { "set_robust_list", 304 }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", 252 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 216 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 215 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 214 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 206 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 339 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 204 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 210 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 208 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 203 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 366 }, - { "settimeofday", 79 }, - { "setuid", 213 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 224 }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", 397 }, - { "shmctl", 396 }, - { "shmdt", 398 }, - { "shmget", 395 }, - { "shutdown", 373 }, - { "sigaction", 67 }, - { "sigaltstack", 186 }, - { "signal", 48 }, - { "signalfd", 316 }, - { "signalfd4", 322 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", 119 }, - { "sigsuspend", 72 }, - { "socket", 359 }, - { "socketcall", 102 }, - { "socketpair", 360 }, - { "splice", 306 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", 106 }, - { "stat64", __PNR_stat64 }, - { "statfs", 99 }, - { "statfs64", 265 }, - { "statx", 379 }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", 83 }, - { "symlinkat", 297 }, - { "sync", 36 }, - { "sync_file_range", 307 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 338 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 308 }, - { "tgkill", 241 }, - { "time", __PNR_time }, - { "timer_create", 254 }, - { "timer_delete", 258 }, - { "timer_getoverrun", 257 }, - { "timer_gettime", 256 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 255 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", 317 }, - { "timerfd_create", 319 }, - { "timerfd_gettime", 321 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 320 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 43 }, - { "tkill", 237 }, - { "truncate", 92 }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", 60 }, - { "umount", 22 }, - { "umount2", 52 }, - { "uname", 122 }, - { "unlink", 10 }, - { "unlinkat", 294 }, - { "unshare", 303 }, - { "uselib", 86 }, - { "userfaultfd", 355 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 315 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", 313 }, - { "vfork", 190 }, - { "vhangup", 111 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 309 }, - { "vserver", __PNR_vserver }, - { "wait4", 114 }, - { "waitid", 281 }, - { "waitpid", __PNR_waitpid }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int s390x_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = s390x_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (strcmp(name, "accept") == 0) - return __PNR_accept; - if (strcmp(name, "accept4") == 0) - return __PNR_accept4; - else if (strcmp(name, "bind") == 0) - return __PNR_bind; - else if (strcmp(name, "connect") == 0) - return __PNR_connect; - else if (strcmp(name, "getpeername") == 0) - return __PNR_getpeername; - else if (strcmp(name, "getsockname") == 0) - return __PNR_getsockname; - else if (strcmp(name, "getsockopt") == 0) - return __PNR_getsockopt; - else if (strcmp(name, "listen") == 0) - return __PNR_listen; - else if (strcmp(name, "recv") == 0) - return __PNR_recv; - else if (strcmp(name, "recvfrom") == 0) - return __PNR_recvfrom; - else if (strcmp(name, "recvmsg") == 0) - return __PNR_recvmsg; - else if (strcmp(name, "recvmmsg") == 0) - return __PNR_recvmmsg; - else if (strcmp(name, "send") == 0) - return __PNR_send; - else if (strcmp(name, "sendmsg") == 0) - return __PNR_sendmsg; - else if (strcmp(name, "sendmmsg") == 0) - return __PNR_sendmmsg; - else if (strcmp(name, "sendto") == 0) - return __PNR_sendto; - else if (strcmp(name, "setsockopt") == 0) - return __PNR_setsockopt; - else if (strcmp(name, "shmat") == 0) - return __PNR_shmat; - else if (strcmp(name, "shmdt") == 0) - return __PNR_shmdt; - else if (strcmp(name, "shmget") == 0) - return __PNR_shmget; - else if (strcmp(name, "shmctl") == 0) - return __PNR_shmctl; - else if (strcmp(name, "shutdown") == 0) - return __PNR_shutdown; - else if (strcmp(name, "socket") == 0) - return __PNR_socket; - else if (strcmp(name, "socketpair") == 0) - return __PNR_socketpair; - - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *s390x_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = s390x_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (num == __PNR_accept) - return "accept"; - else if (num == __PNR_accept4) - return "accept4"; - else if (num == __PNR_bind) - return "bind"; - else if (num == __PNR_connect) - return "connect"; - else if (num == __PNR_getpeername) - return "getpeername"; - else if (num == __PNR_getsockname) - return "getsockname"; - else if (num == __PNR_getsockopt) - return "getsockopt"; - else if (num == __PNR_listen) - return "listen"; - else if (num == __PNR_recv) - return "recv"; - else if (num == __PNR_recvfrom) - return "recvfrom"; - else if (num == __PNR_recvmsg) - return "recvmsg"; - else if (num == __PNR_recvmmsg) - return "recvmmsg"; - else if (num == __PNR_send) - return "send"; - else if (num == __PNR_sendmsg) - return "sendmsg"; - else if (num == __PNR_sendmmsg) - return "sendmmsg"; - else if (num == __PNR_sendto) - return "sendto"; - else if (num == __PNR_setsockopt) - return "setsockopt"; - else if (num == __PNR_shmat) - return "shmat"; - else if (num == __PNR_shmdt) - return "shmdt"; - else if (num == __PNR_shmget) - return "shmget"; - else if (num == __PNR_shmctl) - return "shmctl"; - else if (num == __PNR_shutdown) - return "shutdown"; - else if (num == __PNR_socket) - return "socket"; - else if (num == __PNR_socketpair) - return "socketpair"; - - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *s390x_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &s390x_syscall_table[spot]; -} diff --git a/src/arch-x32-syscalls.c b/src/arch-x32-syscalls.c deleted file mode 100644 index e5cfadba..00000000 --- a/src/arch-x32-syscalls.c +++ /dev/null @@ -1,558 +0,0 @@ -/** - * Enhanced Seccomp x32 Syscall Table - * - * Copyright (c) 2013 Red Hat - * Author: Paul Moore - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-x32.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def x32_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", __PNR__newselect }, - { "_sysctl", __PNR__sysctl }, - { "accept", (X32_SYSCALL_BIT + 43) }, - { "accept4", (X32_SYSCALL_BIT + 288) }, - { "access", (X32_SYSCALL_BIT + 21) }, - { "acct", (X32_SYSCALL_BIT + 163) }, - { "add_key", (X32_SYSCALL_BIT + 248) }, - { "adjtimex", (X32_SYSCALL_BIT + 159) }, - { "afs_syscall", (X32_SYSCALL_BIT + 183) }, - { "alarm", (X32_SYSCALL_BIT + 37) }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", (X32_SYSCALL_BIT + 158) }, - { "bdflush", __PNR_bdflush }, - { "bind", (X32_SYSCALL_BIT + 49) }, - { "bpf", (X32_SYSCALL_BIT + 321) }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", (X32_SYSCALL_BIT + 12) }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", (X32_SYSCALL_BIT + 125) }, - { "capset", (X32_SYSCALL_BIT + 126) }, - { "chdir", (X32_SYSCALL_BIT + 80) }, - { "chmod", (X32_SYSCALL_BIT + 90) }, - { "chown", (X32_SYSCALL_BIT + 92) }, - { "chown32", __PNR_chown32 }, - { "chroot", (X32_SYSCALL_BIT + 161) }, - { "clock_adjtime", (X32_SYSCALL_BIT + 305) }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", (X32_SYSCALL_BIT + 229) }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", (X32_SYSCALL_BIT + 228) }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", (X32_SYSCALL_BIT + 230) }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", (X32_SYSCALL_BIT + 227) }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", (X32_SYSCALL_BIT + 56) }, - { "clone3", (X32_SYSCALL_BIT + 435) }, - { "close", (X32_SYSCALL_BIT + 3) }, - { "connect", (X32_SYSCALL_BIT + 42) }, - { "copy_file_range", (X32_SYSCALL_BIT + 326) }, - { "creat", (X32_SYSCALL_BIT + 85) }, - { "create_module", __PNR_create_module }, - { "delete_module", (X32_SYSCALL_BIT + 176) }, - { "dup", (X32_SYSCALL_BIT + 32) }, - { "dup2", (X32_SYSCALL_BIT + 33) }, - { "dup3", (X32_SYSCALL_BIT + 292) }, - { "epoll_create", (X32_SYSCALL_BIT + 213) }, - { "epoll_create1", (X32_SYSCALL_BIT + 291) }, - { "epoll_ctl", (X32_SYSCALL_BIT + 233) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (X32_SYSCALL_BIT + 281) }, - { "epoll_wait", (X32_SYSCALL_BIT + 232) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (X32_SYSCALL_BIT + 284) }, - { "eventfd2", (X32_SYSCALL_BIT + 290) }, - { "execve", (X32_SYSCALL_BIT + 520) }, - { "execveat", (X32_SYSCALL_BIT + 545) }, - { "exit", (X32_SYSCALL_BIT + 60) }, - { "exit_group", (X32_SYSCALL_BIT + 231) }, - { "faccessat", (X32_SYSCALL_BIT + 269) }, - { "fadvise64", (X32_SYSCALL_BIT + 221) }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (X32_SYSCALL_BIT + 285) }, - { "fanotify_init", (X32_SYSCALL_BIT + 300) }, - { "fanotify_mark", (X32_SYSCALL_BIT + 301) }, - { "fchdir", (X32_SYSCALL_BIT + 81) }, - { "fchmod", (X32_SYSCALL_BIT + 91) }, - { "fchmodat", (X32_SYSCALL_BIT + 268) }, - { "fchown", (X32_SYSCALL_BIT + 93) }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", (X32_SYSCALL_BIT + 260) }, - { "fcntl", (X32_SYSCALL_BIT + 72) }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", (X32_SYSCALL_BIT + 75) }, - { "fgetxattr", (X32_SYSCALL_BIT + 193) }, - { "finit_module", (X32_SYSCALL_BIT + 313) }, - { "flistxattr", (X32_SYSCALL_BIT + 196) }, - { "flock", (X32_SYSCALL_BIT + 73) }, - { "fork", (X32_SYSCALL_BIT + 57) }, - { "fremovexattr", (X32_SYSCALL_BIT + 199) }, - { "fsconfig", (X32_SYSCALL_BIT + 431) }, - { "fsetxattr", (X32_SYSCALL_BIT + 190) }, - { "fsmount", (X32_SYSCALL_BIT + 432) }, - { "fsopen", (X32_SYSCALL_BIT + 430) }, - { "fspick", (X32_SYSCALL_BIT + 433) }, - { "fstat", (X32_SYSCALL_BIT + 5) }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", (X32_SYSCALL_BIT + 138) }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", (X32_SYSCALL_BIT + 74) }, - { "ftime", __PNR_ftime }, - { "ftruncate", (X32_SYSCALL_BIT + 77) }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", (X32_SYSCALL_BIT + 202) }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", (X32_SYSCALL_BIT + 261) }, - { "get_kernel_syms", __PNR_get_kernel_syms }, - { "get_mempolicy", (X32_SYSCALL_BIT + 239) }, - { "get_robust_list", (X32_SYSCALL_BIT + 531) }, - { "get_thread_area", __PNR_get_thread_area }, - { "get_tls", __PNR_get_tls }, - { "getcpu", (X32_SYSCALL_BIT + 309) }, - { "getcwd", (X32_SYSCALL_BIT + 79) }, - { "getdents", (X32_SYSCALL_BIT + 78) }, - { "getdents64", (X32_SYSCALL_BIT + 217) }, - { "getegid", (X32_SYSCALL_BIT + 108) }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", (X32_SYSCALL_BIT + 107) }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", (X32_SYSCALL_BIT + 104) }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", (X32_SYSCALL_BIT + 115) }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", (X32_SYSCALL_BIT + 36) }, - { "getpeername", (X32_SYSCALL_BIT + 52) }, - { "getpgid", (X32_SYSCALL_BIT + 121) }, - { "getpgrp", (X32_SYSCALL_BIT + 111) }, - { "getpid", (X32_SYSCALL_BIT + 39) }, - { "getpmsg", (X32_SYSCALL_BIT + 181) }, - { "getppid", (X32_SYSCALL_BIT + 110) }, - { "getpriority", (X32_SYSCALL_BIT + 140) }, - { "getrandom", (X32_SYSCALL_BIT + 318) }, - { "getresgid", (X32_SYSCALL_BIT + 120) }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", (X32_SYSCALL_BIT + 118) }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", (X32_SYSCALL_BIT + 97) }, - { "getrusage", (X32_SYSCALL_BIT + 98) }, - { "getsid", (X32_SYSCALL_BIT + 124) }, - { "getsockname", (X32_SYSCALL_BIT + 51) }, - { "getsockopt", (X32_SYSCALL_BIT + 542) }, - { "gettid", (X32_SYSCALL_BIT + 186) }, - { "gettimeofday", (X32_SYSCALL_BIT + 96) }, - { "getuid", (X32_SYSCALL_BIT + 102) }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", (X32_SYSCALL_BIT + 191) }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", (X32_SYSCALL_BIT + 175) }, - { "inotify_add_watch", (X32_SYSCALL_BIT + 254) }, - { "inotify_init", (X32_SYSCALL_BIT + 253) }, - { "inotify_init1", (X32_SYSCALL_BIT + 294) }, - { "inotify_rm_watch", (X32_SYSCALL_BIT + 255) }, - { "io_cancel", (X32_SYSCALL_BIT + 210) }, - { "io_destroy", (X32_SYSCALL_BIT + 207) }, - { "io_getevents", (X32_SYSCALL_BIT + 208) }, - { "io_pgetevents", (X32_SYSCALL_BIT + 333) }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", (X32_SYSCALL_BIT + 543) }, - { "io_submit", (X32_SYSCALL_BIT + 544) }, - { "io_uring_setup", (X32_SYSCALL_BIT + 425) }, - { "io_uring_enter", (X32_SYSCALL_BIT + 426) }, - { "io_uring_register", (X32_SYSCALL_BIT + 427) }, - { "ioctl", (X32_SYSCALL_BIT + 514) }, - { "ioperm", (X32_SYSCALL_BIT + 173) }, - { "iopl", (X32_SYSCALL_BIT + 172) }, - { "ioprio_get", (X32_SYSCALL_BIT + 252) }, - { "ioprio_set", (X32_SYSCALL_BIT + 251) }, - { "ipc", __PNR_ipc }, - { "kcmp", (X32_SYSCALL_BIT + 312) }, - { "kexec_file_load", (X32_SYSCALL_BIT + 320) }, - { "kexec_load", (X32_SYSCALL_BIT + 528) }, - { "keyctl", (X32_SYSCALL_BIT + 250) }, - { "kill", (X32_SYSCALL_BIT + 62) }, - { "lchown", (X32_SYSCALL_BIT + 94) }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", (X32_SYSCALL_BIT + 192) }, - { "link", (X32_SYSCALL_BIT + 86) }, - { "linkat", (X32_SYSCALL_BIT + 265) }, - { "listen", (X32_SYSCALL_BIT + 50) }, - { "listxattr", (X32_SYSCALL_BIT + 194) }, - { "llistxattr", (X32_SYSCALL_BIT + 195) }, - { "lock", __PNR_lock }, - { "lookup_dcookie", (X32_SYSCALL_BIT + 212) }, - { "lremovexattr", (X32_SYSCALL_BIT + 198) }, - { "lseek", (X32_SYSCALL_BIT + 8) }, - { "lsetxattr", (X32_SYSCALL_BIT + 189) }, - { "lstat", (X32_SYSCALL_BIT + 6) }, - { "lstat64", __PNR_lstat64 }, - { "madvise", (X32_SYSCALL_BIT + 28) }, - { "mbind", (X32_SYSCALL_BIT + 237) }, - { "membarrier", (X32_SYSCALL_BIT + 324) }, - { "memfd_create", (X32_SYSCALL_BIT + 319) }, - { "migrate_pages", (X32_SYSCALL_BIT + 256) }, - { "mincore", (X32_SYSCALL_BIT + 27) }, - { "mkdir", (X32_SYSCALL_BIT + 83) }, - { "mkdirat", (X32_SYSCALL_BIT + 258) }, - { "mknod", (X32_SYSCALL_BIT + 133) }, - { "mknodat", (X32_SYSCALL_BIT + 259) }, - { "mlock", (X32_SYSCALL_BIT + 149) }, - { "mlock2", (X32_SYSCALL_BIT + 325) }, - { "mlockall", (X32_SYSCALL_BIT + 151) }, - { "mmap", (X32_SYSCALL_BIT + 9) }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", (X32_SYSCALL_BIT + 154) }, - { "mount", (X32_SYSCALL_BIT + 165) }, - { "move_mount", (X32_SYSCALL_BIT + 429) }, - { "move_pages", (X32_SYSCALL_BIT + 533) }, - { "mprotect", (X32_SYSCALL_BIT + 10) }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", (X32_SYSCALL_BIT + 245) }, - { "mq_notify", (X32_SYSCALL_BIT + 527) }, - { "mq_open", (X32_SYSCALL_BIT + 240) }, - { "mq_timedreceive", (X32_SYSCALL_BIT + 243) }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", (X32_SYSCALL_BIT + 242) }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", (X32_SYSCALL_BIT + 241) }, - { "mremap", (X32_SYSCALL_BIT + 25) }, - { "msgctl", (X32_SYSCALL_BIT + 71) }, - { "msgget", (X32_SYSCALL_BIT + 68) }, - { "msgrcv", (X32_SYSCALL_BIT + 70) }, - { "msgsnd", (X32_SYSCALL_BIT + 69) }, - { "msync", (X32_SYSCALL_BIT + 26) }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", (X32_SYSCALL_BIT + 150) }, - { "munlockall", (X32_SYSCALL_BIT + 152) }, - { "munmap", (X32_SYSCALL_BIT + 11) }, - { "name_to_handle_at", (X32_SYSCALL_BIT + 303) }, - { "nanosleep", (X32_SYSCALL_BIT + 35) }, - { "newfstatat", (X32_SYSCALL_BIT + 262) }, - { "nfsservctl", __PNR_nfsservctl }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", (X32_SYSCALL_BIT + 2) }, - { "open_by_handle_at", (X32_SYSCALL_BIT + 304) }, - { "open_tree", (X32_SYSCALL_BIT + 428) }, - { "openat", (X32_SYSCALL_BIT + 257) }, - { "pause", (X32_SYSCALL_BIT + 34) }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", (X32_SYSCALL_BIT + 298) }, - { "personality", (X32_SYSCALL_BIT + 135) }, - { "pidfd_open", (X32_SYSCALL_BIT + 434) }, - { "pidfd_send_signal", (X32_SYSCALL_BIT + 424) }, - { "pipe", (X32_SYSCALL_BIT + 22) }, - { "pipe2", (X32_SYSCALL_BIT + 293) }, - { "pivot_root", (X32_SYSCALL_BIT + 155) }, - { "pkey_alloc", (X32_SYSCALL_BIT + 330) }, - { "pkey_free", (X32_SYSCALL_BIT + 331) }, - { "pkey_mprotect", (X32_SYSCALL_BIT + 329) }, - { "poll", (X32_SYSCALL_BIT + 7) }, - { "ppoll", (X32_SYSCALL_BIT + 271) }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", (X32_SYSCALL_BIT + 157) }, - { "pread64", (X32_SYSCALL_BIT + 17) }, - { "preadv", (X32_SYSCALL_BIT + 534) }, - { "preadv2", (X32_SYSCALL_BIT + 546) }, - { "prlimit64", (X32_SYSCALL_BIT + 302) }, - { "process_vm_readv", (X32_SYSCALL_BIT + 539) }, - { "process_vm_writev", (X32_SYSCALL_BIT + 540) }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", (X32_SYSCALL_BIT + 270) }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", (X32_SYSCALL_BIT + 521) }, - { "putpmsg", (X32_SYSCALL_BIT + 182) }, - { "pwrite64", (X32_SYSCALL_BIT + 18) }, - { "pwritev", (X32_SYSCALL_BIT + 535) }, - { "pwritev2", (X32_SYSCALL_BIT + 547) }, - { "query_module", __PNR_query_module }, - { "quotactl", (X32_SYSCALL_BIT + 179) }, - { "read", (X32_SYSCALL_BIT + 0) }, - { "readahead", (X32_SYSCALL_BIT + 187) }, - { "readdir", __PNR_readdir }, - { "readlink", (X32_SYSCALL_BIT + 89) }, - { "readlinkat", (X32_SYSCALL_BIT + 267) }, - { "readv", (X32_SYSCALL_BIT + 515) }, - { "reboot", (X32_SYSCALL_BIT + 169) }, - { "recv", __PNR_recv }, - { "recvfrom", (X32_SYSCALL_BIT + 517) }, - { "recvmmsg", (X32_SYSCALL_BIT + 537) }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", (X32_SYSCALL_BIT + 519) }, - { "remap_file_pages", (X32_SYSCALL_BIT + 216) }, - { "removexattr", (X32_SYSCALL_BIT + 197) }, - { "rename", (X32_SYSCALL_BIT + 82) }, - { "renameat", (X32_SYSCALL_BIT + 264) }, - { "renameat2", (X32_SYSCALL_BIT + 316) }, - { "request_key", (X32_SYSCALL_BIT + 249) }, - { "restart_syscall", (X32_SYSCALL_BIT + 219) }, - { "rmdir", (X32_SYSCALL_BIT + 84) }, - { "rseq", (X32_SYSCALL_BIT + 334) }, - { "rt_sigaction", (X32_SYSCALL_BIT + 512) }, - { "rt_sigpending", (X32_SYSCALL_BIT + 522) }, - { "rt_sigprocmask", (X32_SYSCALL_BIT + 14) }, - { "rt_sigqueueinfo", (X32_SYSCALL_BIT + 524) }, - { "rt_sigreturn", (X32_SYSCALL_BIT + 513) }, - { "rt_sigsuspend", (X32_SYSCALL_BIT + 130) }, - { "rt_sigtimedwait", (X32_SYSCALL_BIT + 523) }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", (X32_SYSCALL_BIT + 536) }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", (X32_SYSCALL_BIT + 146) }, - { "sched_get_priority_min", (X32_SYSCALL_BIT + 147) }, - { "sched_getaffinity", (X32_SYSCALL_BIT + 204) }, - { "sched_getattr", (X32_SYSCALL_BIT + 315) }, - { "sched_getparam", (X32_SYSCALL_BIT + 143) }, - { "sched_getscheduler", (X32_SYSCALL_BIT + 145) }, - { "sched_rr_get_interval", (X32_SYSCALL_BIT + 148) }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", (X32_SYSCALL_BIT + 203) }, - { "sched_setattr", (X32_SYSCALL_BIT + 314) }, - { "sched_setparam", (X32_SYSCALL_BIT + 142) }, - { "sched_setscheduler", (X32_SYSCALL_BIT + 144) }, - { "sched_yield", (X32_SYSCALL_BIT + 24) }, - { "seccomp", (X32_SYSCALL_BIT + 317) }, - { "security", (X32_SYSCALL_BIT + 185) }, - { "select", (X32_SYSCALL_BIT + 23) }, - { "semctl", (X32_SYSCALL_BIT + 66) }, - { "semget", (X32_SYSCALL_BIT + 64) }, - { "semop", (X32_SYSCALL_BIT + 65) }, - { "semtimedop", (X32_SYSCALL_BIT + 220) }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", (X32_SYSCALL_BIT + 40) }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", (X32_SYSCALL_BIT + 538) }, - { "sendmsg", (X32_SYSCALL_BIT + 518) }, - { "sendto", (X32_SYSCALL_BIT + 44) }, - { "set_mempolicy", (X32_SYSCALL_BIT + 238) }, - { "set_robust_list", (X32_SYSCALL_BIT + 530) }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", (X32_SYSCALL_BIT + 218) }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", (X32_SYSCALL_BIT + 171) }, - { "setfsgid", (X32_SYSCALL_BIT + 123) }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", (X32_SYSCALL_BIT + 122) }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", (X32_SYSCALL_BIT + 106) }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", (X32_SYSCALL_BIT + 116) }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", (X32_SYSCALL_BIT + 170) }, - { "setitimer", (X32_SYSCALL_BIT + 38) }, - { "setns", (X32_SYSCALL_BIT + 308) }, - { "setpgid", (X32_SYSCALL_BIT + 109) }, - { "setpriority", (X32_SYSCALL_BIT + 141) }, - { "setregid", (X32_SYSCALL_BIT + 114) }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", (X32_SYSCALL_BIT + 119) }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", (X32_SYSCALL_BIT + 117) }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", (X32_SYSCALL_BIT + 113) }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", (X32_SYSCALL_BIT + 160) }, - { "setsid", (X32_SYSCALL_BIT + 112) }, - { "setsockopt", (X32_SYSCALL_BIT + 541) }, - { "settimeofday", (X32_SYSCALL_BIT + 164) }, - { "setuid", (X32_SYSCALL_BIT + 105) }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", (X32_SYSCALL_BIT + 188) }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", (X32_SYSCALL_BIT + 30) }, - { "shmctl", (X32_SYSCALL_BIT + 31) }, - { "shmdt", (X32_SYSCALL_BIT + 67) }, - { "shmget", (X32_SYSCALL_BIT + 29) }, - { "shutdown", (X32_SYSCALL_BIT + 48) }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", (X32_SYSCALL_BIT + 525) }, - { "signal", __PNR_signal }, - { "signalfd", (X32_SYSCALL_BIT + 282) }, - { "signalfd4", (X32_SYSCALL_BIT + 289) }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", (X32_SYSCALL_BIT + 41) }, - { "socketcall", __PNR_socketcall }, - { "socketpair", (X32_SYSCALL_BIT + 53) }, - { "splice", (X32_SYSCALL_BIT + 275) }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", (X32_SYSCALL_BIT + 4) }, - { "stat64", __PNR_stat64 }, - { "statfs", (X32_SYSCALL_BIT + 137) }, - { "statfs64", __PNR_statfs64 }, - { "statx", (X32_SYSCALL_BIT + 332) }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", (X32_SYSCALL_BIT + 168) }, - { "swapon", (X32_SYSCALL_BIT + 167) }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", (X32_SYSCALL_BIT + 88) }, - { "symlinkat", (X32_SYSCALL_BIT + 266) }, - { "sync", (X32_SYSCALL_BIT + 162) }, - { "sync_file_range", (X32_SYSCALL_BIT + 277) }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", (X32_SYSCALL_BIT + 306) }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", (X32_SYSCALL_BIT + 139) }, - { "sysinfo", (X32_SYSCALL_BIT + 99) }, - { "syslog", (X32_SYSCALL_BIT + 103) }, - { "sysmips", __PNR_sysmips }, - { "tee", (X32_SYSCALL_BIT + 276) }, - { "tgkill", (X32_SYSCALL_BIT + 234) }, - { "time", (X32_SYSCALL_BIT + 201) }, - { "timer_create", (X32_SYSCALL_BIT + 526) }, - { "timer_delete", (X32_SYSCALL_BIT + 226) }, - { "timer_getoverrun", (X32_SYSCALL_BIT + 225) }, - { "timer_gettime", (X32_SYSCALL_BIT + 224) }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", (X32_SYSCALL_BIT + 223) }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", (X32_SYSCALL_BIT + 283) }, - { "timerfd_gettime", (X32_SYSCALL_BIT + 287) }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", (X32_SYSCALL_BIT + 286) }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", (X32_SYSCALL_BIT + 100) }, - { "tkill", (X32_SYSCALL_BIT + 200) }, - { "truncate", (X32_SYSCALL_BIT + 76) }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", (X32_SYSCALL_BIT + 184) }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", (X32_SYSCALL_BIT + 95) }, - { "umount", __PNR_umount }, - { "umount2", (X32_SYSCALL_BIT + 166) }, - { "uname", (X32_SYSCALL_BIT + 63) }, - { "unlink", (X32_SYSCALL_BIT + 87) }, - { "unlinkat", (X32_SYSCALL_BIT + 263) }, - { "unshare", (X32_SYSCALL_BIT + 272) }, - { "uselib", __PNR_uselib }, - { "userfaultfd", (X32_SYSCALL_BIT + 323) }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", (X32_SYSCALL_BIT + 136) }, - { "utime", (X32_SYSCALL_BIT + 132) }, - { "utimensat", (X32_SYSCALL_BIT + 280) }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", (X32_SYSCALL_BIT + 235) }, - { "vfork", (X32_SYSCALL_BIT + 58) }, - { "vhangup", (X32_SYSCALL_BIT + 153) }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (X32_SYSCALL_BIT + 532) }, - { "vserver", __PNR_vserver }, - { "wait4", (X32_SYSCALL_BIT + 61) }, - { "waitid", (X32_SYSCALL_BIT + 529) }, - { "waitpid", __PNR_waitpid }, - { "write", (X32_SYSCALL_BIT + 1) }, - { "writev", (X32_SYSCALL_BIT + 516) }, - { NULL, __NR_SCMP_ERROR}, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int x32_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = x32_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *x32_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = x32_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *x32_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &x32_syscall_table[spot]; -} diff --git a/src/arch-x86-syscalls.c b/src/arch-x86-syscalls.c deleted file mode 100644 index ff555e9f..00000000 --- a/src/arch-x86-syscalls.c +++ /dev/null @@ -1,692 +0,0 @@ -/** - * Enhanced Seccomp x86 Syscall Table - * - * Copyright (c) 2012 Red Hat - * Author: Paul Moore - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-x86.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def x86_syscall_table[] = { \ - { "_llseek", 140 }, - { "_newselect", 142 }, - { "_sysctl", 149 }, - { "accept", __PNR_accept }, - { "accept4", 364 }, - { "access", 33 }, - { "acct", 51 }, - { "add_key", 286 }, - { "adjtimex", 124 }, - { "afs_syscall", 137 }, - { "alarm", 27 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", 384 }, - { "bdflush", 134 }, - { "bind", 361 }, - { "bpf", 357 }, - { "break", 17 }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 45 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 184 }, - { "capset", 185 }, - { "chdir", 12 }, - { "chmod", 15 }, - { "chown", 182 }, - { "chown32", 212 }, - { "chroot", 61 }, - { "clock_adjtime", 343 }, - { "clock_adjtime64", 405 }, - { "clock_getres", 266 }, - { "clock_getres_time64", 406 }, - { "clock_gettime", 265 }, - { "clock_gettime64", 403 }, - { "clock_nanosleep", 267 }, - { "clock_nanosleep_time64", 407 }, - { "clock_settime", 264 }, - { "clock_settime64", 404 }, - { "clone", 120 }, - { "clone3", 435 }, - { "close", 6 }, - { "connect", 362 }, - { "copy_file_range", 377 }, - { "creat", 8 }, - { "create_module", 127 }, - { "delete_module", 129 }, - { "dup", 41 }, - { "dup2", 63 }, - { "dup3", 330 }, - { "epoll_create", 254 }, - { "epoll_create1", 329 }, - { "epoll_ctl", 255 }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", 319 }, - { "epoll_wait", 256 }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", 323 }, - { "eventfd2", 328 }, - { "execve", 11 }, - { "execveat", 358 }, - { "exit", 1 }, - { "exit_group", 252 }, - { "faccessat", 307 }, - { "fadvise64", 250 }, - { "fadvise64_64", 272 }, - { "fallocate", 324 }, - { "fanotify_init", 338 }, - { "fanotify_mark", 339 }, - { "fchdir", 133 }, - { "fchmod", 94 }, - { "fchmodat", 306 }, - { "fchown", 95 }, - { "fchown32", 207 }, - { "fchownat", 298 }, - { "fcntl", 55 }, - { "fcntl64", 221 }, - { "fdatasync", 148 }, - { "fgetxattr", 231 }, - { "finit_module", 350 }, - { "flistxattr", 234 }, - { "flock", 143 }, - { "fork", 2 }, - { "fremovexattr", 237 }, - { "fsconfig", 431 }, - { "fsetxattr", 228 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 108 }, - { "fstat64", 197 }, - { "fstatat64", 300 }, - { "fstatfs", 100 }, - { "fstatfs64", 269 }, - { "fsync", 118 }, - { "ftime", 35 }, - { "ftruncate", 93 }, - { "ftruncate64", 194 }, - { "futex", 240 }, - { "futex_time64", 422 }, - { "futimesat", 299 }, - { "get_kernel_syms", 130 }, - { "get_mempolicy", 275 }, - { "get_robust_list", 312 }, - { "get_thread_area", 244 }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 318 }, - { "getcwd", 183 }, - { "getdents", 141 }, - { "getdents64", 220 }, - { "getegid", 50 }, - { "getegid32", 202 }, - { "geteuid", 49 }, - { "geteuid32", 201 }, - { "getgid", 47 }, - { "getgid32", 200 }, - { "getgroups", 80 }, - { "getgroups32", 205 }, - { "getitimer", 105 }, - { "getpeername", 368 }, - { "getpgid", 132 }, - { "getpgrp", 65 }, - { "getpid", 20 }, - { "getpmsg", 188 }, - { "getppid", 64 }, - { "getpriority", 96 }, - { "getrandom", 355 }, - { "getresgid", 171 }, - { "getresgid32", 211 }, - { "getresuid", 165 }, - { "getresuid32", 209 }, - { "getrlimit", 76 }, - { "getrusage", 77 }, - { "getsid", 147 }, - { "getsockname", 367 }, - { "getsockopt", 365 }, - { "gettid", 224 }, - { "gettimeofday", 78 }, - { "getuid", 24 }, - { "getuid32", 199 }, - { "getxattr", 229 }, - { "gtty", 32 }, - { "idle", 112 }, - { "init_module", 128 }, - { "inotify_add_watch", 292 }, - { "inotify_init", 291 }, - { "inotify_init1", 332 }, - { "inotify_rm_watch", 293 }, - { "io_cancel", 249 }, - { "io_destroy", 246 }, - { "io_getevents", 247 }, - { "io_pgetevents", 385 }, - { "io_pgetevents_time64", 416 }, - { "io_setup", 245 }, - { "io_submit", 248 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 54 }, - { "ioperm", 101 }, - { "iopl", 110 }, - { "ioprio_get", 290 }, - { "ioprio_set", 289 }, - { "ipc", 117 }, - { "kcmp", 349 }, - { "kexec_file_load", __PNR_kexec_file_load }, - { "kexec_load", 283 }, - { "keyctl", 288 }, - { "kill", 37 }, - { "lchown", 16 }, - { "lchown32", 198 }, - { "lgetxattr", 230 }, - { "link", 9 }, - { "linkat", 303 }, - { "listen", 363 }, - { "listxattr", 232 }, - { "llistxattr", 233 }, - { "lock", 53 }, - { "lookup_dcookie", 253 }, - { "lremovexattr", 236 }, - { "lseek", 19 }, - { "lsetxattr", 227 }, - { "lstat", 107 }, - { "lstat64", 196 }, - { "madvise", 219 }, - { "mbind", 274 }, - { "membarrier", 375 }, - { "memfd_create", 356 }, - { "migrate_pages", 294 }, - { "mincore", 218 }, - { "mkdir", 39 }, - { "mkdirat", 296 }, - { "mknod", 14 }, - { "mknodat", 297 }, - { "mlock", 150 }, - { "mlock2", 376 }, - { "mlockall", 152 }, - { "mmap", 90 }, - { "mmap2", 192 }, - { "modify_ldt", 123 }, - { "mount", 21 }, - { "move_mount", 429 }, - { "move_pages", 317 }, - { "mprotect", 125 }, - { "mpx", 56 }, - { "mq_getsetattr", 282 }, - { "mq_notify", 281 }, - { "mq_open", 277 }, - { "mq_timedreceive", 280 }, - { "mq_timedreceive_time64", 419 }, - { "mq_timedsend", 279 }, - { "mq_timedsend_time64", 418 }, - { "mq_unlink", 278 }, - { "mremap", 163 }, - { "msgctl", 402 }, - { "msgget", 399 }, - { "msgrcv", 401 }, - { "msgsnd", 400 }, - { "msync", 144 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 151 }, - { "munlockall", 153 }, - { "munmap", 91 }, - { "name_to_handle_at", 341 }, - { "nanosleep", 162 }, - { "newfstatat", __PNR_newfstatat }, - { "nfsservctl", 169 }, - { "nice", 34 }, - { "oldfstat", 28 }, - { "oldlstat", 84 }, - { "oldolduname", 59 }, - { "oldstat", 18 }, - { "olduname", 109 }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 5 }, - { "open_by_handle_at", 342 }, - { "open_tree", 428 }, - { "openat", 295 }, - { "pause", 29 }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 336 }, - { "personality", 136 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 42 }, - { "pipe2", 331 }, - { "pivot_root", 217 }, - { "pkey_alloc", 381 }, - { "pkey_free", 382 }, - { "pkey_mprotect", 380 }, - { "poll", 168 }, - { "ppoll", 309 }, - { "ppoll_time64", 414 }, - { "prctl", 172 }, - { "pread64", 180 }, - { "preadv", 333 }, - { "preadv2", 378 }, - { "prlimit64", 340 }, - { "process_vm_readv", 347 }, - { "process_vm_writev", 348 }, - { "prof", 44 }, - { "profil", 98 }, - { "pselect6", 308 }, - { "pselect6_time64", 413 }, - { "ptrace", 26 }, - { "putpmsg", 189 }, - { "pwrite64", 181 }, - { "pwritev", 334 }, - { "pwritev2", 379 }, - { "query_module", 167 }, - { "quotactl", 131 }, - { "read", 3 }, - { "readahead", 225 }, - { "readdir", 89 }, - { "readlink", 85 }, - { "readlinkat", 305 }, - { "readv", 145 }, - { "reboot", 88 }, - { "recv", __PNR_recv }, - { "recvfrom", 371 }, - { "recvmmsg", 337 }, - { "recvmmsg_time64", 417 }, - { "recvmsg", 372 }, - { "remap_file_pages", 257 }, - { "removexattr", 235 }, - { "rename", 38 }, - { "renameat", 302 }, - { "renameat2", 353 }, - { "request_key", 287 }, - { "restart_syscall", 0 }, - { "rmdir", 40 }, - { "rseq", 386 }, - { "rt_sigaction", 174 }, - { "rt_sigpending", 176 }, - { "rt_sigprocmask", 175 }, - { "rt_sigqueueinfo", 178 }, - { "rt_sigreturn", 173 }, - { "rt_sigsuspend", 179 }, - { "rt_sigtimedwait", 177 }, - { "rt_sigtimedwait_time64", 421 }, - { "rt_tgsigqueueinfo", 335 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 159 }, - { "sched_get_priority_min", 160 }, - { "sched_getaffinity", 242 }, - { "sched_getattr", 352 }, - { "sched_getparam", 155 }, - { "sched_getscheduler", 157 }, - { "sched_rr_get_interval", 161 }, - { "sched_rr_get_interval_time64", 423 }, - { "sched_setaffinity", 241 }, - { "sched_setattr", 351 }, - { "sched_setparam", 154 }, - { "sched_setscheduler", 156 }, - { "sched_yield", 158 }, - { "seccomp", 354 }, - { "security", __PNR_security }, - { "select", 82 }, - { "semctl", 394 }, - { "semget", 393 }, - { "semop", __PNR_semop }, - { "semtimedop", __PNR_semtimedop }, - { "semtimedop_time64", 420 }, - { "send", __PNR_send }, - { "sendfile", 187 }, - { "sendfile64", 239 }, - { "sendmmsg", 345 }, - { "sendmsg", 370 }, - { "sendto", 369 }, - { "set_mempolicy", 276 }, - { "set_robust_list", 311 }, - { "set_thread_area", 243 }, - { "set_tid_address", 258 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 121 }, - { "setfsgid", 139 }, - { "setfsgid32", 216 }, - { "setfsuid", 138 }, - { "setfsuid32", 215 }, - { "setgid", 46 }, - { "setgid32", 214 }, - { "setgroups", 81 }, - { "setgroups32", 206 }, - { "sethostname", 74 }, - { "setitimer", 104 }, - { "setns", 346 }, - { "setpgid", 57 }, - { "setpriority", 97 }, - { "setregid", 71 }, - { "setregid32", 204 }, - { "setresgid", 170 }, - { "setresgid32", 210 }, - { "setresuid", 164 }, - { "setresuid32", 208 }, - { "setreuid", 70 }, - { "setreuid32", 203 }, - { "setrlimit", 75 }, - { "setsid", 66 }, - { "setsockopt", 366 }, - { "settimeofday", 79 }, - { "setuid", 23 }, - { "setuid32", 213 }, - { "setxattr", 226 }, - { "sgetmask", 68 }, - { "shmat", 397 }, - { "shmctl", 396 }, - { "shmdt", 398 }, - { "shmget", 395 }, - { "shutdown", 373 }, - { "sigaction", 67 }, - { "sigaltstack", 186 }, - { "signal", 48 }, - { "signalfd", 321 }, - { "signalfd4", 327 }, - { "sigpending", 73 }, - { "sigprocmask", 126 }, - { "sigreturn", 119 }, - { "sigsuspend", 72 }, - { "socket", 359 }, - { "socketcall", 102 }, - { "socketpair", 360 }, - { "splice", 313 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", 69 }, - { "stat", 106 }, - { "stat64", 195 }, - { "statfs", 99 }, - { "statfs64", 268 }, - { "statx", 383 }, - { "stime", 25 }, - { "stty", 31 }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 115 }, - { "swapon", 87 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", 83 }, - { "symlinkat", 304 }, - { "sync", 36 }, - { "sync_file_range", 314 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 344 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", 135 }, - { "sysinfo", 116 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 315 }, - { "tgkill", 270 }, - { "time", 13 }, - { "timer_create", 259 }, - { "timer_delete", 263 }, - { "timer_getoverrun", 262 }, - { "timer_gettime", 261 }, - { "timer_gettime64", 408 }, - { "timer_settime", 260 }, - { "timer_settime64", 409 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 322 }, - { "timerfd_gettime", 326 }, - { "timerfd_gettime64", 410 }, - { "timerfd_settime", 325 }, - { "timerfd_settime64", 411 }, - { "times", 43 }, - { "tkill", 238 }, - { "truncate", 92 }, - { "truncate64", 193 }, - { "tuxcall", __PNR_tuxcall }, - { "ugetrlimit", 191 }, - { "ulimit", 58 }, - { "umask", 60 }, - { "umount", 22 }, - { "umount2", 52 }, - { "uname", 122 }, - { "unlink", 10 }, - { "unlinkat", 301 }, - { "unshare", 310 }, - { "uselib", 86 }, - { "userfaultfd", 374 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 62 }, - { "utime", 30 }, - { "utimensat", 320 }, - { "utimensat_time64", 412 }, - { "utimes", 271 }, - { "vfork", 190 }, - { "vhangup", 111 }, - { "vm86", 166 }, - { "vm86old", 113 }, - { "vmsplice", 316 }, - { "vserver", 273 }, - { "wait4", 114 }, - { "waitid", 284 }, - { "waitpid", 7 }, - { "write", 4 }, - { "writev", 146 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int x86_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = x86_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (strcmp(name, "accept") == 0) - return __PNR_accept; - else if (strcmp(name, "accept4") == 0) - return __PNR_accept4; - else if (strcmp(name, "bind") == 0) - return __PNR_bind; - else if (strcmp(name, "connect") == 0) - return __PNR_connect; - else if (strcmp(name, "getpeername") == 0) - return __PNR_getpeername; - else if (strcmp(name, "getsockname") == 0) - return __PNR_getsockname; - else if (strcmp(name, "getsockopt") == 0) - return __PNR_getsockopt; - else if (strcmp(name, "listen") == 0) - return __PNR_listen; - else if (strcmp(name, "recv") == 0) - return __PNR_recv; - else if (strcmp(name, "recvfrom") == 0) - return __PNR_recvfrom; - else if (strcmp(name, "recvmsg") == 0) - return __PNR_recvmsg; - else if (strcmp(name, "recvmmsg") == 0) - return __PNR_recvmmsg; - else if (strcmp(name, "send") == 0) - return __PNR_send; - else if (strcmp(name, "sendmsg") == 0) - return __PNR_sendmsg; - else if (strcmp(name, "sendmmsg") == 0) - return __PNR_sendmmsg; - else if (strcmp(name, "sendto") == 0) - return __PNR_sendto; - else if (strcmp(name, "setsockopt") == 0) - return __PNR_setsockopt; - else if (strcmp(name, "shutdown") == 0) - return __PNR_shutdown; - else if (strcmp(name, "socket") == 0) - return __PNR_socket; - else if (strcmp(name, "socketpair") == 0) - return __PNR_socketpair; - - if (strcmp(name, "semop") == 0) - return __PNR_semop; - else if (strcmp(name, "semget") == 0) - return __PNR_semget; - else if (strcmp(name, "semctl") == 0) - return __PNR_semctl; - else if (strcmp(name, "semtimedop") == 0) - return __PNR_semtimedop; - else if (strcmp(name, "msgsnd") == 0) - return __PNR_msgsnd; - else if (strcmp(name, "msgrcv") == 0) - return __PNR_msgrcv; - else if (strcmp(name, "msgget") == 0) - return __PNR_msgget; - else if (strcmp(name, "msgctl") == 0) - return __PNR_msgctl; - else if (strcmp(name, "shmat") == 0) - return __PNR_shmat; - else if (strcmp(name, "shmdt") == 0) - return __PNR_shmdt; - else if (strcmp(name, "shmget") == 0) - return __PNR_shmget; - else if (strcmp(name, "shmctl") == 0) - return __PNR_shmctl; - - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *x86_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = x86_syscall_table; - - /* XXX - plenty of room for future improvement here */ - - if (num == __PNR_accept) - return "accept"; - else if (num == __PNR_accept4) - return "accept4"; - else if (num == __PNR_bind) - return "bind"; - else if (num == __PNR_connect) - return "connect"; - else if (num == __PNR_getpeername) - return "getpeername"; - else if (num == __PNR_getsockname) - return "getsockname"; - else if (num == __PNR_getsockopt) - return "getsockopt"; - else if (num == __PNR_listen) - return "listen"; - else if (num == __PNR_recv) - return "recv"; - else if (num == __PNR_recvfrom) - return "recvfrom"; - else if (num == __PNR_recvmsg) - return "recvmsg"; - else if (num == __PNR_recvmmsg) - return "recvmmsg"; - else if (num == __PNR_send) - return "send"; - else if (num == __PNR_sendmsg) - return "sendmsg"; - else if (num == __PNR_sendmmsg) - return "sendmmsg"; - else if (num == __PNR_sendto) - return "sendto"; - else if (num == __PNR_setsockopt) - return "setsockopt"; - else if (num == __PNR_shutdown) - return "shutdown"; - else if (num == __PNR_socket) - return "socket"; - else if (num == __PNR_socketpair) - return "socketpair"; - - if (num == __PNR_semop) - return "semop"; - else if (num == __PNR_semget) - return "semget"; - else if (num == __PNR_semctl) - return "semctl"; - else if (num == __PNR_semtimedop) - return "semtimedop"; - else if (num == __PNR_msgsnd) - return "msgsnd"; - else if (num == __PNR_msgrcv) - return "msgrcv"; - else if (num == __PNR_msgget) - return "msgget"; - else if (num == __PNR_msgctl) - return "msgctl"; - else if (num == __PNR_shmat) - return "shmat"; - else if (num == __PNR_shmdt) - return "shmdt"; - else if (num == __PNR_shmget) - return "shmget"; - else if (num == __PNR_shmctl) - return "shmctl"; - - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *x86_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &x86_syscall_table[spot]; -} diff --git a/src/arch-x86_64-syscalls.c b/src/arch-x86_64-syscalls.c deleted file mode 100644 index a2fdef88..00000000 --- a/src/arch-x86_64-syscalls.c +++ /dev/null @@ -1,559 +0,0 @@ -/** - * Enhanced Seccomp x86_64 Syscall Table - * - * Copyright (c) 2012 Red Hat - * Author: Paul Moore - */ - -/* - * This library is free software; you can redistribute it and/or modify it - * under the terms of version 2.1 of the GNU Lesser General Public License as - * published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, see . - */ - -#include - -#include - -#include "arch.h" -#include "arch-x86_64.h" - -/* NOTE: based on Linux v5.4-rc4 */ -const struct arch_syscall_def x86_64_syscall_table[] = { \ - { "_llseek", __PNR__llseek }, - { "_newselect", __PNR__newselect }, - { "_sysctl", 156 }, - { "accept", 43 }, - { "accept4", 288 }, - { "access", 21 }, - { "acct", 163 }, - { "add_key", 248 }, - { "adjtimex", 159 }, - { "afs_syscall", 183 }, - { "alarm", 37 }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", 158 }, - { "bdflush", __PNR_bdflush }, - { "bind", 49 }, - { "bpf", 321 }, - { "break", __PNR_break }, - { "breakpoint", __PNR_breakpoint }, - { "brk", 12 }, - { "cachectl", __PNR_cachectl }, - { "cacheflush", __PNR_cacheflush }, - { "capget", 125 }, - { "capset", 126 }, - { "chdir", 80 }, - { "chmod", 90 }, - { "chown", 92 }, - { "chown32", __PNR_chown32 }, - { "chroot", 161 }, - { "clock_adjtime", 305 }, - { "clock_adjtime64", __PNR_clock_adjtime64 }, - { "clock_getres", 229 }, - { "clock_getres_time64", __PNR_clock_getres_time64 }, - { "clock_gettime", 228 }, - { "clock_gettime64", __PNR_clock_gettime64 }, - { "clock_nanosleep", 230 }, - { "clock_nanosleep_time64", __PNR_clock_nanosleep_time64 }, - { "clock_settime", 227 }, - { "clock_settime64", __PNR_clock_settime64 }, - { "clone", 56 }, - { "clone3", 435 }, - { "close", 3 }, - { "connect", 42 }, - { "copy_file_range", 326 }, - { "creat", 85 }, - { "create_module", 174 }, - { "delete_module", 176 }, - { "dup", 32 }, - { "dup2", 33 }, - { "dup3", 292 }, - { "epoll_create", 213 }, - { "epoll_create1", 291 }, - { "epoll_ctl", 233 }, - { "epoll_ctl_old", 214 }, - { "epoll_pwait", 281 }, - { "epoll_wait", 232 }, - { "epoll_wait_old", 215 }, - { "eventfd", 284 }, - { "eventfd2", 290 }, - { "execve", 59 }, - { "execveat", 322 }, - { "exit", 60 }, - { "exit_group", 231 }, - { "faccessat", 269 }, - { "fadvise64", 221 }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", 285 }, - { "fanotify_init", 300 }, - { "fanotify_mark", 301 }, - { "fchdir", 81 }, - { "fchmod", 91 }, - { "fchmodat", 268 }, - { "fchown", 93 }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", 260 }, - { "fcntl", 72 }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", 75 }, - { "fgetxattr", 193 }, - { "finit_module", 313 }, - { "flistxattr", 196 }, - { "flock", 73 }, - { "fork", 57 }, - { "fremovexattr", 199 }, - { "fsconfig", 431 }, - { "fsetxattr", 190 }, - { "fsmount", 432 }, - { "fsopen", 430 }, - { "fspick", 433 }, - { "fstat", 5 }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", 138 }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", 74 }, - { "ftime", __PNR_ftime }, - { "ftruncate", 77 }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", 202 }, - { "futex_time64", __PNR_futex_time64 }, - { "futimesat", 261 }, - { "get_kernel_syms", 177 }, - { "get_mempolicy", 239 }, - { "get_robust_list", 274 }, - { "get_thread_area", 211 }, - { "get_tls", __PNR_get_tls }, - { "getcpu", 309 }, - { "getcwd", 79 }, - { "getdents", 78 }, - { "getdents64", 217 }, - { "getegid", 108 }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", 107 }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", 104 }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", 115 }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", 36 }, - { "getpeername", 52 }, - { "getpgid", 121 }, - { "getpgrp", 111 }, - { "getpid", 39 }, - { "getpmsg", 181 }, - { "getppid", 110 }, - { "getpriority", 140 }, - { "getrandom", 318 }, - { "getresgid", 120 }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", 118 }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", 97 }, - { "getrusage", 98 }, - { "getsid", 124 }, - { "getsockname", 51 }, - { "getsockopt", 55 }, - { "gettid", 186 }, - { "gettimeofday", 96 }, - { "getuid", 102 }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", 191 }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", 175 }, - { "inotify_add_watch", 254 }, - { "inotify_init", 253 }, - { "inotify_init1", 294 }, - { "inotify_rm_watch", 255 }, - { "io_cancel", 210 }, - { "io_destroy", 207 }, - { "io_getevents", 208 }, - { "io_pgetevents", 333 }, - { "io_pgetevents_time64", __PNR_io_pgetevents_time64 }, - { "io_setup", 206 }, - { "io_submit", 209 }, - { "io_uring_setup", 425 }, - { "io_uring_enter", 426 }, - { "io_uring_register", 427 }, - { "ioctl", 16 }, - { "ioperm", 173 }, - { "iopl", 172 }, - { "ioprio_get", 252 }, - { "ioprio_set", 251 }, - { "ipc", __PNR_ipc }, - { "kcmp", 312 }, - { "kexec_file_load", 320 }, - { "kexec_load", 246 }, - { "keyctl", 250 }, - { "kill", 62 }, - { "lchown", 94 }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", 192 }, - { "link", 86 }, - { "linkat", 265 }, - { "listen", 50 }, - { "listxattr", 194 }, - { "llistxattr", 195 }, - { "lock", __PNR_lock }, - { "lookup_dcookie", 212 }, - { "lremovexattr", 198 }, - { "lseek", 8 }, - { "lsetxattr", 189 }, - { "lstat", 6 }, - { "lstat64", __PNR_lstat64 }, - { "madvise", 28 }, - { "mbind", 237 }, - { "membarrier", 324 }, - { "memfd_create", 319 }, - { "migrate_pages", 256 }, - { "mincore", 27 }, - { "mkdir", 83 }, - { "mkdirat", 258 }, - { "mknod", 133 }, - { "mknodat", 259 }, - { "mlock", 149 }, - { "mlock2", 325 }, - { "mlockall", 151 }, - { "mmap", 9 }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", 154 }, - { "mount", 165 }, - { "move_mount", 429 }, - { "move_pages", 279 }, - { "mprotect", 10 }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", 245 }, - { "mq_notify", 244 }, - { "mq_open", 240 }, - { "mq_timedreceive", 243 }, - { "mq_timedreceive_time64", __PNR_mq_timedreceive_time64 }, - { "mq_timedsend", 242 }, - { "mq_timedsend_time64", __PNR_mq_timedsend_time64 }, - { "mq_unlink", 241 }, - { "mremap", 25 }, - { "msgctl", 71 }, - { "msgget", 68 }, - { "msgrcv", 70 }, - { "msgsnd", 69 }, - { "msync", 26 }, - { "multiplexer", __PNR_multiplexer }, - { "munlock", 150 }, - { "munlockall", 152 }, - { "munmap", 11 }, - { "name_to_handle_at", 303 }, - { "nanosleep", 35 }, - { "newfstatat", 262 }, - { "nfsservctl", 180 }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "oldwait4", __PNR_oldwait4 }, - { "open", 2 }, - { "open_by_handle_at", 304 }, - { "open_tree", 428 }, - { "openat", 257 }, - { "pause", 34 }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", 298 }, - { "personality", 135 }, - { "pidfd_open", 434 }, - { "pidfd_send_signal", 424 }, - { "pipe", 22 }, - { "pipe2", 293 }, - { "pivot_root", 155 }, - { "pkey_alloc", 330 }, - { "pkey_free", 331 }, - { "pkey_mprotect", 329 }, - { "poll", 7 }, - { "ppoll", 271 }, - { "ppoll_time64", __PNR_ppoll_time64 }, - { "prctl", 157 }, - { "pread64", 17 }, - { "preadv", 295 }, - { "preadv2", 327 }, - { "prlimit64", 302 }, - { "process_vm_readv", 310 }, - { "process_vm_writev", 311 }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", 270 }, - { "pselect6_time64", __PNR_pselect6_time64 }, - { "ptrace", 101 }, - { "putpmsg", 182 }, - { "pwrite64", 18 }, - { "pwritev", 296 }, - { "pwritev2", 328 }, - { "query_module", 178 }, - { "quotactl", 179 }, - { "read", 0 }, - { "readahead", 187 }, - { "readdir", __PNR_readdir }, - { "readlink", 89 }, - { "readlinkat", 267 }, - { "readv", 19 }, - { "reboot", 169 }, - { "recv", __PNR_recv }, - { "recvfrom", 45 }, - { "recvmmsg", 299 }, - { "recvmmsg_time64", __PNR_recvmmsg_time64 }, - { "recvmsg", 47 }, - { "remap_file_pages", 216 }, - { "removexattr", 197 }, - { "rename", 82 }, - { "renameat", 264 }, - { "renameat2", 316 }, - { "request_key", 249 }, - { "restart_syscall", 219 }, - { "rmdir", 84 }, - { "rseq", 334 }, - { "rt_sigaction", 13 }, - { "rt_sigpending", 127 }, - { "rt_sigprocmask", 14 }, - { "rt_sigqueueinfo", 129 }, - { "rt_sigreturn", 15 }, - { "rt_sigsuspend", 130 }, - { "rt_sigtimedwait", 128 }, - { "rt_sigtimedwait_time64", __PNR_rt_sigtimedwait_time64 }, - { "rt_tgsigqueueinfo", 297 }, - { "rtas", __PNR_rtas }, - { "s390_guarded_storage", __PNR_s390_guarded_storage }, - { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, - { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, - { "s390_runtime_instr", __PNR_s390_runtime_instr }, - { "s390_sthyi", __PNR_s390_sthyi }, - { "sched_get_priority_max", 146 }, - { "sched_get_priority_min", 147 }, - { "sched_getaffinity", 204 }, - { "sched_getattr", 315 }, - { "sched_getparam", 143 }, - { "sched_getscheduler", 145 }, - { "sched_rr_get_interval", 148 }, - { "sched_rr_get_interval_time64", __PNR_sched_rr_get_interval_time64 }, - { "sched_setaffinity", 203 }, - { "sched_setattr", 314 }, - { "sched_setparam", 142 }, - { "sched_setscheduler", 144 }, - { "sched_yield", 24 }, - { "seccomp", 317 }, - { "security", 185 }, - { "select", 23 }, - { "semctl", 66 }, - { "semget", 64 }, - { "semop", 65 }, - { "semtimedop", 220 }, - { "semtimedop_time64", __PNR_semtimedop_time64 }, - { "send", __PNR_send }, - { "sendfile", 40 }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", 307 }, - { "sendmsg", 46 }, - { "sendto", 44 }, - { "set_mempolicy", 238 }, - { "set_robust_list", 273 }, - { "set_thread_area", 205 }, - { "set_tid_address", 218 }, - { "set_tls", __PNR_set_tls }, - { "setdomainname", 171 }, - { "setfsgid", 123 }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", 122 }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", 106 }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", 116 }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", 170 }, - { "setitimer", 38 }, - { "setns", 308 }, - { "setpgid", 109 }, - { "setpriority", 141 }, - { "setregid", 114 }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", 119 }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", 117 }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", 113 }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", 160 }, - { "setsid", 112 }, - { "setsockopt", 54 }, - { "settimeofday", 164 }, - { "setuid", 105 }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", 188 }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", 30 }, - { "shmctl", 31 }, - { "shmdt", 67 }, - { "shmget", 29 }, - { "shutdown", 48 }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", 131 }, - { "signal", __PNR_signal }, - { "signalfd", 282 }, - { "signalfd4", 289 }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", 41 }, - { "socketcall", __PNR_socketcall }, - { "socketpair", 53 }, - { "splice", 275 }, - { "spu_create", __PNR_spu_create }, - { "spu_run", __PNR_spu_run }, - { "ssetmask", __PNR_ssetmask }, - { "stat", 4 }, - { "stat64", __PNR_stat64 }, - { "statfs", 137 }, - { "statfs64", __PNR_statfs64 }, - { "statx", 332 }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "subpage_prot", __PNR_subpage_prot }, - { "swapcontext", __PNR_swapcontext }, - { "swapoff", 168 }, - { "swapon", 167 }, - { "switch_endian", __PNR_switch_endian }, - { "symlink", 88 }, - { "symlinkat", 266 }, - { "sync", 162 }, - { "sync_file_range", 277 }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", 306 }, - { "syscall", __PNR_syscall }, - { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, - { "sysfs", 139 }, - { "sysinfo", 99 }, - { "syslog", 103 }, - { "sysmips", __PNR_sysmips }, - { "tee", 276 }, - { "tgkill", 234 }, - { "time", 201 }, - { "timer_create", 222 }, - { "timer_delete", 226 }, - { "timer_getoverrun", 225 }, - { "timer_gettime", 224 }, - { "timer_gettime64", __PNR_timer_gettime64 }, - { "timer_settime", 223 }, - { "timer_settime64", __PNR_timer_settime64 }, - { "timerfd", __PNR_timerfd }, - { "timerfd_create", 283 }, - { "timerfd_gettime", 287 }, - { "timerfd_gettime64", __PNR_timerfd_gettime64 }, - { "timerfd_settime", 286 }, - { "timerfd_settime64", __PNR_timerfd_settime64 }, - { "times", 100 }, - { "tkill", 200 }, - { "truncate", 76 }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", 184 }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", 95 }, - { "umount", __PNR_umount }, - { "umount2", 166 }, - { "uname", 63 }, - { "unlink", 87 }, - { "unlinkat", 263 }, - { "unshare", 272 }, - { "uselib", 134 }, - { "userfaultfd", 323 }, - { "usr26", __PNR_usr26 }, - { "usr32", __PNR_usr32 }, - { "ustat", 136 }, - { "utime", 132 }, - { "utimensat", 280 }, - { "utimensat_time64", __PNR_utimensat_time64 }, - { "utimes", 235 }, - { "vfork", 58 }, - { "vhangup", 153 }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", 278 }, - { "vserver", 236 }, - { "wait4", 61 }, - { "waitid", 247 }, - { "waitpid", __PNR_waitpid }, - { "write", 1 }, - { "writev", 20 }, - { NULL, __NR_SCMP_ERROR }, -}; - -/** - * Resolve a syscall name to a number - * @param name the syscall name - * - * Resolve the given syscall name to the syscall number using the syscall table. - * Returns the syscall number on success, including negative pseudo syscall - * numbers; returns __NR_SCMP_ERROR on failure. - * - */ -int x86_64_syscall_resolve_name(const char *name) -{ - unsigned int iter; - const struct arch_syscall_def *table = x86_64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].name != NULL; iter++) { - if (strcmp(name, table[iter].name) == 0) - return table[iter].num; - } - - return __NR_SCMP_ERROR; -} - -/** - * Resolve a syscall number to a name - * @param num the syscall number - * - * Resolve the given syscall number to the syscall name using the syscall table. - * Returns a pointer to the syscall name string on success, including pseudo - * syscall names; returns NULL on failure. - * - */ -const char *x86_64_syscall_resolve_num(int num) -{ - unsigned int iter; - const struct arch_syscall_def *table = x86_64_syscall_table; - - /* XXX - plenty of room for future improvement here */ - for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { - if (num == table[iter].num) - return table[iter].name; - } - - return NULL; -} - -/** - * Iterate through the syscall table and return the syscall mapping - * @param spot the offset into the syscall table - * - * Return the syscall mapping at position @spot or NULL on failure. This - * function should only ever be used internally by libseccomp. - * - */ -const struct arch_syscall_def *x86_64_syscall_iterate(unsigned int spot) -{ - /* XXX - no safety checks here */ - return &x86_64_syscall_table[spot]; -} - diff --git a/src/generate_syscalls_perf.sh b/src/generate_syscalls_perf.sh new file mode 100755 index 00000000..40215a5d --- /dev/null +++ b/src/generate_syscalls_perf.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +cat $abs_top_srcdir/src/syscalls.csv | nl -ba -s, -v-1 | \ + sed -e '/^#/d' \ + -e 's/^[[:space:]]\+\([[:digit:]]\+,\(.*\)$\)/\2,\1/' \ + -e ':repeat; {s|\([^,]\+\)\(.*\)[^_]PNR|\1\2 __PNR_\1|g;}; t repeat' \ + > syscalls.csv.tmp + +sed -e '/@@SYSCALLS_TABLE@@/r syscalls.csv.tmp' \ + -e '/@@SYSCALLS_TABLE@@/d' \ + syscalls.perf.template > syscalls.perf.tmp + +rm syscalls.csv.tmp +mv -f syscalls.perf.tmp syscalls.perf diff --git a/src/syscalls.c b/src/syscalls.c new file mode 100644 index 00000000..02369a1b --- /dev/null +++ b/src/syscalls.c @@ -0,0 +1,60 @@ +/** + * Enhanced Seccomp x86_64 Syscall Table + * + * Copyright (c) 2012, 2020 Red Hat + * Author: Paul Moore + * gperf support: Giuseppe Scrivano + */ + +/* + * This library is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License as + * published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ +#include +#include + +#include "arch.h" +#include "syscalls.h" + +#define SYSCALL_ARCH(NAME, ARCH_OFFSET) \ +int NAME##_syscall_resolve_name(const char *name) \ +{ \ + int ret = syscall_resolve_name(name, OFFSET_ARCH(NAME)); \ + if (ret < 0) \ + return ret; \ + return ret + ARCH_OFFSET; \ +} \ + \ +const char *NAME##_syscall_resolve_num(int num) \ +{ \ + return syscall_resolve_num(num - ARCH_OFFSET, OFFSET_ARCH(NAME)); \ +} \ + \ +const struct arch_syscall_def *NAME##_syscall_iterate(unsigned int spot) \ +{ \ + return syscall_iterate(spot, OFFSET_ARCH(NAME)); \ +} + +SYSCALL_ARCH(x86_64, 0) +SYSCALL_ARCH(arm, 0) +SYSCALL_ARCH(aarch64, 0) +SYSCALL_ARCH(mips64n32, 0) +SYSCALL_ARCH(mips64, 0) +SYSCALL_ARCH(mips, 0) +SYSCALL_ARCH(parisc, 0) +SYSCALL_ARCH(ppc64, 0) +SYSCALL_ARCH(ppc, 0) +SYSCALL_ARCH(s390, 0) +SYSCALL_ARCH(s390x, 0) +SYSCALL_ARCH(x32, X32_SYSCALL_BIT) +SYSCALL_ARCH(x86, 0) +SYSCALL_ARCH(riscv64, 0) diff --git a/src/syscalls.csv b/src/syscalls.csv new file mode 100644 index 00000000..a4dd5647 --- /dev/null +++ b/src/syscalls.csv @@ -0,0 +1,468 @@ +# name, x86_64, arm, aarch64, mips64n32, mips64, mips, parisc, ppc64, ppc, s390, s390x, x32, x86, riscv64 +accept, 43, 285, 202, 42, 42, 168, 35, 330, 330, PNR, PNR, 43, PNR, 202 +accept4, 288, 366, 242, 297, 293, 334, 320, 344, 344, PNR, PNR, 288, PNR, 242 +access, 21, 33, PNR, 20, 20, 33, 33, 33, 33, 33, 33, 21, 33, PNR +acct, 163, 51, 89, 158, 158, 51, 51, 51, 51, 51, 51, 163, 51, 89 +add_key, 248, 309, 217, 243, 239, 280, 264, 269, 269, 278, 278, 248, 286, 217 +adjtimex, 159, 124, 171, 154, 154, 124, 124, 124, 124, 124, 124, 159, 124, 171 +afs_syscall, 183, PNR, PNR, 176, 176, 137, 137, 137, 137, 137, 137, 183, 137, PNR +alarm, 37, PNR, PNR, 37, 37, 27, 27, 27, 27, 27, 27, 37, 27, PNR +arch_prctl, 158, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 158, 384, PNR +arm_fadvise64_64, PNR, 270, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +arm_sync_file_range, PNR, 341, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +bdflush, PNR, 134, PNR, PNR, PNR, 134, 134, 134, 134, 134, 134, PNR, 134, PNR +bind, 49, 282, 200, 48, 48, 169, 22, 327, 327, PNR, PNR, 49, PNR, 200 +bpf, 321, 386, 280, 319, 315, 355, 341, 361, 361, 351, 351, 321, 357, 280 +break, PNR, PNR, PNR, PNR, PNR, 17, PNR, 17, 17, PNR, PNR, PNR, 17, PNR +breakpoint, PNR, 0x0f0000+1, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +brk, 12, 45, 214, 12, 12, 45, 45, 45, 45, 45, 45, 12, 45, 214 +cachectl, PNR, PNR, PNR, 198, 198, 148, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +cacheflush, PNR, 0x0f0000+2, PNR, 197, 197, 147, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +capget, 125, 184, 90, 123, 123, 204, 106, 183, 183, 184, 184, 125, 184, 90 +capset, 126, 185, 91, 124, 124, 205, 107, 184, 184, 185, 185, 126, 185, 91 +chdir, 80, 12, 49, 78, 78, 12, 12, 12, 12, 12, 12, 80, 12, 49 +chmod, 90, 15, PNR, 88, 88, 15, 15, 15, 15, 15, 15, 90, 15, PNR +chown, 92, 182, PNR, 90, 90, 202, 180, 181, 181, 182, 212, 92, 182, PNR +chown32, PNR, 212, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 212, PNR, PNR, 212, PNR +chroot, 161, 61, 51, 156, 156, 61, 61, 61, 61, 61, 61, 161, 61, 51 +clock_adjtime, 305, 372, 266, 305, 300, 341, 324, 347, 347, 337, 337, 305, 343, 266 +clock_adjtime64, PNR, 405, PNR, 405, PNR, 405, PNR, PNR, 405, 405, PNR, PNR, 405, PNR +clock_getres, 229, 264, 114, 227, 223, 264, 257, 247, 247, 261, 261, 229, 266, 114 +clock_getres_time64, PNR, 406, PNR, 406, PNR, 406, PNR, PNR, 406, 406, PNR, PNR, 406, PNR +clock_gettime, 228, 263, 113, 226, 222, 263, 256, 246, 246, 260, 260, 228, 265, 113 +clock_gettime64, PNR, 403, PNR, 403, PNR, 403, PNR, PNR, 403, 403, PNR, PNR, 403, PNR +clock_nanosleep, 230, 265, 115, 228, 224, 265, 258, 248, 248, 262, 262, 230, 267, 115 +clock_nanosleep_time64, PNR, 407, PNR, 407, PNR, 407, PNR, PNR, 407, 407, PNR, PNR, 407, PNR +clock_settime, 227, 262, 112, 225, 221, 262, 255, 245, 245, 259, 259, 227, 264, 112 +clock_settime64, PNR, 404, PNR, 404, PNR, 404, PNR, PNR, 404, 404, PNR, PNR, 404, PNR +clone, 56, 120, 220, 55, 55, 120, 120, 120, 120, 120, 120, 56, 120, 220 +clone3, 435, 435, PNR, 435, 435, 435, PNR, 435, 435, 435, 435, 435, 435, 435 +close, 3, 6, 57, 3, 3, 6, 6, 6, 6, 6, 6, 3, 6, 57 +connect, 42, 283, 203, 41, 41, 170, 31, 328, 328, PNR, PNR, 42, PNR, 203 +copy_file_range, 326, 391, 285, 324, 320, 360, 346, 379, 379, 375, 375, 326, 377, 285 +creat, 85, 8, PNR, 83, 83, 8, 8, 8, 8, 8, 8, 85, 8, PNR +create_module, 174, PNR, PNR, 167, 167, 127, 127, 127, 127, 127, 127, PNR, 127, PNR +delete_module, 176, 129, 106, 169, 169, 129, 129, 129, 129, 129, 129, 176, 129, 106 +dup, 32, 41, 23, 31, 31, 41, 41, 41, 41, 41, 41, 32, 41, 23 +dup2, 33, 63, PNR, 32, 32, 63, 63, 63, 63, 63, 63, 33, 63, PNR +dup3, 292, 358, 24, 290, 286, 327, 312, 316, 316, 326, 326, 292, 330, 24 +epoll_create, 213, 250, PNR, 207, 207, 248, 224, 236, 236, 249, 249, 213, 254, PNR +epoll_create1, 291, 357, 20, 289, 285, 326, 311, 315, 315, 327, 327, 291, 329, 20 +epoll_ctl, 233, 251, 21, 208, 208, 249, 225, 237, 237, 250, 250, 233, 255, 21 +epoll_ctl_old, 214, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +epoll_pwait, 281, 346, 22, 276, 272, 313, 297, 303, 303, 312, 312, 281, 319, 22 +epoll_wait, 232, 252, PNR, 209, 209, 250, 226, 238, 238, 251, 251, 232, 256, PNR +epoll_wait_old, 215, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +eventfd, 284, 351, PNR, 282, 278, 319, 304, 307, 307, 318, 318, 284, 323, PNR +eventfd2, 290, 356, 19, 288, 284, 325, 310, 314, 314, 323, 323, 290, 328, 19 +execve, 59, 11, 221, 57, 57, 11, 11, 11, 11, 11, 11, 520, 11, 221 +execveat, 322, 387, 281, 320, 316, 356, 342, 362, 362, 354, 354, 545, 358, 281 +exit, 60, 1, 93, 58, 58, 1, 1, 1, 1, 1, 1, 60, 1, 93 +exit_group, 231, 248, 94, 205, 205, 246, 222, 234, 234, 248, 248, 231, 252, 94 +faccessat, 269, 334, 48, 263, 259, 300, 287, 298, 298, 300, 300, 269, 307, 48 +fadvise64, 221, PNR, 223, 216, 215, 254, PNR, 233, 233, 253, 253, 221, 250, 223 +fadvise64_64, PNR, PNR, PNR, PNR, PNR, PNR, 236, PNR, 254, 264, PNR, PNR, 272, PNR +fallocate, 285, 352, 47, 283, 279, 320, 305, 309, 309, 314, 314, 285, 324, 47 +fanotify_init, 300, 367, 262, 300, 295, 336, 322, 323, 323, 332, 332, 300, 338, 262 +fanotify_mark, 301, 368, 263, 301, 296, 337, 323, 324, 324, 333, 333, 301, 339, 263 +fchdir, 81, 133, 50, 79, 79, 133, 133, 133, 133, 133, 133, 81, 133, 50 +fchmod, 91, 94, 52, 89, 89, 94, 94, 94, 94, 94, 94, 91, 94, 52 +fchmodat, 268, 333, 53, 262, 258, 299, 286, 297, 297, 299, 299, 268, 306, 53 +fchown, 93, 95, 55, 91, 91, 95, 95, 95, 95, 95, 207, 93, 95, 55 +fchown32, PNR, 207, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 207, PNR, PNR, 207, PNR +fchownat, 260, 325, 54, 254, 250, 291, 278, 289, 289, 291, 291, 260, 298, 54 +fcntl, 72, 55, 25, 70, 70, 55, 55, 55, 55, 55, 55, 72, 55, 25 +fcntl64, PNR, 221, PNR, 212, PNR, 220, 202, PNR, 204, 221, PNR, PNR, 221, PNR +fdatasync, 75, 148, 83, 73, 73, 152, 148, 148, 148, 148, 148, 75, 148, 83 +fgetxattr, 193, 231, 10, 185, 185, 229, 243, 214, 214, 229, 229, 193, 231, 10 +finit_module, 313, 379, 273, 312, 307, 348, 333, 353, 353, 344, 344, 313, 350, 273 +flistxattr, 196, 234, 13, 188, 188, 232, 246, 217, 217, 232, 232, 196, 234, 13 +flock, 73, 143, 32, 71, 71, 143, 143, 143, 143, 143, 143, 73, 143, 32 +fork, 57, 2, PNR, 56, 56, 2, 2, 2, 2, 2, 2, 57, 2, PNR +fremovexattr, 199, 237, 16, 191, 191, 235, 249, 220, 220, 235, 235, 199, 237, 16 +fsconfig, 431, 431, 431, 431, 431, 431, PNR, 431, 431, 431, 431, 431, 431, 431 +fsetxattr, 190, 228, 7, 182, 182, 226, 240, 211, 211, 226, 226, 190, 228, 7 +fsmount, 432, 432, 432, 432, 432, 432, PNR, 432, 432, 432, 432, 432, 432, 432 +fsopen, 430, 430, 430, 430, 430, 430, PNR, 430, 430, 430, 430, 430, 430, 430 +fspick, 433, 433, 433, 433, 433, 433, PNR, 433, 433, 433, 433, 433, 433, 433 +fstat, 5, 108, 80, 5, 5, 108, 28, 108, 108, 108, 108, 5, 108, 80 +fstat64, PNR, 197, PNR, PNR, PNR, 215, 112, PNR, 197, 197, PNR, PNR, 197, PNR +fstatat64, PNR, 327, PNR, PNR, PNR, 293, 280, PNR, 291, 293, PNR, PNR, 300, PNR +fstatfs, 138, 100, 44, 135, 135, 100, 100, 100, 100, 100, 100, 138, 100, 44 +fstatfs64, PNR, 267, PNR, 218, PNR, 256, 299, 253, 253, 266, 266, PNR, 269, PNR +fsync, 74, 118, 82, 72, 72, 118, 118, 118, 118, 118, 118, 74, 118, 82 +ftime, PNR, PNR, PNR, PNR, PNR, 35, PNR, 35, 35, PNR, PNR, PNR, 35, PNR +ftruncate, 77, 93, 46, 75, 75, 93, 93, 93, 93, 93, 93, 77, 93, 46 +ftruncate64, PNR, 194, PNR, PNR, PNR, 212, 200, PNR, 194, 194, PNR, PNR, 194, PNR +futex, 202, 240, 98, 194, 194, 238, 210, 221, 221, 238, 238, 202, 240, 98 +futex_time64, PNR, 422, PNR, 422, PNR, 422, PNR, PNR, 422, 422, PNR, PNR, 422, PNR +futimesat, 261, 326, PNR, 255, 251, 292, 279, 290, 290, 292, 292, 261, 299, PNR +getcpu, 309, 345, 168, 275, 271, 312, 296, 302, 302, 311, 311, 309, 318, 168 +getcwd, 79, 183, 17, 77, 77, 203, 110, 182, 182, 183, 183, 79, 183, 17 +getdents, 78, 141, PNR, 76, 76, 141, 141, 141, 141, 141, 141, 78, 141, PNR +getdents64, 217, 217, 61, 299, 308, 219, 201, 202, 202, 220, 220, 217, 220, 61 +getegid, 108, 50, 177, 106, 106, 50, 50, 50, 50, 50, 202, 108, 50, 177 +getegid32, PNR, 202, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 202, PNR, PNR, 202, PNR +geteuid, 107, 49, 175, 105, 105, 49, 49, 49, 49, 49, 201, 107, 49, 175 +geteuid32, PNR, 201, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 201, PNR, PNR, 201, PNR +getgid, 104, 47, 176, 102, 102, 47, 47, 47, 47, 47, 200, 104, 47, 176 +getgid32, PNR, 200, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 200, PNR, PNR, 200, PNR +getgroups, 115, 80, 158, 113, 113, 80, 80, 80, 80, 80, 205, 115, 80, 158 +getgroups32, PNR, 205, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 205, PNR, PNR, 205, PNR +getitimer, 36, 105, 102, 35, 35, 105, 105, 105, 105, 105, 105, 36, 105, 102 +get_kernel_syms, 177, PNR, PNR, 170, 170, 130, 130, 130, 130, 130, 130, PNR, 130, PNR +get_mempolicy, 239, 320, 236, 232, 228, 269, 261, 260, 260, 269, 269, 239, 275, 236 +getpeername, 52, 287, 205, 51, 51, 171, 53, 332, 332, PNR, PNR, 52, PNR, 205 +getpgid, 121, 132, 155, 119, 119, 132, 132, 132, 132, 132, 132, 121, 132, 155 +getpgrp, 111, 65, PNR, 109, 109, 65, 65, 65, 65, 65, 65, 111, 65, PNR +getpid, 39, 20, 172, 38, 38, 20, 20, 20, 20, 20, 20, 39, 20, 172 +getpmsg, 181, PNR, PNR, 174, 174, 208, 196, 187, 187, 188, 188, 181, 188, PNR +getppid, 110, 64, 173, 108, 108, 64, 64, 64, 64, 64, 64, 110, 64, 173 +getpriority, 140, 96, 141, 137, 137, 96, 96, 96, 96, 96, 96, 140, 96, 141 +getrandom, 318, 384, 278, 317, 313, 353, 339, 359, 359, 349, 349, 318, 355, 278 +getresgid, 120, 171, 150, 118, 118, 191, 171, 170, 170, 171, 211, 120, 171, 150 +getresgid32, PNR, 211, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 211, PNR, PNR, 211, PNR +getresuid, 118, 165, 148, 116, 116, 186, 165, 165, 165, 165, 209, 118, 165, 148 +getresuid32, PNR, 209, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 209, PNR, PNR, 209, PNR +getrlimit, 97, PNR, PNR, 95, 95, 76, 76, 76, 76, 76, 191, 97, 76, 163 +get_robust_list, 274, 339, 100, 273, 269, 310, 290, 299, 299, 305, 305, 531, 312, 100 +getrusage, 98, 77, 165, 96, 96, 77, 77, 77, 77, 77, 77, 98, 77, 165 +getsid, 124, 147, 156, 122, 122, 151, 147, 147, 147, 147, 147, 124, 147, 156 +getsockname, 51, 286, 204, 50, 50, 172, 44, 331, 331, PNR, PNR, 51, PNR, 204 +getsockopt, 55, 295, 209, 54, 54, 173, 182, 340, 340, 365, 365, 542, PNR, 209 +get_thread_area, 211, PNR, PNR, PNR, PNR, PNR, 214, PNR, PNR, PNR, PNR, PNR, 244, PNR +gettid, 186, 224, 178, 178, 178, 222, 206, 207, 207, 236, 236, 186, 224, 178 +gettimeofday, 96, 78, 169, 94, 94, 78, 78, 78, 78, 78, 78, 96, 78, 169 +get_tls, PNR, 0x0f0000+6, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +getuid, 102, 24, 174, 100, 100, 24, 24, 24, 24, 24, 199, 102, 24, 174 +getuid32, PNR, 199, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 199, PNR, PNR, 199, PNR +getxattr, 191, 229, 8, 183, 183, 227, 241, 212, 212, 227, 227, 191, 229, 8 +gtty, PNR, PNR, PNR, PNR, PNR, 32, PNR, 32, 32, PNR, PNR, PNR, 32, PNR +idle, PNR, PNR, PNR, PNR, PNR, 112, PNR, 112, 112, 112, 112, PNR, 112, PNR +init_module, 175, 128, 105, 168, 168, 128, 128, 128, 128, 128, 128, 175, 128, 105 +inotify_add_watch, 254, 317, 27, 248, 244, 285, 270, 276, 276, 285, 285, 254, 292, 27 +inotify_init, 253, 316, PNR, 247, 243, 284, 269, 275, 275, 284, 284, 253, 291, PNR +inotify_init1, 294, 360, 26, 292, 288, 329, 314, 318, 318, 324, 324, 294, 332, 26 +inotify_rm_watch, 255, 318, 28, 249, 245, 286, 271, 277, 277, 286, 286, 255, 293, 28 +io_cancel, 210, 247, 3, 204, 204, 245, 219, 231, 231, 247, 247, 210, 249, 3 +ioctl, 16, 54, 29, 15, 15, 54, 54, 54, 54, 54, 54, 514, 54, 29 +io_destroy, 207, 244, 1, 201, 201, 242, 216, 228, 228, 244, 244, 207, 246, 1 +io_getevents, 208, 245, 4, 202, 202, 243, 217, 229, 229, 245, 245, 208, 247, 4 +ioperm, 173, PNR, PNR, PNR, PNR, 101, PNR, 101, 101, 101, PNR, 173, 101, PNR +io_pgetevents, 333, 399, 292, 332, 328, 368, PNR, 388, 388, 382, 382, 333, 385, 292 +io_pgetevents_time64, PNR, 416, PNR, 416, PNR, 416, PNR, PNR, 416, 416, PNR, PNR, 416, PNR +iopl, 172, PNR, PNR, PNR, PNR, 110, PNR, 110, 110, PNR, PNR, 172, 110, PNR +ioprio_get, 252, 315, 31, 278, 274, 315, 268, 274, 274, 283, 283, 252, 290, 31 +ioprio_set, 251, 314, 30, 277, 273, 314, 267, 273, 273, 282, 282, 251, 289, 30 +io_setup, 206, 243, 0, 200, 200, 241, 215, 227, 227, 243, 243, 543, 245, 0 +io_submit, 209, 246, 2, 203, 203, 244, 218, 230, 230, 246, 246, 544, 248, 2 +io_uring_enter, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426 +io_uring_register, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427, 427 +io_uring_setup, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425 +ipc, PNR, PNR, PNR, PNR, PNR, 117, PNR, 117, 117, 117, 117, PNR, 117, PNR +kcmp, 312, 378, 272, 311, 306, 347, 332, 354, 354, 343, 343, 312, 349, 272 +kexec_file_load, 320, 401, 294, PNR, PNR, PNR, PNR, 382, 382, 381, 381, 320, PNR, 294 +kexec_load, 246, 347, 104, 274, 270, 311, 300, 268, 268, 277, 277, 528, 283, 104 +keyctl, 250, 311, 219, 245, 241, 282, 266, 271, 271, 280, 280, 250, 288, 219 +kill, 62, 37, 129, 60, 60, 37, 37, 37, 37, 37, 37, 62, 37, 129 +lchown, 94, 16, PNR, 92, 92, 16, 16, 16, 16, 16, 198, 94, 16, PNR +lchown32, PNR, 198, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 198, PNR, PNR, 198, PNR +lgetxattr, 192, 230, 9, 184, 184, 228, 242, 213, 213, 228, 228, 192, 230, 9 +link, 86, 9, PNR, 84, 84, 9, 9, 9, 9, 9, 9, 86, 9, PNR +linkat, 265, 330, 37, 259, 255, 296, 283, 294, 294, 296, 296, 265, 303, 37 +listen, 50, 284, 201, 49, 49, 174, 32, 329, 329, PNR, PNR, 50, PNR, 201 +listxattr, 194, 232, 11, 186, 186, 230, 244, 215, 215, 230, 230, 194, 232, 11 +llistxattr, 195, 233, 12, 187, 187, 231, 245, 216, 216, 231, 231, 195, 233, 12 +_llseek, PNR, 140, PNR, PNR, PNR, 140, 140, 140, 140, 140, PNR, PNR, 140, PNR +lock, PNR, PNR, PNR, PNR, PNR, 53, PNR, 53, 53, PNR, PNR, PNR, 53, PNR +lookup_dcookie, 212, 249, 18, 206, 206, 247, 223, 235, 235, 110, 110, 212, 253, 18 +lremovexattr, 198, 236, 15, 190, 190, 234, 248, 219, 219, 234, 234, 198, 236, 15 +lseek, 8, 19, 62, 8, 8, 19, 19, 19, 19, 19, 19, 8, 19, 62 +lsetxattr, 189, 227, 6, 181, 181, 225, 239, 210, 210, 225, 225, 189, 227, 6 +lstat, 6, 107, PNR, 6, 6, 107, 84, 107, 107, 107, 107, 6, 107, PNR +lstat64, PNR, 196, PNR, PNR, PNR, 214, 198, PNR, 196, 196, PNR, PNR, 196, PNR +madvise, 28, 220, 233, 27, 27, 218, 119, 205, 205, 219, 219, 28, 219, 233 +mbind, 237, 319, 235, 231, 227, 268, 260, 259, 259, 268, 268, 237, 274, 235 +membarrier, 324, 389, 283, 322, 318, 358, 343, 365, 365, 356, 356, 324, 375, 283 +memfd_create, 319, 385, 279, 318, 314, 354, 340, 360, 360, 350, 350, 319, 356, 279 +migrate_pages, 256, 400, 238, 250, 246, 287, 272, 258, 258, 287, 287, 256, 294, 238 +mincore, 27, 219, 232, 26, 26, 217, 72, 206, 206, 218, 218, 27, 218, 232 +mkdir, 83, 39, PNR, 81, 81, 39, 39, 39, 39, 39, 39, 83, 39, PNR +mkdirat, 258, 323, 34, 252, 248, 289, 276, 287, 287, 289, 289, 258, 296, 34 +mknod, 133, 14, PNR, 131, 131, 14, 14, 14, 14, 14, 14, 133, 14, PNR +mknodat, 259, 324, 33, 253, 249, 290, 277, 288, 288, 290, 290, 259, 297, 33 +mlock, 149, 150, 228, 146, 146, 154, 150, 150, 150, 150, 150, 149, 150, 228 +mlock2, 325, 390, 284, 323, 319, 359, 345, 378, 378, 374, 374, 325, 376, 284 +mlockall, 151, 152, 230, 148, 148, 156, 152, 152, 152, 152, 152, 151, 152, 230 +mmap, 9, PNR, 222, 9, 9, 90, 90, 90, 90, 90, 90, 9, 90, 222 +mmap2, PNR, 192, PNR, PNR, PNR, 210, 89, PNR, 192, 192, PNR, PNR, 192, PNR +modify_ldt, 154, PNR, PNR, PNR, PNR, 123, PNR, 123, 123, PNR, PNR, 154, 123, PNR +mount, 165, 21, 40, 160, 160, 21, 21, 21, 21, 21, 21, 165, 21, 40 +move_mount, 429, 429, 429, 429, 429, 429, PNR, 429, 429, 429, 429, 429, 429, 429 +move_pages, 279, 344, 239, 271, 267, 308, 295, 301, 301, 310, 310, 533, 317, 239 +mprotect, 10, 125, 226, 10, 10, 125, 125, 125, 125, 125, 125, 10, 125, 226 +mpx, PNR, PNR, PNR, PNR, PNR, 56, PNR, 56, 56, PNR, PNR, PNR, 56, PNR +mq_getsetattr, 245, 279, 185, 239, 235, 276, 234, 267, 267, 276, 276, 245, 282, 185 +mq_notify, 244, 278, 184, 238, 234, 275, 233, 266, 266, 275, 275, 527, 281, 184 +mq_open, 240, 274, 180, 234, 230, 271, 229, 262, 262, 271, 271, 240, 277, 180 +mq_timedreceive, 243, 277, 183, 237, 233, 274, 232, 265, 265, 274, 274, 243, 280, 183 +mq_timedreceive_time64, PNR, 419, PNR, 419, PNR, 419, PNR, PNR, 419, 419, PNR, PNR, 419, PNR +mq_timedsend, 242, 276, 182, 236, 232, 273, 231, 264, 264, 273, 273, 242, 279, 182 +mq_timedsend_time64, PNR, 418, PNR, 418, PNR, 418, PNR, PNR, 418, 418, PNR, PNR, 418, PNR +mq_unlink, 241, 275, 181, 235, 231, 272, 230, 263, 263, 272, 272, 241, 278, 181 +mremap, 25, 163, 216, 24, 24, 167, 163, 163, 163, 163, 163, 25, 163, 216 +msgctl, 71, 304, 187, 69, 69, 402, 191, 402, 402, 402, 402, 71, PNR, 187 +msgget, 68, 303, 186, 66, 66, 399, 190, 399, 399, 399, 399, 68, PNR, 186 +msgrcv, 70, 302, 188, 68, 68, 401, 189, 401, 401, 401, 401, 70, PNR, 188 +msgsnd, 69, 301, 189, 67, 67, 400, 188, 400, 400, 400, 400, 69, PNR, 189 +msync, 26, 144, 227, 25, 25, 144, 144, 144, 144, 144, 144, 26, 144, 227 +multiplexer, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 201, 201, PNR, PNR, PNR, PNR, PNR +munlock, 150, 151, 229, 147, 147, 155, 151, 151, 151, 151, 151, 150, 151, 229 +munlockall, 152, 153, 231, 149, 149, 157, 153, 153, 153, 153, 153, 152, 153, 231 +munmap, 11, 91, 215, 11, 11, 91, 91, 91, 91, 91, 91, 11, 91, 215 +name_to_handle_at, 303, 370, 264, 303, 298, 339, 325, 345, 345, 335, 335, 303, 341, 264 +nanosleep, 35, 162, 101, 34, 34, 166, 162, 162, 162, 162, 162, 35, 162, 101 +newfstatat, 262, PNR, 79, 256, 252, PNR, PNR, 291, PNR, PNR, 293, 262, PNR, 79 +_newselect, PNR, 142, PNR, 22, 22, 142, 142, 142, 142, 142, PNR, PNR, 142, PNR +nfsservctl, 180, 169, 42, 173, 173, 189, 169, 168, 168, 169, 169, PNR, 169, 42 +nice, PNR, 34, PNR, PNR, PNR, 34, 34, 34, 34, 34, 34, PNR, 34, PNR +oldfstat, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 28, 28, PNR, PNR, PNR, 28, PNR +oldlstat, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 84, 84, PNR, PNR, PNR, 84, PNR +oldolduname, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 59, 59, PNR, PNR, PNR, 59, PNR +oldstat, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 18, 18, PNR, PNR, PNR, 18, PNR +olduname, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 109, 109, PNR, PNR, PNR, 109, PNR +oldwait4, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +open, 2, 5, PNR, 2, 2, 5, 5, 5, 5, 5, 5, 2, 5, PNR +openat, 257, 322, 56, 251, 247, 288, 275, 286, 286, 288, 288, 257, 295, 56 +open_by_handle_at, 304, 371, 265, 304, 299, 340, 326, 346, 346, 336, 336, 304, 342, 265 +open_tree, 428, 428, 428, 428, 428, 428, PNR, 428, 428, 428, 428, 428, 428, 428 +pause, 34, 29, PNR, 33, 33, 29, 29, 29, 29, 29, 29, 34, 29, PNR +pciconfig_iobase, PNR, 271, PNR, PNR, PNR, PNR, PNR, 200, 200, PNR, PNR, PNR, PNR, PNR +pciconfig_read, PNR, 272, PNR, PNR, PNR, PNR, PNR, 198, 198, PNR, PNR, PNR, PNR, PNR +pciconfig_write, PNR, 273, PNR, PNR, PNR, PNR, PNR, 199, 199, PNR, PNR, PNR, PNR, PNR +perf_event_open, 298, 364, 241, 296, 292, 333, 318, 319, 319, 331, 331, 298, 336, 241 +personality, 135, 136, 92, 132, 132, 136, 136, 136, 136, 136, 136, 135, 136, 92 +pidfd_open, 434, 434, 434, 434, 434, 434, PNR, 434, 434, 434, 434, 434, 434, 434 +pidfd_send_signal, 424, 424, 424, 424, 424, 424, PNR, 424, 424, 424, 424, 424, 424, 424 +pipe, 22, 42, PNR, 21, 21, 42, 42, 42, 42, 42, 42, 22, 42, PNR +pipe2, 293, 359, 59, 291, 287, 328, 313, 317, 317, 325, 325, 293, 331, 59 +pivot_root, 155, 218, 41, 151, 151, 216, 67, 203, 203, 217, 217, 155, 217, 41 +pkey_alloc, 330, 395, 289, 328, 324, 364, PNR, 384, 384, 385, 385, 330, 381, 289 +pkey_free, 331, 396, 290, 329, 325, 365, PNR, 385, 385, 386, 386, 331, 382, 290 +pkey_mprotect, 329, 394, 288, 327, 323, 363, PNR, 386, 386, 384, 384, 329, 380, 288 +poll, 7, 168, PNR, 7, 7, 188, 168, 167, 167, 168, 168, 7, 168, PNR +ppoll, 271, 336, 73, 265, 261, 302, 274, 281, 281, 302, 302, 271, 309, 73 +ppoll_time64, PNR, 414, PNR, 414, PNR, 414, PNR, PNR, 414, 414, PNR, PNR, 414, PNR +prctl, 157, 172, 167, 153, 153, 192, 172, 171, 171, 172, 172, 157, 172, 167 +pread64, 17, 180, 67, 16, 16, 200, 108, 179, 179, 180, 180, 17, 180, 67 +preadv, 295, 361, 69, 293, 289, 330, 315, 320, 320, 328, 328, 534, 333, 69 +preadv2, 327, 392, 286, 325, 321, 361, 347, 380, 380, 376, 376, 546, 378, 286 +prlimit64, 302, 369, 261, 302, 297, 338, 321, 325, 325, 334, 334, 302, 340, 261 +process_vm_readv, 310, 376, 270, 309, 304, 345, 330, 351, 351, 340, 340, 539, 347, 270 +process_vm_writev, 311, 377, 271, 310, 305, 346, 331, 352, 352, 341, 341, 540, 348, 271 +prof, PNR, PNR, PNR, PNR, PNR, 44, PNR, 44, 44, PNR, PNR, PNR, 44, PNR +profil, PNR, PNR, PNR, PNR, PNR, 98, PNR, 98, 98, PNR, PNR, PNR, 98, PNR +pselect6, 270, 335, 72, 264, 260, 301, 273, 280, 280, 301, 301, 270, 308, 72 +pselect6_time64, PNR, 413, PNR, 413, PNR, 413, PNR, PNR, 413, 413, PNR, PNR, 413, PNR +ptrace, 101, 26, 117, 99, 99, 26, 26, 26, 26, 26, 26, 521, 26, 117 +putpmsg, 182, PNR, PNR, 175, 175, 209, 197, 188, 188, 189, 189, 182, 189, PNR +pwrite64, 18, 181, 68, 17, 17, 201, 109, 180, 180, 181, 181, 18, 181, 68 +pwritev, 296, 362, 70, 294, 290, 331, 316, 321, 321, 329, 329, 535, 334, 70 +pwritev2, 328, 393, 287, 326, 322, 362, 348, 381, 381, 377, 377, 547, 379, 287 +query_module, 178, PNR, PNR, 171, 171, 187, 167, 166, 166, 167, 167, PNR, 167, PNR +quotactl, 179, 131, 60, 172, 172, 131, 131, 131, 131, 131, 131, 179, 131, 60 +read, 0, 3, 63, 0, 0, 3, 3, 3, 3, 3, 3, 0, 3, 63 +readahead, 187, 225, 213, 179, 179, 223, 207, 191, 191, 222, 222, 187, 225, 213 +readdir, PNR, PNR, PNR, PNR, PNR, 89, PNR, 89, 89, 89, 89, PNR, 89, PNR +readlink, 89, 85, PNR, 87, 87, 85, 85, 85, 85, 85, 85, 89, 85, PNR +readlinkat, 267, 332, 78, 261, 257, 298, 285, 296, 296, 298, 298, 267, 305, 78 +readv, 19, 145, 65, 18, 18, 145, 145, 145, 145, 145, 145, 515, 145, 65 +reboot, 169, 88, 142, 164, 164, 88, 88, 88, 88, 88, 88, 169, 88, 142 +recv, PNR, 291, PNR, PNR, PNR, 175, 98, 336, 336, PNR, PNR, PNR, PNR, PNR +recvfrom, 45, 292, 207, 44, 44, 176, 123, 337, 337, PNR, PNR, 517, PNR, 207 +recvmmsg, 299, 365, 243, 298, 294, 335, 319, 343, 343, PNR, PNR, 537, PNR, 243 +recvmmsg_time64, PNR, 417, PNR, 417, PNR, 417, PNR, PNR, 417, 417, PNR, PNR, 417, PNR +recvmsg, 47, 297, 212, 46, 46, 177, 184, 342, 342, PNR, PNR, 519, PNR, 212 +remap_file_pages, 216, 253, 234, 210, 210, 251, 227, 239, 239, 267, 267, 216, 257, 234 +removexattr, 197, 235, 14, 189, 189, 233, 247, 218, 218, 233, 233, 197, 235, 14 +rename, 82, 38, PNR, 80, 80, 38, 38, 38, 38, 38, 38, 82, 38, PNR +renameat, 264, 329, 38, 258, 254, 295, 282, 293, 293, 295, 295, 264, 302, PNR +renameat2, 316, 382, 276, 315, 311, 351, 337, 357, 357, 347, 347, 316, 353, 276 +request_key, 249, 310, 218, 244, 240, 281, 265, 270, 270, 279, 279, 249, 287, 218 +restart_syscall, 219, 0, 128, 214, 213, 253, 0, 0, 0, 7, 7, 219, 0, 128 +riscv_flush_icache, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244 +rmdir, 84, 40, PNR, 82, 82, 40, 40, 40, 40, 40, 40, 84, 40, PNR +rseq, 334, 398, 293, 331, 327, 367, PNR, 387, 387, 383, 383, 334, 386, 293 +rtas, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 255, 255, PNR, PNR, PNR, PNR, PNR +rt_sigaction, 13, 174, 134, 13, 13, 194, 174, 173, 173, 174, 174, 512, 174, 134 +rt_sigpending, 127, 176, 136, 125, 125, 196, 176, 175, 175, 176, 176, 522, 176, 136 +rt_sigprocmask, 14, 175, 135, 14, 14, 195, 175, 174, 174, 175, 175, 14, 175, 135 +rt_sigqueueinfo, 129, 178, 138, 127, 127, 198, 178, 177, 177, 178, 178, 524, 178, 138 +rt_sigreturn, 15, 173, 139, 211, 211, 193, 173, 172, 172, 173, 173, 513, 173, 139 +rt_sigsuspend, 130, 179, 133, 128, 128, 199, 179, 178, 178, 179, 179, 130, 179, 133 +rt_sigtimedwait, 128, 177, 137, 126, 126, 197, 177, 176, 176, 177, 177, 523, 177, 137 +rt_sigtimedwait_time64, PNR, 421, PNR, 421, PNR, 421, PNR, PNR, 421, 421, PNR, PNR, 421, PNR +rt_tgsigqueueinfo, 297, 363, 240, 295, 291, 332, 317, 322, 322, 330, 330, 536, 335, 240 +s390_guarded_storage, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 378, 378, PNR, PNR, PNR +s390_pci_mmio_read, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 353, 353, PNR, PNR, PNR +s390_pci_mmio_write, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 352, 352, PNR, PNR, PNR +s390_runtime_instr, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 342, 342, PNR, PNR, PNR +s390_sthyi, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 380, 380, PNR, PNR, PNR +sched_getaffinity, 204, 242, 123, 196, 196, 240, 212, 223, 223, 240, 240, 204, 242, 123 +sched_getattr, 315, 381, 275, 314, 310, 350, 335, 356, 356, 346, 346, 315, 352, 275 +sched_getparam, 143, 155, 121, 140, 140, 159, 155, 155, 155, 155, 155, 143, 155, 121 +sched_get_priority_max, 146, 159, 125, 143, 143, 163, 159, 159, 159, 159, 159, 146, 159, 125 +sched_get_priority_min, 147, 160, 126, 144, 144, 164, 160, 160, 160, 160, 160, 147, 160, 126 +sched_getscheduler, 145, 157, 120, 142, 142, 161, 157, 157, 157, 157, 157, 145, 157, 120 +sched_rr_get_interval, 148, 161, 127, 145, 145, 165, 161, 161, 161, 161, 161, 148, 161, 127 +sched_rr_get_interval_time64, PNR, 423, PNR, 423, PNR, 423, PNR, PNR, 423, 423, PNR, PNR, 423, PNR +sched_setaffinity, 203, 241, 122, 195, 195, 239, 211, 222, 222, 239, 239, 203, 241, 122 +sched_setattr, 314, 380, 274, 313, 309, 349, 334, 355, 355, 345, 345, 314, 351, 274 +sched_setparam, 142, 154, 118, 139, 139, 158, 154, 154, 154, 154, 154, 142, 154, 118 +sched_setscheduler, 144, 156, 119, 141, 141, 160, 156, 156, 156, 156, 156, 144, 156, 119 +sched_yield, 24, 158, 124, 23, 23, 162, 158, 158, 158, 158, 158, 24, 158, 124 +seccomp, 317, 383, 277, 316, 312, 352, 338, 358, 358, 348, 348, 317, 354, 277 +security, 185, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 185, PNR, PNR +select, 23, PNR, PNR, PNR, PNR, PNR, PNR, 82, 82, PNR, 142, 23, 82, PNR +semctl, 66, 300, 191, 64, 64, 394, 187, 394, 394, 394, 394, 66, PNR, 191 +semget, 64, 299, 190, 62, 62, 393, 186, 393, 393, 393, 393, 64, PNR, 190 +semop, 65, 298, 193, 63, 63, PNR, 185, PNR, PNR, PNR, PNR, 65, PNR, 193 +semtimedop, 220, 312, 192, 215, 214, PNR, 228, 392, PNR, PNR, 392, 220, PNR, 192 +semtimedop_time64, PNR, 420, PNR, 420, PNR, 420, PNR, PNR, 420, 420, PNR, PNR, 420, PNR +send, PNR, 289, PNR, PNR, PNR, 178, 58, 334, 334, PNR, PNR, PNR, PNR, PNR +sendfile, 40, 187, 71, 39, 39, 207, 122, 186, 186, 187, 187, 40, 187, 71 +sendfile64, PNR, 239, PNR, 219, PNR, 237, 209, PNR, 226, 223, PNR, PNR, 239, PNR +sendmmsg, 307, 374, 269, 307, 302, 343, 329, 349, 349, PNR, PNR, 538, PNR, 269 +sendmsg, 46, 296, 211, 45, 45, 179, 183, 341, 341, PNR, PNR, 518, PNR, 211 +sendto, 44, 290, 206, 43, 43, 180, 82, 335, 335, PNR, PNR, 44, PNR, 206 +setdomainname, 171, 121, 162, 166, 166, 121, 121, 121, 121, 121, 121, 171, 121, 162 +setfsgid, 123, 139, 152, 121, 121, 139, 139, 139, 139, 139, 216, 123, 139, 152 +setfsgid32, PNR, 216, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 216, PNR, PNR, 216, PNR +setfsuid, 122, 138, 151, 120, 120, 138, 138, 138, 138, 138, 215, 122, 138, 151 +setfsuid32, PNR, 215, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 215, PNR, PNR, 215, PNR +setgid, 106, 46, 144, 104, 104, 46, 46, 46, 46, 46, 214, 106, 46, 144 +setgid32, PNR, 214, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 214, PNR, PNR, 214, PNR +setgroups, 116, 81, 159, 114, 114, 81, 81, 81, 81, 81, 206, 116, 81, 159 +setgroups32, PNR, 206, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 206, PNR, PNR, 206, PNR +sethostname, 170, 74, 161, 165, 165, 74, 74, 74, 74, 74, 74, 170, 74, 161 +setitimer, 38, 104, 103, 36, 36, 104, 104, 104, 104, 104, 104, 38, 104, 103 +set_mempolicy, 238, 321, 237, 233, 229, 270, 262, 261, 261, 270, 270, 238, 276, 237 +setns, 308, 375, 268, 308, 303, 344, 328, 350, 350, 339, 339, 308, 346, 268 +setpgid, 109, 57, 154, 107, 107, 57, 57, 57, 57, 57, 57, 109, 57, 154 +setpriority, 141, 97, 140, 138, 138, 97, 97, 97, 97, 97, 97, 141, 97, 140 +setregid, 114, 71, 143, 112, 112, 71, 71, 71, 71, 71, 204, 114, 71, 143 +setregid32, PNR, 204, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 204, PNR, PNR, 204, PNR +setresgid, 119, 170, 149, 117, 117, 190, 170, 169, 169, 170, 210, 119, 170, 149 +setresgid32, PNR, 210, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 210, PNR, PNR, 210, PNR +setresuid, 117, 164, 147, 115, 115, 185, 164, 164, 164, 164, 208, 117, 164, 147 +setresuid32, PNR, 208, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 208, PNR, PNR, 208, PNR +setreuid, 113, 70, 145, 111, 111, 70, 70, 70, 70, 70, 203, 113, 70, 145 +setreuid32, PNR, 203, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 203, PNR, PNR, 203, PNR +setrlimit, 160, 75, PNR, 155, 155, 75, 75, 75, 75, 75, 75, 160, 75, 164 +set_robust_list, 273, 338, 99, 272, 268, 309, 289, 300, 300, 304, 304, 530, 311, 99 +setsid, 112, 66, 157, 110, 110, 66, 66, 66, 66, 66, 66, 112, 66, 157 +setsockopt, 54, 294, 208, 53, 53, 181, 181, 339, 339, PNR, PNR, 541, PNR, 208 +set_thread_area, 205, PNR, PNR, 246, 242, 283, 213, PNR, PNR, PNR, PNR, PNR, 243, PNR +set_tid_address, 218, 256, 96, 213, 212, 252, 237, 232, 232, 252, 252, 218, 258, 96 +settimeofday, 164, 79, 170, 159, 159, 79, 79, 79, 79, 79, 79, 164, 79, 170 +set_tls, PNR, 0x0f0000+5, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +setuid, 105, 23, 146, 103, 103, 23, 23, 23, 23, 23, 213, 105, 23, 146 +setuid32, PNR, 213, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 213, PNR, PNR, 213, PNR +setxattr, 188, 226, 5, 180, 180, 224, 238, 209, 209, 224, 224, 188, 226, 5 +sgetmask, PNR, PNR, PNR, PNR, PNR, 68, 68, 68, 68, PNR, PNR, PNR, 68, PNR +shmat, 30, 305, 196, 29, 29, 397, 192, 397, 397, 397, 397, 30, PNR, 196 +shmctl, 31, 308, 195, 30, 30, 396, 195, 396, 396, 396, 396, 31, PNR, 195 +shmdt, 67, 306, 197, 65, 65, 398, 193, 398, 398, 398, 398, 67, PNR, 197 +shmget, 29, 307, 194, 28, 28, 395, 194, 395, 395, 395, 395, 29, PNR, 194 +shutdown, 48, 293, 210, 47, 47, 182, 117, 338, 338, PNR, PNR, 48, PNR, 210 +sigaction, PNR, 67, PNR, PNR, PNR, 67, PNR, 67, 67, 67, 67, PNR, 67, PNR +sigaltstack, 131, 186, 132, 129, 129, 206, 166, 185, 185, 186, 186, 525, 186, 132 +signal, PNR, PNR, PNR, PNR, PNR, 48, 48, 48, 48, 48, 48, PNR, 48, PNR +signalfd, 282, 349, PNR, 280, 276, 317, 302, 305, 305, 316, 316, 282, 321, PNR +signalfd4, 289, 355, 74, 287, 283, 324, 309, 313, 313, 322, 322, 289, 327, 74 +sigpending, PNR, 73, PNR, PNR, PNR, 73, 73, 73, 73, 73, 73, PNR, 73, PNR +sigprocmask, PNR, 126, PNR, PNR, PNR, 126, 126, 126, 126, 126, 126, PNR, 126, PNR +sigreturn, PNR, 119, PNR, PNR, PNR, 119, PNR, 119, 119, 119, 119, PNR, 119, PNR +sigsuspend, PNR, 72, PNR, PNR, PNR, 72, PNR, 72, 72, 72, 72, PNR, 72, PNR +socket, 41, 281, 198, 40, 40, 183, 17, 326, 326, PNR, PNR, 41, PNR, 198 +socketcall, PNR, PNR, PNR, PNR, PNR, 102, PNR, 102, 102, 102, 102, PNR, 102, PNR +socketpair, 53, 288, 199, 52, 52, 184, 56, 333, 333, PNR, PNR, 53, PNR, 199 +splice, 275, 340, 76, 267, 263, 304, 291, 283, 283, 306, 306, 275, 313, 76 +spu_create, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 279, 279, PNR, PNR, PNR, PNR, PNR +spu_run, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 278, 278, PNR, PNR, PNR, PNR, PNR +ssetmask, PNR, PNR, PNR, PNR, PNR, 69, 69, 69, 69, PNR, PNR, PNR, 69, PNR +stat, 4, 106, PNR, 4, 4, 106, 18, 106, 106, 106, 106, 4, 106, PNR +stat64, PNR, 195, PNR, PNR, PNR, 213, 101, PNR, 195, 195, PNR, PNR, 195, PNR +statfs, 137, 99, 43, 134, 134, 99, 99, 99, 99, 99, 99, 137, 99, 43 +statfs64, PNR, 266, PNR, 217, PNR, 255, 298, 252, 252, 265, 265, PNR, 268, PNR +statx, 332, 397, 291, 330, 326, 366, 349, 383, 383, 379, 379, 332, 383, 291 +stime, PNR, PNR, PNR, PNR, PNR, 25, 25, 25, 25, 25, PNR, PNR, 25, PNR +stty, PNR, PNR, PNR, PNR, PNR, 31, PNR, 31, 31, PNR, PNR, PNR, 31, PNR +subpage_prot, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 310, 310, PNR, PNR, PNR, PNR, PNR +swapcontext, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 249, 249, PNR, PNR, PNR, PNR, PNR +swapoff, 168, 115, 225, 163, 163, 115, 115, 115, 115, 115, 115, 168, 115, 225 +swapon, 167, 87, 224, 162, 162, 87, 87, 87, 87, 87, 87, 167, 87, 224 +switch_endian, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 363, 363, PNR, PNR, PNR, PNR, PNR +symlink, 88, 83, PNR, 86, 86, 83, 83, 83, 83, 83, 83, 88, 83, PNR +symlinkat, 266, 331, 36, 260, 256, 297, 284, 295, 295, 297, 297, 266, 304, 36 +sync, 162, 36, 81, 157, 157, 36, 36, 36, 36, 36, 36, 162, 36, 81 +sync_file_range, 277, PNR, 84, 268, 264, 305, 292, PNR, PNR, 307, 307, 277, 314, 84 +sync_file_range2, PNR, 341, PNR, PNR, PNR, PNR, PNR, 308, 308, PNR, PNR, PNR, PNR, PNR +syncfs, 306, 373, 267, 306, 301, 342, 327, 348, 348, 338, 338, 306, 344, 267 +syscall, PNR, PNR, PNR, PNR, PNR, 0, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +_sysctl, 156, 149, PNR, 152, 152, 153, 149, 149, 149, 149, 149, PNR, 149, PNR +sys_debug_setcontext, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 256, 256, PNR, PNR, PNR, PNR, PNR +sysfs, 139, 135, PNR, 136, 136, 135, 135, 135, 135, 135, 135, 139, 135, PNR +sysinfo, 99, 116, 179, 97, 97, 116, 116, 116, 116, 116, 116, 99, 116, 179 +syslog, 103, 103, 116, 101, 101, 103, 103, 103, 103, 103, 103, 103, 103, 116 +sysmips, PNR, PNR, PNR, 199, 199, 149, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +tee, 276, 342, 77, 269, 265, 306, 293, 284, 284, 308, 308, 276, 315, 77 +tgkill, 234, 268, 131, 229, 225, 266, 259, 250, 250, 241, 241, 234, 270, 131 +time, 201, PNR, PNR, PNR, PNR, 13, 13, 13, 13, 13, PNR, 201, 13, PNR +timer_create, 222, 257, 107, 220, 216, 257, 250, 240, 240, 254, 254, 526, 259, 107 +timer_delete, 226, 261, 111, 224, 220, 261, 254, 244, 244, 258, 258, 226, 263, 111 +timerfd, PNR, PNR, PNR, 281, 277, 318, 303, PNR, PNR, 317, 317, PNR, PNR, PNR +timerfd_create, 283, 350, 85, 284, 280, 321, 306, 306, 306, 319, 319, 283, 322, 85 +timerfd_gettime, 287, 354, 87, 285, 281, 322, 308, 312, 312, 321, 321, 287, 326, 87 +timerfd_gettime64, PNR, 410, PNR, 410, PNR, 410, PNR, PNR, 410, 410, PNR, PNR, 410, PNR +timerfd_settime, 286, 353, 86, 286, 282, 323, 307, 311, 311, 320, 320, 286, 325, 86 +timerfd_settime64, PNR, 411, PNR, 411, PNR, 411, PNR, PNR, 411, 411, PNR, PNR, 411, PNR +timer_getoverrun, 225, 260, 109, 223, 219, 260, 253, 243, 243, 257, 257, 225, 262, 109 +timer_gettime, 224, 259, 108, 222, 218, 259, 252, 242, 242, 256, 256, 224, 261, 108 +timer_gettime64, PNR, 408, PNR, 408, PNR, 408, PNR, PNR, 408, 408, PNR, PNR, 408, PNR +timer_settime, 223, 258, 110, 221, 217, 258, 251, 241, 241, 255, 255, 223, 260, 110 +timer_settime64, PNR, 409, PNR, 409, PNR, 409, PNR, PNR, 409, 409, PNR, PNR, 409, PNR +times, 100, 43, 153, 98, 98, 43, 43, 43, 43, 43, 43, 100, 43, 153 +tkill, 200, 238, 130, 192, 192, 236, 208, 208, 208, 237, 237, 200, 238, 130 +truncate, 76, 92, 45, 74, 74, 92, 92, 92, 92, 92, 92, 76, 92, 45 +truncate64, PNR, 193, PNR, PNR, PNR, 211, 199, PNR, 193, 193, PNR, PNR, 193, PNR +tuxcall, 184, PNR, PNR, PNR, PNR, PNR, PNR, 225, 225, PNR, PNR, 184, PNR, PNR +ugetrlimit, PNR, 191, PNR, PNR, PNR, PNR, PNR, 190, 190, 191, PNR, PNR, 191, PNR +ulimit, PNR, PNR, PNR, PNR, PNR, 58, PNR, 58, 58, PNR, PNR, PNR, 58, PNR +umask, 95, 60, 166, 93, 93, 60, 60, 60, 60, 60, 60, 95, 60, 166 +umount, PNR, PNR, PNR, PNR, PNR, 22, PNR, 22, 22, 22, 22, PNR, 22, PNR +umount2, 166, 52, 39, 161, 161, 52, 52, 52, 52, 52, 52, 166, 52, 39 +uname, 63, 122, 160, 61, 61, 122, 59, 122, 122, 122, 122, 63, 122, 160 +unlink, 87, 10, PNR, 85, 85, 10, 10, 10, 10, 10, 10, 87, 10, PNR +unlinkat, 263, 328, 35, 257, 253, 294, 281, 292, 292, 294, 294, 263, 301, 35 +unshare, 272, 337, 97, 266, 262, 303, 288, 282, 282, 303, 303, 272, 310, 97 +uselib, 134, 86, PNR, PNR, PNR, 86, 86, 86, 86, 86, 86, PNR, 86, PNR +userfaultfd, 323, 388, 282, 321, 317, 357, 344, 364, 364, 355, 355, 323, 374, 282 +usr26, PNR, 0x0f0000+3, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +usr32, PNR, 0x0f0000+4, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR +ustat, 136, 62, PNR, 133, 133, 62, 62, 62, 62, 62, 62, 136, 62, PNR +utime, 132, PNR, PNR, 130, 130, 30, 30, 30, 30, 30, 30, 132, 30, PNR +utimensat, 280, 348, 88, 279, 275, 316, 301, 304, 304, 315, 315, 280, 320, 88 +utimensat_time64, PNR, 412, PNR, 412, PNR, 412, PNR, PNR, 412, 412, PNR, PNR, 412, PNR +utimes, 235, 269, PNR, 230, 226, 267, 336, 251, 251, 313, 313, 235, 271, PNR +vfork, 58, 190, PNR, PNR, PNR, PNR, 113, 189, 189, 190, 190, 58, 190, PNR +vhangup, 153, 111, 58, 150, 150, 111, 111, 111, 111, 111, 111, 153, 111, 58 +vm86, PNR, PNR, PNR, PNR, PNR, 113, PNR, 113, 113, PNR, PNR, PNR, 166, PNR +vm86old, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, PNR, 113, PNR +vmsplice, 278, 343, 75, 270, 266, 307, 294, 285, 285, 309, 309, 532, 316, 75 +vserver, 236, 313, PNR, 240, 236, 277, 263, PNR, PNR, PNR, PNR, PNR, 273, PNR +wait4, 61, 114, 260, 59, 59, 114, 114, 114, 114, 114, 114, 61, 114, 260 +waitid, 247, 280, 95, 241, 237, 278, 235, 272, 272, 281, 281, 529, 284, 95 +waitpid, PNR, PNR, PNR, PNR, PNR, 7, 7, 7, 7, PNR, PNR, PNR, 7, PNR +write, 1, 4, 64, 1, 1, 4, 4, 4, 4, 4, 4, 1, 4, 64 +writev, 20, 146, 66, 19, 19, 146, 146, 146, 146, 146, 146, 516, 146, 66 diff --git a/src/syscalls.h b/src/syscalls.h new file mode 100644 index 00000000..c6f127d7 --- /dev/null +++ b/src/syscalls.h @@ -0,0 +1,59 @@ +/** + * Enhanced Seccomp x86_64 Syscall Table + * + * Copyright (c) 2012, 2020 Red Hat + * Author: Paul Moore + * gperf support: Giuseppe Scrivano + */ + +#ifndef _SYSCALLS_H +#define _SYSCALLS_H + +#include + +#include "arch-aarch64.h" +#include "arch-arm.h" +#include "arch.h" +#include "arch-mips64.h" +#include "arch-mips64n32.h" +#include "arch-mips.h" +#include "arch-parisc.h" +#include "arch-ppc64.h" +#include "arch-ppc.h" +#include "arch-s390.h" +#include "arch-s390x.h" +#include "arch-x32.h" +#include "arch-x86_64.h" +#include "arch-x86.h" +#include "arch-x86.h" +#include "arch-riscv64.h" + +struct arch_syscall_def_internal { + int name; + /* Each arch listed here must be defined in syscalls.c */ + int x86_64; + int arm; + int aarch64; + int mips64n32; + int mips64; + int mips; + int parisc; + int ppc64; + int ppc; + int s390; + int s390x; + int x32; + int x86; + int riscv64; + + int index; +}; + +#define OFFSET_ARCH(NAME) offsetof(struct arch_syscall_def_internal, NAME) + +/* Defined in syscalls.perf.template */ +int syscall_resolve_name(const char *name, int offset); +const char *syscall_resolve_num(int num, int offset); +const struct arch_syscall_def *syscall_iterate(unsigned int spot, int offset); + +#endif diff --git a/src/syscalls.perf.template b/src/syscalls.perf.template new file mode 100644 index 00000000..8478c870 --- /dev/null +++ b/src/syscalls.perf.template @@ -0,0 +1,78 @@ +%{ +/** + * Copyright (c) 2012 Red Hat + * Copyright (c) 2020 Red Hat + * Authors: Paul Moore , Giuseppe Scrivano + */ + +/* + * This library is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License as + * published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ +#include +#include +#include "syscalls.h" + +%} +struct arch_syscall_def_internal; + +%% +@@SYSCALLS_TABLE@@ +%% + +static int syscall_get_offset_value(const struct arch_syscall_def_internal *s, int offset) +{ + return *(int *)((char *)s + offset); +} + +int syscall_resolve_name(const char *name, int offset) +{ + const struct arch_syscall_def_internal *s; + + s = in_word_set(name, strlen(name)); + if (s == NULL) + return __NR_SCMP_ERROR; + + return syscall_get_offset_value(s, offset); +} + +const char *syscall_resolve_num(int num, int offset) +{ + unsigned int iter; + + for (iter = 0; iter < sizeof(wordlist)/sizeof(wordlist[0]); iter++) { + if (syscall_get_offset_value(&wordlist[iter], offset) == num) + return (stringpool + wordlist[iter].name); + } + + return NULL; +} + +const struct arch_syscall_def *syscall_iterate(unsigned int spot, int offset) +{ + unsigned int iter; + /* It is thread-unsafe. It should be used only for testing. */ + static struct arch_syscall_def ret; + + ret.name = NULL; + ret.num = __NR_SCMP_ERROR; + + for (iter = 0; iter < sizeof(wordlist)/sizeof(wordlist[0]); iter++) { + if (wordlist[iter].index == spot) { + ret.name = stringpool + wordlist[iter].name; + ret.num = syscall_get_offset_value(&wordlist[iter], offset); + return &ret; + } + } + + return &ret; +} diff --git a/tests/56-iterate-syscalls.c b/tests/56-iterate-syscalls.c new file mode 100644 index 00000000..c75cb0e3 --- /dev/null +++ b/tests/56-iterate-syscalls.c @@ -0,0 +1,85 @@ +/** + * Seccomp Library test program + * + * Copyright (c) 2020 Red Hat + * Author: Giuseppe Scrivano + */ + +/* + * This library is free software; you can redistribute it and/or modify it + * under the terms of version 2.1 of the GNU Lesser General Public License as + * published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, see . + */ + +#include +#include +#include +#include + +#include + +unsigned int arch_list[] = { + SCMP_ARCH_NATIVE, + SCMP_ARCH_X86, + SCMP_ARCH_X86_64, + SCMP_ARCH_X32, + SCMP_ARCH_ARM, + SCMP_ARCH_AARCH64, + SCMP_ARCH_MIPS, + SCMP_ARCH_MIPS64, + SCMP_ARCH_MIPS64N32, + SCMP_ARCH_MIPSEL, + SCMP_ARCH_MIPSEL64, + SCMP_ARCH_MIPSEL64N32, + SCMP_ARCH_PPC, + SCMP_ARCH_PPC64, + SCMP_ARCH_PPC64LE, + SCMP_ARCH_S390, + SCMP_ARCH_S390X, + SCMP_ARCH_PARISC, + SCMP_ARCH_PARISC64, + SCMP_ARCH_RISCV64, + -1 +}; + +static int test_arch(int arch) +{ + int n, iter = 0; + + for (iter = 0; ; iter++) { + char *name; + + name = seccomp_syscall_resolve_num_arch(arch, iter); + if (name == NULL) + break; + + n = seccomp_syscall_resolve_name_arch(arch, name); + if (n < 0) + return 1; + + if (n != iter) { + return 1; + } + } + return 0; +} + +int main(int argc, char *argv[]) +{ + int iter = 0; + + for (iter = 0; arch_list[iter] != -1; iter++) { + if (test_arch(arch_list[iter]) < 0) + return 1; + } + + return 0; +} diff --git a/tests/56-iterate-syscalls.py b/tests/56-iterate-syscalls.py new file mode 100755 index 00000000..6aef884f --- /dev/null +++ b/tests/56-iterate-syscalls.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +# +# Seccomp Library test program +# +# Copyright (c) 2020 Red Hat +# Author: Giuseppe Scrivano +# + +# +# This library is free software; you can redistribute it and/or modify it +# under the terms of version 2.1 of the GNU Lesser General Public License as +# published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +# for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, see . +# + +import argparse +import sys + +import util + +from seccomp import * + +arch_list = ["x86", + "x86_64", + "x32", + "arm", + "aarch64", + "mipsel", + "mipsel64", + "mipsel64n32", + "ppc64le", + "riscv64"] + +def test_arch(arch): + i = 0 + while True: + sys_name = resolve_syscall(i, i) + if sys_name is None: + break + n = resolve_syscall(i, sys_name) + if i != n: + raise RuntimeError("Test failure") + i = i + 1 + +def test(): + for i in arch_list: + test_arch(Arch(i)) + +# kate: syntax python; +# kate: indent-mode python; space-indent on; indent-width 4; mixedindent off; diff --git a/tests/56-iterate-syscalls.tests b/tests/56-iterate-syscalls.tests new file mode 100644 index 00000000..8a99d14c --- /dev/null +++ b/tests/56-iterate-syscalls.tests @@ -0,0 +1,11 @@ +# +# libseccomp regression test automation data +# +# Copyright (c) 2020 Red Hat +# Author: Giuseppe Scrivano +# + +test type: basic + +# Test command +56-iterate-syscalls diff --git a/tests/Makefile.am b/tests/Makefile.am index 4bd19c80..b8a754f2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -94,7 +94,8 @@ check_PROGRAMS = \ 52-basic-load \ 53-sim-binary_tree \ 54-live-binary_tree \ - 55-basic-pfc_binary_tree + 55-basic-pfc_binary_tree \ + 56-iterate-syscalls EXTRA_DIST_TESTPYTHON = \ util.py \ @@ -150,7 +151,8 @@ EXTRA_DIST_TESTPYTHON = \ 51-live-user_notification.py \ 52-basic-load.py \ 53-sim-binary_tree.py \ - 54-live-binary_tree.py + 54-live-binary_tree.py \ + 56-iterate-syscalls.py EXTRA_DIST_TESTCFGS = \ 01-sim-allow.tests \ @@ -207,7 +209,8 @@ EXTRA_DIST_TESTCFGS = \ 52-basic-load.tests \ 53-sim-binary_tree.tests \ 54-live-binary_tree.tests \ - 55-basic-pfc_binary_tree.tests + 55-basic-pfc_binary_tree.tests \ + 56-iterate-syscalls.tests EXTRA_DIST_TESTSCRIPTS = \ 38-basic-pfc_coverage.sh 38-basic-pfc_coverage.pfc \