aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-security/libseccomp/files/0008-arch-add-a-ppc-syscall-table.patch
blob: 30fa449ed026162944e2aa33a7939e9fba0a0eef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
From 25fc85ba58eba3980649e5bded51816a98cbefc0 Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Date: Wed, 11 Feb 2015 13:23:25 +0000
Subject: [PATCH 08/11] arch: add a ppc syscall table

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
[PM: slight reordering of ppc/ppc64 in header files and makefiles]
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
 include/seccomp.h.in      |   1 +
 src/Makefile.am           |   1 +
 src/arch-ppc-syscalls.c   | 504 ++++++++++++++++++++++++++++++++++++++++++++++
 src/arch-ppc.c            |  33 +++
 src/arch-ppc.h            |  38 ++++
 src/arch-syscall-check.c  |  13 +-
 src/arch-syscall-dump.c   |   4 +
 src/arch-syscall-validate |  31 ++-
 8 files changed, 623 insertions(+), 2 deletions(-)
 create mode 100644 src/arch-ppc-syscalls.c
 create mode 100644 src/arch-ppc.c
 create mode 100644 src/arch-ppc.h

diff --git a/include/seccomp.h.in b/include/seccomp.h.in
index 42f3f1a..3af4c2b 100644
--- a/include/seccomp.h.in
+++ b/include/seccomp.h.in
@@ -153,6 +153,7 @@ struct scmp_arg_cmp {
 /**
  * The PowerPC architecture tokens
  */
+#define SCMP_ARCH_PPC		AUDIT_ARCH_PPC
 #define SCMP_ARCH_PPC64		AUDIT_ARCH_PPC64
 #ifndef AUDIT_ARCH_PPC64LE
 #define AUDIT_ARCH_PPC64LE	(EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
diff --git a/src/Makefile.am b/src/Makefile.am
index 038b2ef..54f8478 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,6 +31,7 @@ SOURCES_ARCH = \
 	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-ppc.h arch-ppc.c arch-ppc-syscalls.c \
 	arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c
 
 SOURCES_GEN = \
diff --git a/src/arch-ppc-syscalls.c b/src/arch-ppc-syscalls.c
new file mode 100644
index 0000000..32fc05a
--- /dev/null
+++ b/src/arch-ppc-syscalls.c
@@ -0,0 +1,504 @@
+/**
+ * Enhanced Seccomp PPC Specific Code
+ *
+ * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com>
+ * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+ *
+ */
+
+/*
+ * 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 <http://www.gnu.org/licenses>.
+ */
+
+#include <string.h>
+
+#include <seccomp.h>
+
+#include "arch.h"
+#include "arch-ppc.h"
+
+/* NOTE: based on Linux 3.19 */
+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 },
+	{ "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_getres", 247 },
+	{ "clock_gettime", 246 },
+	{ "clock_nanosleep", 248 },
+	{ "clock_settime", 245 },
+	{ "clone", 120 },
+	{ "close", 6 },
+	{ "connect", 328 },
+	{ "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 },
+	{ "fsetxattr", 211 },
+	{ "fstat", 108 },
+	{ "fstat64", 197 },
+	{ "fstatat64", 291 },
+	{ "fstatfs", 100 },
+	{ "fstatfs64", 253 },
+	{ "fsync", 118 },
+	{ "ftime", 35 },
+	{ "ftruncate", 93 },
+	{ "ftruncate64", 194 },
+	{ "futex", 221 },
+	{ "futimesat", 290 },
+	{ "get_kernel_syms", 130 },
+	{ "get_mempolicy", 260 },
+	{ "get_robust_list", 299 },
+	{ "get_thread_area", __PNR_get_thread_area },
+	{ "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_setup", 227 },
+	{ "io_submit", 230 },
+	{ "ioctl", 54 },
+	{ "ioperm", 101 },
+	{ "iopl", 110 },
+	{ "ioprio_get", 274 },
+	{ "ioprio_set", 273 },
+	{ "ipc", 117 },
+	{ "kcmp", 354 },
+	{ "kexec_file_load", __PNR_kexec_file_load },
+	{ "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 },
+	{ "memfd_create", 360 },
+	{ "migrate_pages", 258 },
+	{ "mincore", 206 },
+	{ "mkdir", 39 },
+	{ "mkdirat", 287 },
+	{ "mknod", 14 },
+	{ "mknodat", 288 },
+	{ "mlock", 150 },
+	{ "mlockall", 152 },
+	{ "mmap", 90 },
+	{ "mmap2", 192 },
+	{ "modify_ldt", 123 },
+	{ "mount", 21 },
+	{ "move_pages", 301 },
+	{ "mprotect", 125 },
+	{ "mpx", 56 },
+	{ "mq_getsetattr", 267 },
+	{ "mq_notify", 266 },
+	{ "mq_open", 262 },
+	{ "mq_timedreceive", 265 },
+	{ "mq_timedsend", 264 },
+	{ "mq_unlink", 263 },
+	{ "mremap", 163 },
+	{ "msgctl", __PNR_msgctl },
+	{ "msgget", __PNR_msgget },
+	{ "msgrcv", __PNR_msgrcv },
+	{ "msgsnd", __PNR_msgsnd },
+	{ "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 },
+	{ "openat", 286 },
+	{ "pause", 29 },
+	{ "pciconfig_iobase", 200 },
+	{ "pciconfig_read", 198 },
+	{ "pciconfig_write", 199 },
+	{ "perf_event_open", 319 },
+	{ "personality", 136 },
+	{ "pipe", 42 },
+	{ "pipe2", 317 },
+	{ "pivot_root", 203 },
+	{ "poll", 167 },
+	{ "ppoll", 281 },
+	{ "prctl", 171 },
+	{ "pread64", 179 },
+	{ "preadv", 320 },
+	{ "prlimit64", 325 },
+	{ "process_vm_readv", 351 },
+	{ "process_vm_writev", 352 },
+	{ "prof", 44 },
+	{ "profil", 98 },
+	{ "pselect6", 280 },
+	{ "ptrace", 26 },
+	{ "putpmsg", 188 },
+	{ "pwrite64", 180 },
+	{ "pwritev", 321 },
+	{ "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 },
+	{ "recvmsg", 342 },
+	{ "remap_file_pages", 239 },
+	{ "removexattr", 218 },
+	{ "rename", 38 },
+	{ "renameat", 293 },
+	{ "renameat2", 357 },
+	{ "request_key", 270 },
+	{ "restart_syscall", 0 },
+	{ "rmdir", 40 },
+	{ "rt_sigaction", 173 },
+	{ "rt_sigpending", 175 },
+	{ "rt_sigprocmask", 174 },
+	{ "rt_sigqueueinfo", 177 },
+	{ "rt_sigreturn", 172 },
+	{ "rt_sigsuspend", 178 },
+	{ "rt_sigtimedwait", 176 },
+	{ "rt_tgsigqueueinfo", 322 },
+	{ "rtas", 255 },
+	{ "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_setaffinity", 222 },
+	{ "sched_setattr", 355 },
+	{ "sched_setparam", 154 },
+	{ "sched_setscheduler", 156 },
+	{ "sched_yield", 158 },
+	{ "seccomp", 358 },
+	{ "security", __PNR_security },
+	{ "select", 82 },
+	{ "semctl", __PNR_semctl },
+	{ "semget", __PNR_semget },
+	{ "semop", __PNR_semop },
+	{ "semtimedop", __PNR_semtimedop },
+	{ "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 },
+	{ "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", __PNR_shmat },
+	{ "shmctl", __PNR_shmctl },
+	{ "shmdt", __PNR_shmdt },
+	{ "shmget", __PNR_shmget },
+	{ "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 },
+	{ "stime", 25 },
+	{ "stty", 31 },
+	{ "subpage_prot", 310 },
+	{ "swapcontext", 249 },
+	{ "swapoff", 115 },
+	{ "swapon", 87 },
+	{ "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_settime", 241 },
+	{ "timerfd", __PNR_timerfd },
+	{ "timerfd_create", 306 },
+	{ "timerfd_gettime", 312 },
+	{ "timerfd_settime", 311 },
+	{ "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 },
+	{ "ustat", 62 },
+	{ "utime", 30 },
+	{ "utimensat", 304 },
+	{ "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 name
+ * @param spot the offset into the syscall table
+ *
+ * Return the syscall name at position @spot or NULL on failure.  This function
+ * should only ever be used internally by libseccomp.
+ *
+ */
+const char *ppc_syscall_iterate_name(unsigned int spot)
+{
+	/* XXX - no safety checks here */
+	return ppc_syscall_table[spot].name;
+}
diff --git a/src/arch-ppc.c b/src/arch-ppc.c
new file mode 100644
index 0000000..56dbdb4
--- /dev/null
+++ b/src/arch-ppc.c
@@ -0,0 +1,33 @@
+/**
+ * Enhanced Seccomp PPC Specific Code
+ *
+ * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com>
+ * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+ *
+ */
+
+/*
+ * 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 <http://www.gnu.org/licenses>.
+ */
+
+#include <linux/audit.h>
+
+#include "arch.h"
+#include "arch-ppc.h"
+
+const struct arch_def arch_def_ppc = {
+	.token = SCMP_ARCH_PPC,
+	.token_bpf = AUDIT_ARCH_PPC,
+	.size = ARCH_SIZE_32,
+	.endian = ARCH_ENDIAN_BIG,
+};
diff --git a/src/arch-ppc.h b/src/arch-ppc.h
new file mode 100644
index 0000000..627a168
--- /dev/null
+++ b/src/arch-ppc.h
@@ -0,0 +1,38 @@
+/**
+ * Enhanced Seccomp PPC Specific Code
+ *
+ * Copyright (c) 2015 Freescale <bogdan.purcareata@freescale.com>
+ * Author: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+ *
+ */
+
+/*
+ * 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 <http://www.gnu.org/licenses>.
+ */
+
+#ifndef _ARCH_PPC_H
+#define _ARCH_PPC_H
+
+#include <inttypes.h>
+
+#include "arch.h"
+#include "system.h"
+
+extern const struct arch_def arch_def_ppc;
+
+int ppc_syscall_resolve_name(const char *name);
+const char *ppc_syscall_resolve_num(int num);
+
+const char *ppc_syscall_iterate_name(unsigned int spot);
+
+#endif
diff --git a/src/arch-syscall-check.c b/src/arch-syscall-check.c
index a091a6d..8682483 100644
--- a/src/arch-syscall-check.c
+++ b/src/arch-syscall-check.c
@@ -34,6 +34,7 @@
 #include "arch-mips64.h"
 #include "arch-mips64n32.h"
 #include "arch-ppc64.h"
+#include "arch-ppc.h"
 
 /**
  * compare the syscall values
@@ -69,6 +70,7 @@ int main(int argc, char *argv[])
 	int i_mips64 = 0;
 	int i_mips64n32 = 0;
 	int i_ppc64 = 0;
+	int i_ppc = 0;
 	const char *sys_name;
 	char str_miss[256];
 
@@ -97,6 +99,8 @@ int main(int argc, char *argv[])
 			      mips64n32_syscall_iterate_name(i_mips64n32));
 		syscall_check(str_miss, sys_name, "ppc64",
 			      ppc64_syscall_iterate_name(i_ppc64));
+		syscall_check(str_miss, sys_name, "ppc",
+			      ppc_syscall_iterate_name(i_ppc));
 
 		/* output the results */
 		printf("%s: ", sys_name);
@@ -125,10 +129,12 @@ int main(int argc, char *argv[])
 			i_mips64n32 = -1;
 		if (!ppc64_syscall_iterate_name(++i_ppc64))
 			i_ppc64 = -1;
+		if (!ppc_syscall_iterate_name(++i_ppc))
+			i_ppc = -1;
 	} while (i_x86_64 >= 0 && i_x32 >= 0 &&
 		 i_arm >= 0 && i_aarch64 >= 0 &&
 		 i_mips >= 0 && i_mips64 >= 0 && i_mips64n32 >= 0 &&
-		 i_ppc64 >= 0);
+		 i_ppc64 >= 0 && i_ppc >= 0);
 
 	/* check for any leftovers */
 	sys_name = x86_syscall_iterate_name(i_x86 + 1);
@@ -176,6 +182,11 @@ int main(int argc, char *argv[])
 		       ppc64_syscall_iterate_name(i_ppc64));
 		return 1;
 	}
+	if (i_ppc >= 0) {
+		printf("%s: ERROR, ppc has additional syscalls\n",
+		       ppc_syscall_iterate_name(i_ppc));
+		return 1;
+	}
 
 	/* if we made it here, all is good */
 	return 0;
diff --git a/src/arch-syscall-dump.c b/src/arch-syscall-dump.c
index 985a250..62992e7 100644
--- a/src/arch-syscall-dump.c
+++ b/src/arch-syscall-dump.c
@@ -39,6 +39,7 @@
 #include "arch-mips64n32.h"
 #include "arch-aarch64.h"
 #include "arch-ppc64.h"
+#include "arch-ppc.h"
 
 /**
  * Print the usage information to stderr and exit
@@ -116,6 +117,9 @@ int main(int argc, char *argv[])
 		case SCMP_ARCH_PPC64:
 			sys_name = ppc64_syscall_iterate_name(iter);
 			break;
+		case SCMP_ARCH_PPC:
+			sys_name = ppc_syscall_iterate_name(iter);
+			break;
 
 		default:
 			/* invalid arch */
diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate
index e28b206..595dfef 100755
--- a/src/arch-syscall-validate
+++ b/src/arch-syscall-validate
@@ -326,6 +326,29 @@ function dump_lib_ppc64() {
 }
 
 #
+# Dump the ppc system syscall table
+#
+# Arguments:
+#     1    path to the kernel source
+#
+#  Dump the architecture's syscall table to stdout.
+#
+function dump_sys_ppc() {
+	gcc -E -dM $1/arch/powerpc/include/uapi/asm/unistd.h | \
+		grep "^#define __NR_" | sort | \
+		sed -e 's/#define[ \t]\+__NR_\([a-z0-9_]\+\)[ \t]\+\([0-9]\+\)/\1\t\2/'
+}
+
+#
+# Dump the ppc library syscall table
+#
+#  Dump the library's syscall table to stdout.
+#
+function dump_lib_ppc() {
+	$LIB_SYS_DUMP -a ppc | sed -e '/[^\t]\+\t-[0-9]\+/d'
+}
+
+#
 # Dump the system syscall table
 #
 # Arguments:
@@ -363,6 +386,9 @@ function dump_sys() {
 	ppc64)
 		dump_sys_ppc64 "$2"
 		;;
+	ppc)
+		dump_sys_ppc "$2"
+		;;
 	*)
 		echo ""
 		;;
@@ -406,6 +432,9 @@ function dump_lib() {
 	ppc64)
 		dump_lib_ppc64 "$2"
 		;;
+	ppc)
+		dump_lib_ppc "$2"
+		;;
 	*)
 		echo ""
 		;;
@@ -442,7 +471,7 @@ shift $(($OPTIND - 1))
 
 # defaults
 if [[ $arches == "" ]]; then
-	arches="x86 x86_64 x32 arm aarch64 mips mips64 mips64n32 ppc64"
+	arches="x86 x86_64 x32 arm aarch64 mips mips64 mips64n32 ppc64 ppc"
 fi
 
 # sanity checks
-- 
2.3.5