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