| 1 | /** |
| 2 | * Enhanced Seccomp ARM Syscall Table |
| 3 | * |
| 4 | * Copyright (c) 2013 Red Hat <pmoore@redhat.com> |
| 5 | * Author: Paul Moore <paul@paul-moore.com> |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * This library is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of version 2.1 of the GNU Lesser General Public License as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 16 | * for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Lesser General Public License |
| 19 | * along with this library; if not, see <http://www.gnu.org/licenses>. |
| 20 | */ |
| 21 | |
| 22 | #include <string.h> |
| 23 | |
| 24 | #include <seccomp.h> |
| 25 | |
| 26 | #include "arch.h" |
| 27 | #include "arch-arm.h" |
| 28 | |
| 29 | #define __SCMP_NR_OABI_SYSCALL_BASE 0x900000 |
| 30 | #define __SCMP_ARM_NR_BASE 0x0f0000 |
| 31 | |
| 32 | /* NOTE: we currently only support the ARM EABI, more info at the URL below: |
| 33 | * -> http://wiki.embeddedarm.com/wiki/EABI_vs_OABI */ |
| 34 | #if 1 |
| 35 | #define __SCMP_NR_BASE 0 |
| 36 | #else |
| 37 | #define __SCMP_NR_BASE __SCMP_NR_OABI_SYSCALL_BASE |
| 38 | #endif |
| 39 | |
| 40 | /* NOTE: based on Linux 4.5-rc4 */ |
| 41 | const struct arch_syscall_def arm_syscall_table[] = { \ |
| 42 | /* NOTE: arm_sync_file_range() and sync_file_range2() share values */ |
| 43 | { "_llseek", (__SCMP_NR_BASE + 140) }, |
| 44 | { "_newselect", (__SCMP_NR_BASE + 142) }, |
| 45 | { "_sysctl", (__SCMP_NR_BASE + 149) }, |
| 46 | { "accept", (__SCMP_NR_BASE + 285) }, |
| 47 | { "accept4", (__SCMP_NR_BASE + 366) }, |
| 48 | { "access", (__SCMP_NR_BASE + 33) }, |
| 49 | { "acct", (__SCMP_NR_BASE + 51) }, |
| 50 | { "add_key", (__SCMP_NR_BASE + 309) }, |
| 51 | { "adjtimex", (__SCMP_NR_BASE + 124) }, |
| 52 | { "afs_syscall", __PNR_afs_syscall }, |
| 53 | { "alarm", __PNR_alarm }, |
| 54 | { "arm_fadvise64_64", (__SCMP_NR_BASE + 270) }, |
| 55 | { "arm_sync_file_range", (__SCMP_NR_BASE + 341) }, |
| 56 | { "arch_prctl", __PNR_arch_prctl }, |
| 57 | { "bdflush", (__SCMP_NR_BASE + 134) }, |
| 58 | { "bind", (__SCMP_NR_BASE + 282) }, |
| 59 | { "bpf", (__SCMP_NR_BASE + 386) }, |
| 60 | { "break", __PNR_break }, |
| 61 | { "breakpoint", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 1)) }, |
| 62 | { "brk", (__SCMP_NR_BASE + 45) }, |
| 63 | { "cachectl", __PNR_cachectl }, |
| 64 | { "cacheflush", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 2)) }, |
| 65 | { "capget", (__SCMP_NR_BASE + 184) }, |
| 66 | { "capset", (__SCMP_NR_BASE + 185) }, |
| 67 | { "chdir", (__SCMP_NR_BASE + 12) }, |
| 68 | { "chmod", (__SCMP_NR_BASE + 15) }, |
| 69 | { "chown", (__SCMP_NR_BASE + 182) }, |
| 70 | { "chown32", (__SCMP_NR_BASE + 212) }, |
| 71 | { "chroot", (__SCMP_NR_BASE + 61) }, |
| 72 | { "clock_adjtime", (__SCMP_NR_BASE + 372) }, |
| 73 | { "clock_getres", (__SCMP_NR_BASE + 264) }, |
| 74 | { "clock_gettime", (__SCMP_NR_BASE + 263) }, |
| 75 | { "clock_nanosleep", (__SCMP_NR_BASE + 265) }, |
| 76 | { "clock_settime", (__SCMP_NR_BASE + 262) }, |
| 77 | { "clone", (__SCMP_NR_BASE + 120) }, |
| 78 | { "close", (__SCMP_NR_BASE + 6) }, |
| 79 | { "connect", (__SCMP_NR_BASE + 283) }, |
| 80 | { "copy_file_range", (__SCMP_NR_BASE + 391) }, |
| 81 | { "creat", (__SCMP_NR_BASE + 8) }, |
| 82 | { "create_module", __PNR_create_module }, |
| 83 | { "delete_module", (__SCMP_NR_BASE + 129) }, |
| 84 | { "dup", (__SCMP_NR_BASE + 41) }, |
| 85 | { "dup2", (__SCMP_NR_BASE + 63) }, |
| 86 | { "dup3", (__SCMP_NR_BASE + 358) }, |
| 87 | { "epoll_create", (__SCMP_NR_BASE + 250) }, |
| 88 | { "epoll_create1", (__SCMP_NR_BASE + 357) }, |
| 89 | { "epoll_ctl", (__SCMP_NR_BASE + 251) }, |
| 90 | { "epoll_ctl_old", __PNR_epoll_ctl_old }, |
| 91 | { "epoll_pwait", (__SCMP_NR_BASE + 346) }, |
| 92 | { "epoll_wait", (__SCMP_NR_BASE + 252) }, |
| 93 | { "epoll_wait_old", __PNR_epoll_wait_old }, |
| 94 | { "eventfd", (__SCMP_NR_BASE + 351) }, |
| 95 | { "eventfd2", (__SCMP_NR_BASE + 356) }, |
| 96 | { "execve", (__SCMP_NR_BASE + 11) }, |
| 97 | { "execveat", (__SCMP_NR_BASE + 387) }, |
| 98 | { "exit", (__SCMP_NR_BASE + 1) }, |
| 99 | { "exit_group", (__SCMP_NR_BASE + 248) }, |
| 100 | { "faccessat", (__SCMP_NR_BASE + 334) }, |
| 101 | { "fadvise64", __PNR_fadvise64 }, |
| 102 | { "fadvise64_64", __PNR_fadvise64_64 }, |
| 103 | { "fallocate", (__SCMP_NR_BASE + 352) }, |
| 104 | { "fanotify_init", (__SCMP_NR_BASE + 367) }, |
| 105 | { "fanotify_mark", (__SCMP_NR_BASE + 368) }, |
| 106 | { "fchdir", (__SCMP_NR_BASE + 133) }, |
| 107 | { "fchmod", (__SCMP_NR_BASE + 94) }, |
| 108 | { "fchmodat", (__SCMP_NR_BASE + 333) }, |
| 109 | { "fchown", (__SCMP_NR_BASE + 95) }, |
| 110 | { "fchown32", (__SCMP_NR_BASE + 207) }, |
| 111 | { "fchownat", (__SCMP_NR_BASE + 325) }, |
| 112 | { "fcntl", (__SCMP_NR_BASE + 55) }, |
| 113 | { "fcntl64", (__SCMP_NR_BASE + 221) }, |
| 114 | { "fdatasync", (__SCMP_NR_BASE + 148) }, |
| 115 | { "fgetxattr", (__SCMP_NR_BASE + 231) }, |
| 116 | { "finit_module", (__SCMP_NR_BASE + 379) }, |
| 117 | { "flistxattr", (__SCMP_NR_BASE + 234) }, |
| 118 | { "flock", (__SCMP_NR_BASE + 143) }, |
| 119 | { "fork", (__SCMP_NR_BASE + 2) }, |
| 120 | { "fremovexattr", (__SCMP_NR_BASE + 237) }, |
| 121 | { "fsetxattr", (__SCMP_NR_BASE + 228) }, |
| 122 | { "fstat", (__SCMP_NR_BASE + 108) }, |
| 123 | { "fstat64", (__SCMP_NR_BASE + 197) }, |
| 124 | { "fstatat64", (__SCMP_NR_BASE + 327) }, |
| 125 | { "fstatfs", (__SCMP_NR_BASE + 100) }, |
| 126 | { "fstatfs64", (__SCMP_NR_BASE + 267) }, |
| 127 | { "fsync", (__SCMP_NR_BASE + 118) }, |
| 128 | { "ftime", __PNR_ftime }, |
| 129 | { "ftruncate", (__SCMP_NR_BASE + 93) }, |
| 130 | { "ftruncate64", (__SCMP_NR_BASE + 194) }, |
| 131 | { "futex", (__SCMP_NR_BASE + 240) }, |
| 132 | { "futimesat", (__SCMP_NR_BASE + 326) }, |
| 133 | { "get_kernel_syms", __PNR_get_kernel_syms }, |
| 134 | { "get_mempolicy", (__SCMP_NR_BASE + 320) }, |
| 135 | { "get_robust_list", (__SCMP_NR_BASE + 339) }, |
| 136 | { "get_thread_area", __PNR_get_thread_area }, |
| 137 | { "getcpu", (__SCMP_NR_BASE + 345) }, |
| 138 | { "getcwd", (__SCMP_NR_BASE + 183) }, |
| 139 | { "getdents", (__SCMP_NR_BASE + 141) }, |
| 140 | { "getdents64", (__SCMP_NR_BASE + 217) }, |
| 141 | { "getegid", (__SCMP_NR_BASE + 50) }, |
| 142 | { "getegid32", (__SCMP_NR_BASE + 202) }, |
| 143 | { "geteuid", (__SCMP_NR_BASE + 49) }, |
| 144 | { "geteuid32", (__SCMP_NR_BASE + 201) }, |
| 145 | { "getgid", (__SCMP_NR_BASE + 47) }, |
| 146 | { "getgid32", (__SCMP_NR_BASE + 200) }, |
| 147 | { "getgroups", (__SCMP_NR_BASE + 80) }, |
| 148 | { "getgroups32", (__SCMP_NR_BASE + 205) }, |
| 149 | { "getitimer", (__SCMP_NR_BASE + 105) }, |
| 150 | { "getpeername", (__SCMP_NR_BASE + 287) }, |
| 151 | { "getpgid", (__SCMP_NR_BASE + 132) }, |
| 152 | { "getpgrp", (__SCMP_NR_BASE + 65) }, |
| 153 | { "getpid", (__SCMP_NR_BASE + 20) }, |
| 154 | { "getpmsg", __PNR_getpmsg }, |
| 155 | { "getppid", (__SCMP_NR_BASE + 64) }, |
| 156 | { "getpriority", (__SCMP_NR_BASE + 96) }, |
| 157 | { "getrandom", (__SCMP_NR_BASE + 384) }, |
| 158 | { "getresgid", (__SCMP_NR_BASE + 171) }, |
| 159 | { "getresgid32", (__SCMP_NR_BASE + 211) }, |
| 160 | { "getresuid", (__SCMP_NR_BASE + 165) }, |
| 161 | { "getresuid32", (__SCMP_NR_BASE + 209) }, |
| 162 | { "getrlimit", __PNR_getrlimit }, |
| 163 | { "getrusage", (__SCMP_NR_BASE + 77) }, |
| 164 | { "getsid", (__SCMP_NR_BASE + 147) }, |
| 165 | { "getsockname", (__SCMP_NR_BASE + 286) }, |
| 166 | { "getsockopt", (__SCMP_NR_BASE + 295) }, |
| 167 | { "gettid", (__SCMP_NR_BASE + 224) }, |
| 168 | { "gettimeofday", (__SCMP_NR_BASE + 78) }, |
| 169 | { "getuid", (__SCMP_NR_BASE + 24) }, |
| 170 | { "getuid32", (__SCMP_NR_BASE + 199) }, |
| 171 | { "getxattr", (__SCMP_NR_BASE + 229) }, |
| 172 | { "gtty", __PNR_gtty }, |
| 173 | { "idle", __PNR_idle }, |
| 174 | { "init_module", (__SCMP_NR_BASE + 128) }, |
| 175 | { "inotify_add_watch", (__SCMP_NR_BASE + 317) }, |
| 176 | { "inotify_init", (__SCMP_NR_BASE + 316) }, |
| 177 | { "inotify_init1", (__SCMP_NR_BASE + 360) }, |
| 178 | { "inotify_rm_watch", (__SCMP_NR_BASE + 318) }, |
| 179 | { "io_cancel", (__SCMP_NR_BASE + 247) }, |
| 180 | { "io_destroy", (__SCMP_NR_BASE + 244) }, |
| 181 | { "io_getevents", (__SCMP_NR_BASE + 245) }, |
| 182 | { "io_setup", (__SCMP_NR_BASE + 243) }, |
| 183 | { "io_submit", (__SCMP_NR_BASE + 246) }, |
| 184 | { "ioctl", (__SCMP_NR_BASE + 54) }, |
| 185 | { "ioperm", __PNR_ioperm }, |
| 186 | { "iopl", __PNR_iopl }, |
| 187 | { "ioprio_get", (__SCMP_NR_BASE + 315) }, |
| 188 | { "ioprio_set", (__SCMP_NR_BASE + 314) }, |
| 189 | { "ipc", __PNR_ipc }, |
| 190 | { "kcmp", (__SCMP_NR_BASE + 378) }, |
| 191 | { "kexec_file_load", __PNR_kexec_file_load }, |
| 192 | { "kexec_load", (__SCMP_NR_BASE + 347) }, |
| 193 | { "keyctl", (__SCMP_NR_BASE + 311) }, |
| 194 | { "kill", (__SCMP_NR_BASE + 37) }, |
| 195 | { "lchown", (__SCMP_NR_BASE + 16) }, |
| 196 | { "lchown32", (__SCMP_NR_BASE + 198) }, |
| 197 | { "lgetxattr", (__SCMP_NR_BASE + 230) }, |
| 198 | { "link", (__SCMP_NR_BASE + 9) }, |
| 199 | { "linkat", (__SCMP_NR_BASE + 330) }, |
| 200 | { "listen", (__SCMP_NR_BASE + 284) }, |
| 201 | { "listxattr", (__SCMP_NR_BASE + 232) }, |
| 202 | { "llistxattr", (__SCMP_NR_BASE + 233) }, |
| 203 | { "lock", __PNR_lock }, |
| 204 | { "lookup_dcookie", (__SCMP_NR_BASE + 249) }, |
| 205 | { "lremovexattr", (__SCMP_NR_BASE + 236) }, |
| 206 | { "lseek", (__SCMP_NR_BASE + 19) }, |
| 207 | { "lsetxattr", (__SCMP_NR_BASE + 227) }, |
| 208 | { "lstat", (__SCMP_NR_BASE + 107) }, |
| 209 | { "lstat64", (__SCMP_NR_BASE + 196) }, |
| 210 | { "madvise", (__SCMP_NR_BASE + 220) }, |
| 211 | { "mbind", (__SCMP_NR_BASE + 319) }, |
| 212 | { "membarrier", (__SCMP_NR_BASE + 389) }, |
| 213 | { "memfd_create", (__SCMP_NR_BASE + 385) }, |
| 214 | { "migrate_pages", __PNR_migrate_pages }, |
| 215 | { "mincore", (__SCMP_NR_BASE + 219) }, |
| 216 | { "mkdir", (__SCMP_NR_BASE + 39) }, |
| 217 | { "mkdirat", (__SCMP_NR_BASE + 323) }, |
| 218 | { "mknod", (__SCMP_NR_BASE + 14) }, |
| 219 | { "mknodat", (__SCMP_NR_BASE + 324) }, |
| 220 | { "mlock", (__SCMP_NR_BASE + 150) }, |
| 221 | { "mlock2", (__SCMP_NR_BASE + 390) }, |
| 222 | { "mlockall", (__SCMP_NR_BASE + 152) }, |
| 223 | { "mmap", __PNR_mmap }, |
| 224 | { "mmap2", (__SCMP_NR_BASE + 192) }, |
| 225 | { "modify_ldt", __PNR_modify_ldt }, |
| 226 | { "mount", (__SCMP_NR_BASE + 21) }, |
| 227 | { "move_pages", (__SCMP_NR_BASE + 344) }, |
| 228 | { "mprotect", (__SCMP_NR_BASE + 125) }, |
| 229 | { "mpx", __PNR_mpx }, |
| 230 | { "mq_getsetattr", (__SCMP_NR_BASE + 279) }, |
| 231 | { "mq_notify", (__SCMP_NR_BASE + 278) }, |
| 232 | { "mq_open", (__SCMP_NR_BASE + 274) }, |
| 233 | { "mq_timedreceive", (__SCMP_NR_BASE + 277) }, |
| 234 | { "mq_timedsend", (__SCMP_NR_BASE + 276) }, |
| 235 | { "mq_unlink", (__SCMP_NR_BASE + 275) }, |
| 236 | { "mremap", (__SCMP_NR_BASE + 163) }, |
| 237 | { "msgctl", (__SCMP_NR_BASE + 304) }, |
| 238 | { "msgget", (__SCMP_NR_BASE + 303) }, |
| 239 | { "msgrcv", (__SCMP_NR_BASE + 302) }, |
| 240 | { "msgsnd", (__SCMP_NR_BASE + 301) }, |
| 241 | { "msync", (__SCMP_NR_BASE + 144) }, |
| 242 | { "multiplexer", __PNR_multiplexer }, |
| 243 | { "munlock", (__SCMP_NR_BASE + 151) }, |
| 244 | { "munlockall", (__SCMP_NR_BASE + 153) }, |
| 245 | { "munmap", (__SCMP_NR_BASE + 91) }, |
| 246 | { "name_to_handle_at", (__SCMP_NR_BASE + 370) }, |
| 247 | { "nanosleep", (__SCMP_NR_BASE + 162) }, |
| 248 | { "newfstatat", __PNR_newfstatat }, |
| 249 | { "nfsservctl", (__SCMP_NR_BASE + 169) }, |
| 250 | { "nice", (__SCMP_NR_BASE + 34) }, |
| 251 | { "oldfstat", __PNR_oldfstat }, |
| 252 | { "oldlstat", __PNR_oldlstat }, |
| 253 | { "oldolduname", __PNR_oldolduname }, |
| 254 | { "oldstat", __PNR_oldstat }, |
| 255 | { "olduname", __PNR_olduname }, |
| 256 | { "oldwait4", __PNR_oldwait4 }, |
| 257 | { "open", (__SCMP_NR_BASE + 5) }, |
| 258 | { "open_by_handle_at", (__SCMP_NR_BASE + 371) }, |
| 259 | { "openat", (__SCMP_NR_BASE + 322) }, |
| 260 | { "pause", (__SCMP_NR_BASE + 29) }, |
| 261 | { "pciconfig_iobase", (__SCMP_NR_BASE + 271) }, |
| 262 | { "pciconfig_read", (__SCMP_NR_BASE + 272) }, |
| 263 | { "pciconfig_write", (__SCMP_NR_BASE + 273) }, |
| 264 | { "perf_event_open", (__SCMP_NR_BASE + 364) }, |
| 265 | { "personality", (__SCMP_NR_BASE + 136) }, |
| 266 | { "pipe", (__SCMP_NR_BASE + 42) }, |
| 267 | { "pipe2", (__SCMP_NR_BASE + 359) }, |
| 268 | { "pivot_root", (__SCMP_NR_BASE + 218) }, |
| 269 | { "poll", (__SCMP_NR_BASE + 168) }, |
| 270 | { "ppoll", (__SCMP_NR_BASE + 336) }, |
| 271 | { "prctl", (__SCMP_NR_BASE + 172) }, |
| 272 | { "pread64", (__SCMP_NR_BASE + 180) }, |
| 273 | { "preadv", (__SCMP_NR_BASE + 361) }, |
| 274 | { "prlimit64", (__SCMP_NR_BASE + 369) }, |
| 275 | { "process_vm_readv", (__SCMP_NR_BASE + 376) }, |
| 276 | { "process_vm_writev", (__SCMP_NR_BASE + 377) }, |
| 277 | { "prof", __PNR_prof }, |
| 278 | { "profil", __PNR_profil }, |
| 279 | { "pselect6", (__SCMP_NR_BASE + 335) }, |
| 280 | { "ptrace", (__SCMP_NR_BASE + 26) }, |
| 281 | { "putpmsg", __PNR_putpmsg }, |
| 282 | { "pwrite64", (__SCMP_NR_BASE + 181) }, |
| 283 | { "pwritev", (__SCMP_NR_BASE + 362) }, |
| 284 | { "query_module", __PNR_query_module }, |
| 285 | { "quotactl", (__SCMP_NR_BASE + 131) }, |
| 286 | { "read", (__SCMP_NR_BASE + 3) }, |
| 287 | { "readahead", (__SCMP_NR_BASE + 225) }, |
| 288 | { "readdir", __PNR_readdir }, |
| 289 | { "readlink", (__SCMP_NR_BASE + 85) }, |
| 290 | { "readlinkat", (__SCMP_NR_BASE + 332) }, |
| 291 | { "readv", (__SCMP_NR_BASE + 145) }, |
| 292 | { "reboot", (__SCMP_NR_BASE + 88) }, |
| 293 | { "recv", (__SCMP_NR_BASE + 291) }, |
| 294 | { "recvfrom", (__SCMP_NR_BASE + 292) }, |
| 295 | { "recvmmsg", (__SCMP_NR_BASE + 365) }, |
| 296 | { "recvmsg", (__SCMP_NR_BASE + 297) }, |
| 297 | { "remap_file_pages", (__SCMP_NR_BASE + 253) }, |
| 298 | { "removexattr", (__SCMP_NR_BASE + 235) }, |
| 299 | { "rename", (__SCMP_NR_BASE + 38) }, |
| 300 | { "renameat", (__SCMP_NR_BASE + 329) }, |
| 301 | { "renameat2", (__SCMP_NR_BASE + 382) }, |
| 302 | { "request_key", (__SCMP_NR_BASE + 310) }, |
| 303 | { "restart_syscall", (__SCMP_NR_BASE + 0) }, |
| 304 | { "rmdir", (__SCMP_NR_BASE + 40) }, |
| 305 | { "rt_sigaction", (__SCMP_NR_BASE + 174) }, |
| 306 | { "rt_sigpending", (__SCMP_NR_BASE + 176) }, |
| 307 | { "rt_sigprocmask", (__SCMP_NR_BASE + 175) }, |
| 308 | { "rt_sigqueueinfo", (__SCMP_NR_BASE + 178) }, |
| 309 | { "rt_sigreturn", (__SCMP_NR_BASE + 173) }, |
| 310 | { "rt_sigsuspend", (__SCMP_NR_BASE + 179) }, |
| 311 | { "rt_sigtimedwait", (__SCMP_NR_BASE + 177) }, |
| 312 | { "rt_tgsigqueueinfo", (__SCMP_NR_BASE + 363) }, |
| 313 | { "rtas", __PNR_rtas }, |
| 314 | { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, |
| 315 | { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, |
| 316 | { "s390_runtime_instr", __PNR_s390_runtime_instr }, |
| 317 | { "sched_get_priority_max", (__SCMP_NR_BASE + 159) }, |
| 318 | { "sched_get_priority_min", (__SCMP_NR_BASE + 160) }, |
| 319 | { "sched_getaffinity", (__SCMP_NR_BASE + 242) }, |
| 320 | { "sched_getattr", (__SCMP_NR_BASE + 381) }, |
| 321 | { "sched_getparam", (__SCMP_NR_BASE + 155) }, |
| 322 | { "sched_getscheduler", (__SCMP_NR_BASE + 157) }, |
| 323 | { "sched_rr_get_interval", (__SCMP_NR_BASE + 161) }, |
| 324 | { "sched_setaffinity", (__SCMP_NR_BASE + 241) }, |
| 325 | { "sched_setattr", (__SCMP_NR_BASE + 380) }, |
| 326 | { "sched_setparam", (__SCMP_NR_BASE + 154) }, |
| 327 | { "sched_setscheduler", (__SCMP_NR_BASE + 156) }, |
| 328 | { "sched_yield", (__SCMP_NR_BASE + 158) }, |
| 329 | { "seccomp", (__SCMP_NR_BASE + 383) }, |
| 330 | { "security", __PNR_security }, |
| 331 | { "select", __PNR_select }, |
| 332 | { "semctl", (__SCMP_NR_BASE + 300) }, |
| 333 | { "semget", (__SCMP_NR_BASE + 299) }, |
| 334 | { "semop", (__SCMP_NR_BASE + 298) }, |
| 335 | { "semtimedop", (__SCMP_NR_BASE + 312) }, |
| 336 | { "send", (__SCMP_NR_BASE + 289) }, |
| 337 | { "sendfile", (__SCMP_NR_BASE + 187) }, |
| 338 | { "sendfile64", (__SCMP_NR_BASE + 239) }, |
| 339 | { "sendmmsg", (__SCMP_NR_BASE + 374) }, |
| 340 | { "sendmsg", (__SCMP_NR_BASE + 296) }, |
| 341 | { "sendto", (__SCMP_NR_BASE + 290) }, |
| 342 | { "set_mempolicy", (__SCMP_NR_BASE + 321) }, |
| 343 | { "set_robust_list", (__SCMP_NR_BASE + 338) }, |
| 344 | { "set_thread_area", __PNR_set_thread_area }, |
| 345 | { "set_tid_address", (__SCMP_NR_BASE + 256) }, |
| 346 | { "set_tls", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 5)) }, |
| 347 | { "setdomainname", (__SCMP_NR_BASE + 121) }, |
| 348 | { "setfsgid", (__SCMP_NR_BASE + 139) }, |
| 349 | { "setfsgid32", (__SCMP_NR_BASE + 216) }, |
| 350 | { "setfsuid", (__SCMP_NR_BASE + 138) }, |
| 351 | { "setfsuid32", (__SCMP_NR_BASE + 215) }, |
| 352 | { "setgid", (__SCMP_NR_BASE + 46) }, |
| 353 | { "setgid32", (__SCMP_NR_BASE + 214) }, |
| 354 | { "setgroups", (__SCMP_NR_BASE + 81) }, |
| 355 | { "setgroups32", (__SCMP_NR_BASE + 206) }, |
| 356 | { "sethostname", (__SCMP_NR_BASE + 74) }, |
| 357 | { "setitimer", (__SCMP_NR_BASE + 104) }, |
| 358 | { "setns", (__SCMP_NR_BASE + 375) }, |
| 359 | { "setpgid", (__SCMP_NR_BASE + 57) }, |
| 360 | { "setpriority", (__SCMP_NR_BASE + 97) }, |
| 361 | { "setregid", (__SCMP_NR_BASE + 71) }, |
| 362 | { "setregid32", (__SCMP_NR_BASE + 204) }, |
| 363 | { "setresgid", (__SCMP_NR_BASE + 170) }, |
| 364 | { "setresgid32", (__SCMP_NR_BASE + 210) }, |
| 365 | { "setresuid", (__SCMP_NR_BASE + 164) }, |
| 366 | { "setresuid32", (__SCMP_NR_BASE + 208) }, |
| 367 | { "setreuid", (__SCMP_NR_BASE + 70) }, |
| 368 | { "setreuid32", (__SCMP_NR_BASE + 203) }, |
| 369 | { "setrlimit", (__SCMP_NR_BASE + 75) }, |
| 370 | { "setsid", (__SCMP_NR_BASE + 66) }, |
| 371 | { "setsockopt", (__SCMP_NR_BASE + 294) }, |
| 372 | { "settimeofday", (__SCMP_NR_BASE + 79) }, |
| 373 | { "setuid", (__SCMP_NR_BASE + 23) }, |
| 374 | { "setuid32", (__SCMP_NR_BASE + 213) }, |
| 375 | { "setxattr", (__SCMP_NR_BASE + 226) }, |
| 376 | { "sgetmask", __PNR_sgetmask }, |
| 377 | { "shmat", (__SCMP_NR_BASE + 305) }, |
| 378 | { "shmctl", (__SCMP_NR_BASE + 308) }, |
| 379 | { "shmdt", (__SCMP_NR_BASE + 306) }, |
| 380 | { "shmget", (__SCMP_NR_BASE + 307) }, |
| 381 | { "shutdown", (__SCMP_NR_BASE + 293) }, |
| 382 | { "sigaction", (__SCMP_NR_BASE + 67) }, |
| 383 | { "sigaltstack", (__SCMP_NR_BASE + 186) }, |
| 384 | { "signal", __PNR_signal }, |
| 385 | { "signalfd", (__SCMP_NR_BASE + 349) }, |
| 386 | { "signalfd4", (__SCMP_NR_BASE + 355) }, |
| 387 | { "sigpending", (__SCMP_NR_BASE + 73) }, |
| 388 | { "sigprocmask", (__SCMP_NR_BASE + 126) }, |
| 389 | { "sigreturn", (__SCMP_NR_BASE + 119) }, |
| 390 | { "sigsuspend", (__SCMP_NR_BASE + 72) }, |
| 391 | { "socket", (__SCMP_NR_BASE + 281) }, |
| 392 | { "socketcall", __PNR_socketcall }, |
| 393 | { "socketpair", (__SCMP_NR_BASE + 288) }, |
| 394 | { "splice", (__SCMP_NR_BASE + 340) }, |
| 395 | { "spu_create", __PNR_spu_create }, |
| 396 | { "spu_run", __PNR_spu_run }, |
| 397 | { "ssetmask", __PNR_ssetmask }, |
| 398 | { "stat", (__SCMP_NR_BASE + 106) }, |
| 399 | { "stat64", (__SCMP_NR_BASE + 195) }, |
| 400 | { "statfs", (__SCMP_NR_BASE + 99) }, |
| 401 | { "statfs64", (__SCMP_NR_BASE + 266) }, |
| 402 | { "stime", __PNR_stime }, |
| 403 | { "stty", __PNR_stty }, |
| 404 | { "subpage_prot", __PNR_subpage_prot }, |
| 405 | { "swapcontext", __PNR_swapcontext }, |
| 406 | { "swapoff", (__SCMP_NR_BASE + 115) }, |
| 407 | { "swapon", (__SCMP_NR_BASE + 87) }, |
| 408 | { "switch_endian", __PNR_switch_endian }, |
| 409 | { "symlink", (__SCMP_NR_BASE + 83) }, |
| 410 | { "symlinkat", (__SCMP_NR_BASE + 331) }, |
| 411 | { "sync", (__SCMP_NR_BASE + 36) }, |
| 412 | { "sync_file_range", __PNR_sync_file_range }, |
| 413 | { "sync_file_range2", (__SCMP_NR_BASE + 341) }, |
| 414 | { "syncfs", (__SCMP_NR_BASE + 373) }, |
| 415 | { "syscall", (__PNR_syscall) }, |
| 416 | { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, |
| 417 | { "sysfs", (__SCMP_NR_BASE + 135) }, |
| 418 | { "sysinfo", (__SCMP_NR_BASE + 116) }, |
| 419 | { "syslog", (__SCMP_NR_BASE + 103) }, |
| 420 | { "sysmips", __PNR_sysmips }, |
| 421 | { "tee", (__SCMP_NR_BASE + 342) }, |
| 422 | { "tgkill", (__SCMP_NR_BASE + 268) }, |
| 423 | { "time", __PNR_time }, |
| 424 | { "timer_create", (__SCMP_NR_BASE + 257) }, |
| 425 | { "timer_delete", (__SCMP_NR_BASE + 261) }, |
| 426 | { "timer_getoverrun", (__SCMP_NR_BASE + 260) }, |
| 427 | { "timer_gettime", (__SCMP_NR_BASE + 259) }, |
| 428 | { "timer_settime", (__SCMP_NR_BASE + 258) }, |
| 429 | { "timerfd", __PNR_timerfd }, |
| 430 | { "timerfd_create", (__SCMP_NR_BASE + 350) }, |
| 431 | { "timerfd_gettime", (__SCMP_NR_BASE + 354) }, |
| 432 | { "timerfd_settime", (__SCMP_NR_BASE + 353) }, |
| 433 | { "times", (__SCMP_NR_BASE + 43) }, |
| 434 | { "tkill", (__SCMP_NR_BASE + 238) }, |
| 435 | { "truncate", (__SCMP_NR_BASE + 92) }, |
| 436 | { "truncate64", (__SCMP_NR_BASE + 193) }, |
| 437 | { "tuxcall", __PNR_tuxcall }, |
| 438 | { "ugetrlimit", (__SCMP_NR_BASE + 191) }, |
| 439 | { "ulimit", __PNR_ulimit }, |
| 440 | { "umask", (__SCMP_NR_BASE + 60) }, |
| 441 | { "umount", __PNR_umount }, |
| 442 | { "umount2", (__SCMP_NR_BASE + 52) }, |
| 443 | { "uname", (__SCMP_NR_BASE + 122) }, |
| 444 | { "unlink", (__SCMP_NR_BASE + 10) }, |
| 445 | { "unlinkat", (__SCMP_NR_BASE + 328) }, |
| 446 | { "unshare", (__SCMP_NR_BASE + 337) }, |
| 447 | { "uselib", (__SCMP_NR_BASE + 86) }, |
| 448 | { "userfaultfd", (__SCMP_NR_BASE + 388) }, |
| 449 | { "usr26", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 3)) }, |
| 450 | { "usr32", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 4)) }, |
| 451 | { "ustat", (__SCMP_NR_BASE + 62) }, |
| 452 | { "utime", __PNR_utime }, |
| 453 | { "utimensat", (__SCMP_NR_BASE + 348) }, |
| 454 | { "utimes", (__SCMP_NR_BASE + 269) }, |
| 455 | { "vfork", (__SCMP_NR_BASE + 190) }, |
| 456 | { "vhangup", (__SCMP_NR_BASE + 111) }, |
| 457 | { "vm86", __PNR_vm86 }, |
| 458 | { "vm86old", __PNR_vm86old }, |
| 459 | { "vmsplice", (__SCMP_NR_BASE + 343) }, |
| 460 | { "vserver", (__SCMP_NR_BASE + 313) }, |
| 461 | { "wait4", (__SCMP_NR_BASE + 114) }, |
| 462 | { "waitid", (__SCMP_NR_BASE + 280) }, |
| 463 | { "waitpid", __PNR_waitpid }, |
| 464 | { "write", (__SCMP_NR_BASE + 4) }, |
| 465 | { "writev", (__SCMP_NR_BASE + 146) }, |
| 466 | { NULL, __NR_SCMP_ERROR }, |
| 467 | }; |
| 468 | |
| 469 | /** |
| 470 | * Resolve a syscall name to a number |
| 471 | * @param name the syscall name |
| 472 | * |
| 473 | * Resolve the given syscall name to the syscall number using the syscall table. |
| 474 | * Returns the syscall number on success, including negative pseudo syscall |
| 475 | * numbers; returns __NR_SCMP_ERROR on failure. |
| 476 | * |
| 477 | */ |
| 478 | int arm_syscall_resolve_name(const char *name) |
| 479 | { |
| 480 | unsigned int iter; |
| 481 | const struct arch_syscall_def *table = arm_syscall_table; |
| 482 | |
| 483 | /* XXX - plenty of room for future improvement here */ |
| 484 | for (iter = 0; table[iter].name != NULL; iter++) { |
| 485 | if (strcmp(name, table[iter].name) == 0) |
| 486 | return table[iter].num; |
| 487 | } |
| 488 | |
| 489 | return __NR_SCMP_ERROR; |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Resolve a syscall number to a name |
| 494 | * @param num the syscall number |
| 495 | * |
| 496 | * Resolve the given syscall number to the syscall name using the syscall table. |
| 497 | * Returns a pointer to the syscall name string on success, including pseudo |
| 498 | * syscall names; returns NULL on failure. |
| 499 | * |
| 500 | */ |
| 501 | const char *arm_syscall_resolve_num(int num) |
| 502 | { |
| 503 | unsigned int iter; |
| 504 | const struct arch_syscall_def *table = arm_syscall_table; |
| 505 | |
| 506 | /* XXX - plenty of room for future improvement here */ |
| 507 | for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { |
| 508 | if (num == table[iter].num) |
| 509 | return table[iter].name; |
| 510 | } |
| 511 | |
| 512 | return NULL; |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * Iterate through the syscall table and return the syscall name |
| 517 | * @param spot the offset into the syscall table |
| 518 | * |
| 519 | * Return the syscall name at position @spot or NULL on failure. This function |
| 520 | * should only ever be used internally by libseccomp. |
| 521 | * |
| 522 | */ |
| 523 | const char *arm_syscall_iterate_name(unsigned int spot) |
| 524 | { |
| 525 | /* XXX - no safety checks here */ |
| 526 | return arm_syscall_table[spot].name; |
| 527 | } |