diff options
Diffstat (limited to 'recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch')
-rw-r--r-- | recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch | 782 |
1 files changed, 782 insertions, 0 deletions
diff --git a/recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch b/recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch new file mode 100644 index 0000000..30fa449 --- /dev/null +++ b/recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch | |||
@@ -0,0 +1,782 @@ | |||
1 | From 25fc85ba58eba3980649e5bded51816a98cbefc0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
3 | Date: Wed, 11 Feb 2015 13:23:25 +0000 | ||
4 | Subject: [PATCH 08/11] arch: add a ppc syscall table | ||
5 | |||
6 | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
7 | [PM: slight reordering of ppc/ppc64 in header files and makefiles] | ||
8 | Signed-off-by: Paul Moore <pmoore@redhat.com> | ||
9 | --- | ||
10 | include/seccomp.h.in | 1 + | ||
11 | src/Makefile.am | 1 + | ||
12 | src/arch-ppc-syscalls.c | 504 ++++++++++++++++++++++++++++++++++++++++++++++ | ||
13 | src/arch-ppc.c | 33 +++ | ||
14 | src/arch-ppc.h | 38 ++++ | ||
15 | src/arch-syscall-check.c | 13 +- | ||
16 | src/arch-syscall-dump.c | 4 + | ||
17 | src/arch-syscall-validate | 31 ++- | ||
18 | 8 files changed, 623 insertions(+), 2 deletions(-) | ||
19 | create mode 100644 src/arch-ppc-syscalls.c | ||
20 | create mode 100644 src/arch-ppc.c | ||
21 | create mode 100644 src/arch-ppc.h | ||
22 | |||
23 | diff --git a/include/seccomp.h.in b/include/seccomp.h.in | ||
24 | index 42f3f1a..3af4c2b 100644 | ||
25 | --- a/include/seccomp.h.in | ||
26 | +++ b/include/seccomp.h.in | ||
27 | @@ -153,6 +153,7 @@ struct scmp_arg_cmp { | ||
28 | /** | ||
29 | * The PowerPC architecture tokens | ||
30 | */ | ||
31 | +#define SCMP_ARCH_PPC AUDIT_ARCH_PPC | ||
32 | #define SCMP_ARCH_PPC64 AUDIT_ARCH_PPC64 | ||
33 | #ifndef AUDIT_ARCH_PPC64LE | ||
34 | #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) | ||
35 | diff --git a/src/Makefile.am b/src/Makefile.am | ||
36 | index 038b2ef..54f8478 100644 | ||
37 | --- a/src/Makefile.am | ||
38 | +++ b/src/Makefile.am | ||
39 | @@ -31,6 +31,7 @@ SOURCES_ARCH = \ | ||
40 | arch-mips.h arch-mips.c arch-mips-syscalls.c \ | ||
41 | arch-mips64.h arch-mips64.c arch-mips64-syscalls.c \ | ||
42 | arch-mips64n32.h arch-mips64n32.c arch-mips64n32-syscalls.c \ | ||
43 | + arch-ppc.h arch-ppc.c arch-ppc-syscalls.c \ | ||
44 | arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c | ||
45 | |||
46 | SOURCES_GEN = \ | ||
47 | diff --git a/src/arch-ppc-syscalls.c b/src/arch-ppc-syscalls.c | ||
48 | new file mode 100644 | ||
49 | index 0000000..32fc05a | ||
50 | --- /dev/null | ||
51 | +++ b/src/arch-ppc-syscalls.c | ||
52 | @@ -0,0 +1,504 @@ | ||
53 | +/** | ||
54 | + * Enhanced Seccomp PPC Specific Code | ||
55 | + * | ||
56 | + * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com> | ||
57 | + * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
58 | + * | ||
59 | + */ | ||
60 | + | ||
61 | +/* | ||
62 | + * This library is free software; you can redistribute it and/or modify it | ||
63 | + * under the terms of version 2.1 of the GNU Lesser General Public License as | ||
64 | + * published by the Free Software Foundation. | ||
65 | + * | ||
66 | + * This library is distributed in the hope that it will be useful, but WITHOUT | ||
67 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
68 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | ||
69 | + * for more details. | ||
70 | + * | ||
71 | + * You should have received a copy of the GNU Lesser General Public License | ||
72 | + * along with this library; if not, see <http://www.gnu.org/licenses>. | ||
73 | + */ | ||
74 | + | ||
75 | +#include <string.h> | ||
76 | + | ||
77 | +#include <seccomp.h> | ||
78 | + | ||
79 | +#include "arch.h" | ||
80 | +#include "arch-ppc.h" | ||
81 | + | ||
82 | +/* NOTE: based on Linux 3.19 */ | ||
83 | +const struct arch_syscall_def ppc_syscall_table[] = { \ | ||
84 | + { "_llseek", 140 }, | ||
85 | + { "_newselect", 142 }, | ||
86 | + { "_sysctl", 149 }, | ||
87 | + { "accept", 330 }, | ||
88 | + { "accept4", 344 }, | ||
89 | + { "access", 33 }, | ||
90 | + { "acct", 51 }, | ||
91 | + { "add_key", 269 }, | ||
92 | + { "adjtimex", 124 }, | ||
93 | + { "afs_syscall", 137 }, | ||
94 | + { "alarm", 27 }, | ||
95 | + { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, | ||
96 | + { "arm_sync_file_range", __PNR_arm_sync_file_range }, | ||
97 | + { "arch_prctl", __PNR_arch_prctl }, | ||
98 | + { "bdflush", 134 }, | ||
99 | + { "bind", 327 }, | ||
100 | + { "bpf", 361 }, | ||
101 | + { "break", 17 }, | ||
102 | + { "brk", 45 }, | ||
103 | + { "cachectl", __PNR_cachectl }, | ||
104 | + { "cacheflush", __PNR_cacheflush }, | ||
105 | + { "capget", 183 }, | ||
106 | + { "capset", 184 }, | ||
107 | + { "chdir", 12 }, | ||
108 | + { "chmod", 15 }, | ||
109 | + { "chown", 181 }, | ||
110 | + { "chown32", __PNR_chown32 }, | ||
111 | + { "chroot", 61 }, | ||
112 | + { "clock_adjtime", 347 }, | ||
113 | + { "clock_getres", 247 }, | ||
114 | + { "clock_gettime", 246 }, | ||
115 | + { "clock_nanosleep", 248 }, | ||
116 | + { "clock_settime", 245 }, | ||
117 | + { "clone", 120 }, | ||
118 | + { "close", 6 }, | ||
119 | + { "connect", 328 }, | ||
120 | + { "creat", 8 }, | ||
121 | + { "create_module", 127 }, | ||
122 | + { "delete_module", 129 }, | ||
123 | + { "dup", 41 }, | ||
124 | + { "dup2", 63 }, | ||
125 | + { "dup3", 316 }, | ||
126 | + { "epoll_create", 236 }, | ||
127 | + { "epoll_create1", 315 }, | ||
128 | + { "epoll_ctl", 237 }, | ||
129 | + { "epoll_ctl_old", __PNR_epoll_ctl_old }, | ||
130 | + { "epoll_pwait", 303 }, | ||
131 | + { "epoll_wait", 238 }, | ||
132 | + { "epoll_wait_old", __PNR_epoll_wait_old }, | ||
133 | + { "eventfd", 307 }, | ||
134 | + { "eventfd2", 314 }, | ||
135 | + { "execve", 11 }, | ||
136 | + { "execveat", 362 }, | ||
137 | + { "exit", 1 }, | ||
138 | + { "exit_group", 234 }, | ||
139 | + { "faccessat", 298 }, | ||
140 | + { "fadvise64", 233 }, | ||
141 | + { "fadvise64_64", 254 }, | ||
142 | + { "fallocate", 309 }, | ||
143 | + { "fanotify_init", 323 }, | ||
144 | + { "fanotify_mark", 324 }, | ||
145 | + { "fchdir", 133 }, | ||
146 | + { "fchmod", 94 }, | ||
147 | + { "fchmodat", 297 }, | ||
148 | + { "fchown", 95 }, | ||
149 | + { "fchown32", __PNR_fchown32 }, | ||
150 | + { "fchownat", 289 }, | ||
151 | + { "fcntl", 55 }, | ||
152 | + { "fcntl64", 204 }, | ||
153 | + { "fdatasync", 148 }, | ||
154 | + { "fgetxattr", 214 }, | ||
155 | + { "finit_module", 353 }, | ||
156 | + { "flistxattr", 217 }, | ||
157 | + { "flock", 143 }, | ||
158 | + { "fork", 2 }, | ||
159 | + { "fremovexattr", 220 }, | ||
160 | + { "fsetxattr", 211 }, | ||
161 | + { "fstat", 108 }, | ||
162 | + { "fstat64", 197 }, | ||
163 | + { "fstatat64", 291 }, | ||
164 | + { "fstatfs", 100 }, | ||
165 | + { "fstatfs64", 253 }, | ||
166 | + { "fsync", 118 }, | ||
167 | + { "ftime", 35 }, | ||
168 | + { "ftruncate", 93 }, | ||
169 | + { "ftruncate64", 194 }, | ||
170 | + { "futex", 221 }, | ||
171 | + { "futimesat", 290 }, | ||
172 | + { "get_kernel_syms", 130 }, | ||
173 | + { "get_mempolicy", 260 }, | ||
174 | + { "get_robust_list", 299 }, | ||
175 | + { "get_thread_area", __PNR_get_thread_area }, | ||
176 | + { "getcpu", 302 }, | ||
177 | + { "getcwd", 182 }, | ||
178 | + { "getdents", 141 }, | ||
179 | + { "getdents64", 202 }, | ||
180 | + { "getegid", 50 }, | ||
181 | + { "getegid32", __PNR_getegid32 }, | ||
182 | + { "geteuid", 49 }, | ||
183 | + { "geteuid32", __PNR_geteuid32 }, | ||
184 | + { "getgid", 47 }, | ||
185 | + { "getgid32", __PNR_getgid32 }, | ||
186 | + { "getgroups", 80 }, | ||
187 | + { "getgroups32", __PNR_getgroups32 }, | ||
188 | + { "getitimer", 105 }, | ||
189 | + { "getpeername", 332 }, | ||
190 | + { "getpgid", 132 }, | ||
191 | + { "getpgrp", 65 }, | ||
192 | + { "getpid", 20 }, | ||
193 | + { "getpmsg", 187 }, | ||
194 | + { "getppid", 64 }, | ||
195 | + { "getpriority", 96 }, | ||
196 | + { "getrandom", 359 }, | ||
197 | + { "getresgid", 170 }, | ||
198 | + { "getresgid32", __PNR_getresgid32 }, | ||
199 | + { "getresuid", 165 }, | ||
200 | + { "getresuid32", __PNR_getresuid32 }, | ||
201 | + { "getrlimit", 76 }, | ||
202 | + { "getrusage", 77 }, | ||
203 | + { "getsid", 147 }, | ||
204 | + { "getsockname", 331 }, | ||
205 | + { "getsockopt", 340 }, | ||
206 | + { "gettid", 207 }, | ||
207 | + { "gettimeofday", 78 }, | ||
208 | + { "getuid", 24 }, | ||
209 | + { "getuid32", __PNR_getuid32 }, | ||
210 | + { "getxattr", 212 }, | ||
211 | + { "gtty", 32 }, | ||
212 | + { "idle", 112 }, | ||
213 | + { "init_module", 128 }, | ||
214 | + { "inotify_add_watch", 276 }, | ||
215 | + { "inotify_init", 275 }, | ||
216 | + { "inotify_init1", 318 }, | ||
217 | + { "inotify_rm_watch", 277 }, | ||
218 | + { "io_cancel", 231 }, | ||
219 | + { "io_destroy", 228 }, | ||
220 | + { "io_getevents", 229 }, | ||
221 | + { "io_setup", 227 }, | ||
222 | + { "io_submit", 230 }, | ||
223 | + { "ioctl", 54 }, | ||
224 | + { "ioperm", 101 }, | ||
225 | + { "iopl", 110 }, | ||
226 | + { "ioprio_get", 274 }, | ||
227 | + { "ioprio_set", 273 }, | ||
228 | + { "ipc", 117 }, | ||
229 | + { "kcmp", 354 }, | ||
230 | + { "kexec_file_load", __PNR_kexec_file_load }, | ||
231 | + { "kexec_load", 268 }, | ||
232 | + { "keyctl", 271 }, | ||
233 | + { "kill", 37 }, | ||
234 | + { "lchown", 16 }, | ||
235 | + { "lchown32", __PNR_lchown32 }, | ||
236 | + { "lgetxattr", 213 }, | ||
237 | + { "link", 9 }, | ||
238 | + { "linkat", 294 }, | ||
239 | + { "listen", 329 }, | ||
240 | + { "listxattr", 215 }, | ||
241 | + { "llistxattr", 216 }, | ||
242 | + { "lock", 53 }, | ||
243 | + { "lookup_dcookie", 235 }, | ||
244 | + { "lremovexattr", 219 }, | ||
245 | + { "lseek", 19 }, | ||
246 | + { "lsetxattr", 210 }, | ||
247 | + { "lstat", 107 }, | ||
248 | + { "lstat64", 196 }, | ||
249 | + { "madvise", 205 }, | ||
250 | + { "mbind", 259 }, | ||
251 | + { "memfd_create", 360 }, | ||
252 | + { "migrate_pages", 258 }, | ||
253 | + { "mincore", 206 }, | ||
254 | + { "mkdir", 39 }, | ||
255 | + { "mkdirat", 287 }, | ||
256 | + { "mknod", 14 }, | ||
257 | + { "mknodat", 288 }, | ||
258 | + { "mlock", 150 }, | ||
259 | + { "mlockall", 152 }, | ||
260 | + { "mmap", 90 }, | ||
261 | + { "mmap2", 192 }, | ||
262 | + { "modify_ldt", 123 }, | ||
263 | + { "mount", 21 }, | ||
264 | + { "move_pages", 301 }, | ||
265 | + { "mprotect", 125 }, | ||
266 | + { "mpx", 56 }, | ||
267 | + { "mq_getsetattr", 267 }, | ||
268 | + { "mq_notify", 266 }, | ||
269 | + { "mq_open", 262 }, | ||
270 | + { "mq_timedreceive", 265 }, | ||
271 | + { "mq_timedsend", 264 }, | ||
272 | + { "mq_unlink", 263 }, | ||
273 | + { "mremap", 163 }, | ||
274 | + { "msgctl", __PNR_msgctl }, | ||
275 | + { "msgget", __PNR_msgget }, | ||
276 | + { "msgrcv", __PNR_msgrcv }, | ||
277 | + { "msgsnd", __PNR_msgsnd }, | ||
278 | + { "msync", 144 }, | ||
279 | + { "multiplexer", 201 }, | ||
280 | + { "munlock", 151 }, | ||
281 | + { "munlockall", 153 }, | ||
282 | + { "munmap", 91 }, | ||
283 | + { "name_to_handle_at", 345 }, | ||
284 | + { "nanosleep", 162 }, | ||
285 | + { "newfstatat", __PNR_newfstatat }, | ||
286 | + { "nfsservctl", 168 }, | ||
287 | + { "nice", 34 }, | ||
288 | + { "oldfstat", 28 }, | ||
289 | + { "oldlstat", 84 }, | ||
290 | + { "oldolduname", 59 }, | ||
291 | + { "oldstat", 18 }, | ||
292 | + { "olduname", 109 }, | ||
293 | + { "oldwait4", __PNR_oldwait4 }, | ||
294 | + { "open", 5 }, | ||
295 | + { "open_by_handle_at", 346 }, | ||
296 | + { "openat", 286 }, | ||
297 | + { "pause", 29 }, | ||
298 | + { "pciconfig_iobase", 200 }, | ||
299 | + { "pciconfig_read", 198 }, | ||
300 | + { "pciconfig_write", 199 }, | ||
301 | + { "perf_event_open", 319 }, | ||
302 | + { "personality", 136 }, | ||
303 | + { "pipe", 42 }, | ||
304 | + { "pipe2", 317 }, | ||
305 | + { "pivot_root", 203 }, | ||
306 | + { "poll", 167 }, | ||
307 | + { "ppoll", 281 }, | ||
308 | + { "prctl", 171 }, | ||
309 | + { "pread64", 179 }, | ||
310 | + { "preadv", 320 }, | ||
311 | + { "prlimit64", 325 }, | ||
312 | + { "process_vm_readv", 351 }, | ||
313 | + { "process_vm_writev", 352 }, | ||
314 | + { "prof", 44 }, | ||
315 | + { "profil", 98 }, | ||
316 | + { "pselect6", 280 }, | ||
317 | + { "ptrace", 26 }, | ||
318 | + { "putpmsg", 188 }, | ||
319 | + { "pwrite64", 180 }, | ||
320 | + { "pwritev", 321 }, | ||
321 | + { "query_module", 166 }, | ||
322 | + { "quotactl", 131 }, | ||
323 | + { "read", 3 }, | ||
324 | + { "readahead", 191 }, | ||
325 | + { "readdir", 89 }, | ||
326 | + { "readlink", 85 }, | ||
327 | + { "readlinkat", 296 }, | ||
328 | + { "readv", 145 }, | ||
329 | + { "reboot", 88 }, | ||
330 | + { "recv", 336 }, | ||
331 | + { "recvfrom", 337 }, | ||
332 | + { "recvmmsg", 343 }, | ||
333 | + { "recvmsg", 342 }, | ||
334 | + { "remap_file_pages", 239 }, | ||
335 | + { "removexattr", 218 }, | ||
336 | + { "rename", 38 }, | ||
337 | + { "renameat", 293 }, | ||
338 | + { "renameat2", 357 }, | ||
339 | + { "request_key", 270 }, | ||
340 | + { "restart_syscall", 0 }, | ||
341 | + { "rmdir", 40 }, | ||
342 | + { "rt_sigaction", 173 }, | ||
343 | + { "rt_sigpending", 175 }, | ||
344 | + { "rt_sigprocmask", 174 }, | ||
345 | + { "rt_sigqueueinfo", 177 }, | ||
346 | + { "rt_sigreturn", 172 }, | ||
347 | + { "rt_sigsuspend", 178 }, | ||
348 | + { "rt_sigtimedwait", 176 }, | ||
349 | + { "rt_tgsigqueueinfo", 322 }, | ||
350 | + { "rtas", 255 }, | ||
351 | + { "sched_get_priority_max", 159 }, | ||
352 | + { "sched_get_priority_min", 160 }, | ||
353 | + { "sched_getaffinity", 223 }, | ||
354 | + { "sched_getattr", 356 }, | ||
355 | + { "sched_getparam", 155 }, | ||
356 | + { "sched_getscheduler", 157 }, | ||
357 | + { "sched_rr_get_interval", 161 }, | ||
358 | + { "sched_setaffinity", 222 }, | ||
359 | + { "sched_setattr", 355 }, | ||
360 | + { "sched_setparam", 154 }, | ||
361 | + { "sched_setscheduler", 156 }, | ||
362 | + { "sched_yield", 158 }, | ||
363 | + { "seccomp", 358 }, | ||
364 | + { "security", __PNR_security }, | ||
365 | + { "select", 82 }, | ||
366 | + { "semctl", __PNR_semctl }, | ||
367 | + { "semget", __PNR_semget }, | ||
368 | + { "semop", __PNR_semop }, | ||
369 | + { "semtimedop", __PNR_semtimedop }, | ||
370 | + { "send", 334 }, | ||
371 | + { "sendfile", 186 }, | ||
372 | + { "sendfile64", 226 }, | ||
373 | + { "sendmmsg", 349 }, | ||
374 | + { "sendmsg", 341 }, | ||
375 | + { "sendto", 335 }, | ||
376 | + { "set_mempolicy", 261 }, | ||
377 | + { "set_robust_list", 300 }, | ||
378 | + { "set_thread_area", __PNR_set_thread_area }, | ||
379 | + { "set_tid_address", 232 }, | ||
380 | + { "setdomainname", 121 }, | ||
381 | + { "setfsgid", 139 }, | ||
382 | + { "setfsgid32", __PNR_setfsgid32 }, | ||
383 | + { "setfsuid", 138 }, | ||
384 | + { "setfsuid32", __PNR_setfsuid32 }, | ||
385 | + { "setgid", 46 }, | ||
386 | + { "setgid32", __PNR_setgid32 }, | ||
387 | + { "setgroups", 81 }, | ||
388 | + { "setgroups32", __PNR_setgroups32 }, | ||
389 | + { "sethostname", 74 }, | ||
390 | + { "setitimer", 104 }, | ||
391 | + { "setns", 350 }, | ||
392 | + { "setpgid", 57 }, | ||
393 | + { "setpriority", 97 }, | ||
394 | + { "setregid", 71 }, | ||
395 | + { "setregid32", __PNR_setregid32 }, | ||
396 | + { "setresgid", 169 }, | ||
397 | + { "setresgid32", __PNR_setresgid32 }, | ||
398 | + { "setresuid", 164 }, | ||
399 | + { "setresuid32", __PNR_setresuid32 }, | ||
400 | + { "setreuid", 70 }, | ||
401 | + { "setreuid32", __PNR_setreuid32 }, | ||
402 | + { "setrlimit", 75 }, | ||
403 | + { "setsid", 66 }, | ||
404 | + { "setsockopt", 339 }, | ||
405 | + { "settimeofday", 79 }, | ||
406 | + { "setuid", 23 }, | ||
407 | + { "setuid32", __PNR_setuid32 }, | ||
408 | + { "setxattr", 209 }, | ||
409 | + { "sgetmask", 68 }, | ||
410 | + { "shmat", __PNR_shmat }, | ||
411 | + { "shmctl", __PNR_shmctl }, | ||
412 | + { "shmdt", __PNR_shmdt }, | ||
413 | + { "shmget", __PNR_shmget }, | ||
414 | + { "shutdown", 338 }, | ||
415 | + { "sigaction", 67 }, | ||
416 | + { "sigaltstack", 185 }, | ||
417 | + { "signal", 48 }, | ||
418 | + { "signalfd", 305 }, | ||
419 | + { "signalfd4", 313 }, | ||
420 | + { "sigpending", 73 }, | ||
421 | + { "sigprocmask", 126 }, | ||
422 | + { "sigreturn", 119 }, | ||
423 | + { "sigsuspend", 72 }, | ||
424 | + { "socket", 326 }, | ||
425 | + { "socketcall", 102 }, | ||
426 | + { "socketpair", 333 }, | ||
427 | + { "splice", 283 }, | ||
428 | + { "spu_create", 279 }, | ||
429 | + { "spu_run", 278 }, | ||
430 | + { "ssetmask", 69 }, | ||
431 | + { "stat", 106 }, | ||
432 | + { "stat64", 195 }, | ||
433 | + { "statfs", 99 }, | ||
434 | + { "statfs64", 252 }, | ||
435 | + { "stime", 25 }, | ||
436 | + { "stty", 31 }, | ||
437 | + { "subpage_prot", 310 }, | ||
438 | + { "swapcontext", 249 }, | ||
439 | + { "swapoff", 115 }, | ||
440 | + { "swapon", 87 }, | ||
441 | + { "symlink", 83 }, | ||
442 | + { "symlinkat", 295 }, | ||
443 | + { "sync", 36 }, | ||
444 | + { "sync_file_range", __PNR_sync_file_range }, | ||
445 | + { "sync_file_range2", 308 }, | ||
446 | + { "syncfs", 348 }, | ||
447 | + { "syscall", __PNR_syscall }, | ||
448 | + { "sys_debug_setcontext", 256 }, | ||
449 | + { "sysfs", 135 }, | ||
450 | + { "sysinfo", 116 }, | ||
451 | + { "syslog", 103 }, | ||
452 | + { "sysmips", __PNR_sysmips }, | ||
453 | + { "tee", 284 }, | ||
454 | + { "tgkill", 250 }, | ||
455 | + { "time", 13 }, | ||
456 | + { "timer_create", 240 }, | ||
457 | + { "timer_delete", 244 }, | ||
458 | + { "timer_getoverrun", 243 }, | ||
459 | + { "timer_gettime", 242 }, | ||
460 | + { "timer_settime", 241 }, | ||
461 | + { "timerfd", __PNR_timerfd }, | ||
462 | + { "timerfd_create", 306 }, | ||
463 | + { "timerfd_gettime", 312 }, | ||
464 | + { "timerfd_settime", 311 }, | ||
465 | + { "times", 43 }, | ||
466 | + { "tkill", 208 }, | ||
467 | + { "truncate", 92 }, | ||
468 | + { "truncate64", 193 }, | ||
469 | + { "tuxcall", 225 }, | ||
470 | + { "ugetrlimit", 190 }, | ||
471 | + { "ulimit", 58 }, | ||
472 | + { "umask", 60 }, | ||
473 | + { "umount", 22 }, | ||
474 | + { "umount2", 52 }, | ||
475 | + { "uname", 122 }, | ||
476 | + { "unlink", 10 }, | ||
477 | + { "unlinkat", 292 }, | ||
478 | + { "unshare", 282 }, | ||
479 | + { "uselib", 86 }, | ||
480 | + { "ustat", 62 }, | ||
481 | + { "utime", 30 }, | ||
482 | + { "utimensat", 304 }, | ||
483 | + { "utimes", 251 }, | ||
484 | + { "vfork", 189 }, | ||
485 | + { "vhangup", 111 }, | ||
486 | + { "vm86", 113 }, | ||
487 | + { "vm86old", __PNR_vm86old }, | ||
488 | + { "vmsplice", 285 }, | ||
489 | + { "vserver", __PNR_vserver }, | ||
490 | + { "wait4", 114 }, | ||
491 | + { "waitid", 272 }, | ||
492 | + { "waitpid", 7 }, | ||
493 | + { "write", 4 }, | ||
494 | + { "writev", 146 }, | ||
495 | + { NULL, __NR_SCMP_ERROR }, | ||
496 | +}; | ||
497 | + | ||
498 | +/** | ||
499 | + * Resolve a syscall name to a number | ||
500 | + * @param name the syscall name | ||
501 | + * | ||
502 | + * Resolve the given syscall name to the syscall number using the syscall table. | ||
503 | + * Returns the syscall number on success, including negative pseudo syscall | ||
504 | + * numbers; returns __NR_SCMP_ERROR on failure. | ||
505 | + * | ||
506 | + */ | ||
507 | +int ppc_syscall_resolve_name(const char *name) | ||
508 | +{ | ||
509 | + unsigned int iter; | ||
510 | + const struct arch_syscall_def *table = ppc_syscall_table; | ||
511 | + | ||
512 | + /* XXX - plenty of room for future improvement here */ | ||
513 | + for (iter = 0; table[iter].name != NULL; iter++) { | ||
514 | + if (strcmp(name, table[iter].name) == 0) | ||
515 | + return table[iter].num; | ||
516 | + } | ||
517 | + | ||
518 | + return __NR_SCMP_ERROR; | ||
519 | +} | ||
520 | + | ||
521 | +/** | ||
522 | + * Resolve a syscall number to a name | ||
523 | + * @param num the syscall number | ||
524 | + * | ||
525 | + * Resolve the given syscall number to the syscall name using the syscall table. | ||
526 | + * Returns a pointer to the syscall name string on success, including pseudo | ||
527 | + * syscall names; returns NULL on failure. | ||
528 | + * | ||
529 | + */ | ||
530 | +const char *ppc_syscall_resolve_num(int num) | ||
531 | +{ | ||
532 | + unsigned int iter; | ||
533 | + const struct arch_syscall_def *table = ppc_syscall_table; | ||
534 | + | ||
535 | + /* XXX - plenty of room for future improvement here */ | ||
536 | + for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { | ||
537 | + if (num == table[iter].num) | ||
538 | + return table[iter].name; | ||
539 | + } | ||
540 | + | ||
541 | + return NULL; | ||
542 | +} | ||
543 | + | ||
544 | +/** | ||
545 | + * Iterate through the syscall table and return the syscall name | ||
546 | + * @param spot the offset into the syscall table | ||
547 | + * | ||
548 | + * Return the syscall name at position @spot or NULL on failure. This function | ||
549 | + * should only ever be used internally by libseccomp. | ||
550 | + * | ||
551 | + */ | ||
552 | +const char *ppc_syscall_iterate_name(unsigned int spot) | ||
553 | +{ | ||
554 | + /* XXX - no safety checks here */ | ||
555 | + return ppc_syscall_table[spot].name; | ||
556 | +} | ||
557 | diff --git a/src/arch-ppc.c b/src/arch-ppc.c | ||
558 | new file mode 100644 | ||
559 | index 0000000..56dbdb4 | ||
560 | --- /dev/null | ||
561 | +++ b/src/arch-ppc.c | ||
562 | @@ -0,0 +1,33 @@ | ||
563 | +/** | ||
564 | + * Enhanced Seccomp PPC Specific Code | ||
565 | + * | ||
566 | + * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com> | ||
567 | + * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
568 | + * | ||
569 | + */ | ||
570 | + | ||
571 | +/* | ||
572 | + * This library is free software; you can redistribute it and/or modify it | ||
573 | + * under the terms of version 2.1 of the GNU Lesser General Public License as | ||
574 | + * published by the Free Software Foundation. | ||
575 | + * | ||
576 | + * This library is distributed in the hope that it will be useful, but WITHOUT | ||
577 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
578 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | ||
579 | + * for more details. | ||
580 | + * | ||
581 | + * You should have received a copy of the GNU Lesser General Public License | ||
582 | + * along with this library; if not, see <http://www.gnu.org/licenses>. | ||
583 | + */ | ||
584 | + | ||
585 | +#include <linux/audit.h> | ||
586 | + | ||
587 | +#include "arch.h" | ||
588 | +#include "arch-ppc.h" | ||
589 | + | ||
590 | +const struct arch_def arch_def_ppc = { | ||
591 | + .token = SCMP_ARCH_PPC, | ||
592 | + .token_bpf = AUDIT_ARCH_PPC, | ||
593 | + .size = ARCH_SIZE_32, | ||
594 | + .endian = ARCH_ENDIAN_BIG, | ||
595 | +}; | ||
596 | diff --git a/src/arch-ppc.h b/src/arch-ppc.h | ||
597 | new file mode 100644 | ||
598 | index 0000000..627a168 | ||
599 | --- /dev/null | ||
600 | +++ b/src/arch-ppc.h | ||
601 | @@ -0,0 +1,38 @@ | ||
602 | +/** | ||
603 | + * Enhanced Seccomp PPC Specific Code | ||
604 | + * | ||
605 | + * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com> | ||
606 | + * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com> | ||
607 | + * | ||
608 | + */ | ||
609 | + | ||
610 | +/* | ||
611 | + * This library is free software; you can redistribute it and/or modify it | ||
612 | + * under the terms of version 2.1 of the GNU Lesser General Public License as | ||
613 | + * published by the Free Software Foundation. | ||
614 | + * | ||
615 | + * This library is distributed in the hope that it will be useful, but WITHOUT | ||
616 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
617 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | ||
618 | + * for more details. | ||
619 | + * | ||
620 | + * You should have received a copy of the GNU Lesser General Public License | ||
621 | + * along with this library; if not, see <http://www.gnu.org/licenses>. | ||
622 | + */ | ||
623 | + | ||
624 | +#ifndef _ARCH_PPC_H | ||
625 | +#define _ARCH_PPC_H | ||
626 | + | ||
627 | +#include <inttypes.h> | ||
628 | + | ||
629 | +#include "arch.h" | ||
630 | +#include "system.h" | ||
631 | + | ||
632 | +extern const struct arch_def arch_def_ppc; | ||
633 | + | ||
634 | +int ppc_syscall_resolve_name(const char *name); | ||
635 | +const char *ppc_syscall_resolve_num(int num); | ||
636 | + | ||
637 | +const char *ppc_syscall_iterate_name(unsigned int spot); | ||
638 | + | ||
639 | +#endif | ||
640 | diff --git a/src/arch-syscall-check.c b/src/arch-syscall-check.c | ||
641 | index a091a6d..8682483 100644 | ||
642 | --- a/src/arch-syscall-check.c | ||
643 | +++ b/src/arch-syscall-check.c | ||
644 | @@ -34,6 +34,7 @@ | ||
645 | #include "arch-mips64.h" | ||
646 | #include "arch-mips64n32.h" | ||
647 | #include "arch-ppc64.h" | ||
648 | +#include "arch-ppc.h" | ||
649 | |||
650 | /** | ||
651 | * compare the syscall values | ||
652 | @@ -69,6 +70,7 @@ int main(int argc, char *argv[]) | ||
653 | int i_mips64 = 0; | ||
654 | int i_mips64n32 = 0; | ||
655 | int i_ppc64 = 0; | ||
656 | + int i_ppc = 0; | ||
657 | const char *sys_name; | ||
658 | char str_miss[256]; | ||
659 | |||
660 | @@ -97,6 +99,8 @@ int main(int argc, char *argv[]) | ||
661 | mips64n32_syscall_iterate_name(i_mips64n32)); | ||
662 | syscall_check(str_miss, sys_name, "ppc64", | ||
663 | ppc64_syscall_iterate_name(i_ppc64)); | ||
664 | + syscall_check(str_miss, sys_name, "ppc", | ||
665 | + ppc_syscall_iterate_name(i_ppc)); | ||
666 | |||
667 | /* output the results */ | ||
668 | printf("%s: ", sys_name); | ||
669 | @@ -125,10 +129,12 @@ int main(int argc, char *argv[]) | ||
670 | i_mips64n32 = -1; | ||
671 | if (!ppc64_syscall_iterate_name(++i_ppc64)) | ||
672 | i_ppc64 = -1; | ||
673 | + if (!ppc_syscall_iterate_name(++i_ppc)) | ||
674 | + i_ppc = -1; | ||
675 | } while (i_x86_64 >= 0 && i_x32 >= 0 && | ||
676 | i_arm >= 0 && i_aarch64 >= 0 && | ||
677 | i_mips >= 0 && i_mips64 >= 0 && i_mips64n32 >= 0 && | ||
678 | - i_ppc64 >= 0); | ||
679 | + i_ppc64 >= 0 && i_ppc >= 0); | ||
680 | |||
681 | /* check for any leftovers */ | ||
682 | sys_name = x86_syscall_iterate_name(i_x86 + 1); | ||
683 | @@ -176,6 +182,11 @@ int main(int argc, char *argv[]) | ||
684 | ppc64_syscall_iterate_name(i_ppc64)); | ||
685 | return 1; | ||
686 | } | ||
687 | + if (i_ppc >= 0) { | ||
688 | + printf("%s: ERROR, ppc has additional syscalls\n", | ||
689 | + ppc_syscall_iterate_name(i_ppc)); | ||
690 | + return 1; | ||
691 | + } | ||
692 | |||
693 | /* if we made it here, all is good */ | ||
694 | return 0; | ||
695 | diff --git a/src/arch-syscall-dump.c b/src/arch-syscall-dump.c | ||
696 | index 985a250..62992e7 100644 | ||
697 | --- a/src/arch-syscall-dump.c | ||
698 | +++ b/src/arch-syscall-dump.c | ||
699 | @@ -39,6 +39,7 @@ | ||
700 | #include "arch-mips64n32.h" | ||
701 | #include "arch-aarch64.h" | ||
702 | #include "arch-ppc64.h" | ||
703 | +#include "arch-ppc.h" | ||
704 | |||
705 | /** | ||
706 | * Print the usage information to stderr and exit | ||
707 | @@ -116,6 +117,9 @@ int main(int argc, char *argv[]) | ||
708 | case SCMP_ARCH_PPC64: | ||
709 | sys_name = ppc64_syscall_iterate_name(iter); | ||
710 | break; | ||
711 | + case SCMP_ARCH_PPC: | ||
712 | + sys_name = ppc_syscall_iterate_name(iter); | ||
713 | + break; | ||
714 | |||
715 | default: | ||
716 | /* invalid arch */ | ||
717 | diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate | ||
718 | index e28b206..595dfef 100755 | ||
719 | --- a/src/arch-syscall-validate | ||
720 | +++ b/src/arch-syscall-validate | ||
721 | @@ -326,6 +326,29 @@ function dump_lib_ppc64() { | ||
722 | } | ||
723 | |||
724 | # | ||
725 | +# Dump the ppc system syscall table | ||
726 | +# | ||
727 | +# Arguments: | ||
728 | +# 1 path to the kernel source | ||
729 | +# | ||
730 | +# Dump the architecture's syscall table to stdout. | ||
731 | +# | ||
732 | +function dump_sys_ppc() { | ||
733 | + gcc -E -dM $1/arch/powerpc/include/uapi/asm/unistd.h | \ | ||
734 | + grep "^#define __NR_" | sort | \ | ||
735 | + sed -e 's/#define[ \t]\+__NR_\([a-z0-9_]\+\)[ \t]\+\([0-9]\+\)/\1\t\2/' | ||
736 | +} | ||
737 | + | ||
738 | +# | ||
739 | +# Dump the ppc library syscall table | ||
740 | +# | ||
741 | +# Dump the library's syscall table to stdout. | ||
742 | +# | ||
743 | +function dump_lib_ppc() { | ||
744 | + $LIB_SYS_DUMP -a ppc | sed -e '/[^\t]\+\t-[0-9]\+/d' | ||
745 | +} | ||
746 | + | ||
747 | +# | ||
748 | # Dump the system syscall table | ||
749 | # | ||
750 | # Arguments: | ||
751 | @@ -363,6 +386,9 @@ function dump_sys() { | ||
752 | ppc64) | ||
753 | dump_sys_ppc64 "$2" | ||
754 | ;; | ||
755 | + ppc) | ||
756 | + dump_sys_ppc "$2" | ||
757 | + ;; | ||
758 | *) | ||
759 | echo "" | ||
760 | ;; | ||
761 | @@ -406,6 +432,9 @@ function dump_lib() { | ||
762 | ppc64) | ||
763 | dump_lib_ppc64 "$2" | ||
764 | ;; | ||
765 | + ppc) | ||
766 | + dump_lib_ppc "$2" | ||
767 | + ;; | ||
768 | *) | ||
769 | echo "" | ||
770 | ;; | ||
771 | @@ -442,7 +471,7 @@ shift $(($OPTIND - 1)) | ||
772 | |||
773 | # defaults | ||
774 | if [[ $arches == "" ]]; then | ||
775 | - arches="x86 x86_64 x32 arm aarch64 mips mips64 mips64n32 ppc64" | ||
776 | + arches="x86 x86_64 x32 arm aarch64 mips mips64 mips64n32 ppc64 ppc" | ||
777 | fi | ||
778 | |||
779 | # sanity checks | ||
780 | -- | ||
781 | 2.3.5 | ||
782 | |||