diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-02-14 21:17:49 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-02-14 21:17:49 +0100 |
commit | af72fb4887329aec950d513572e7f762401a118d (patch) | |
tree | 16d7e1200280e31c1aefc8a56e969d5750c87dc7 | |
parent | 49df3bdb016f77abc7da995340e19c273b8321db (diff) |
now at libpipeline
-rw-r--r-- | src/stage1/patches/libseccomp.patch | 1094 |
1 files changed, 1094 insertions, 0 deletions
diff --git a/src/stage1/patches/libseccomp.patch b/src/stage1/patches/libseccomp.patch new file mode 100644 index 0000000..a1f6984 --- /dev/null +++ b/src/stage1/patches/libseccomp.patch @@ -0,0 +1,1094 @@ +diff -rupN a/arch-riscv64.c b/arch-riscv64.c +--- a/arch-riscv64.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch-riscv64.c 2018-02-14 20:59:39.255035169 +0100 +@@ -0,0 +1,36 @@ ++/** ++ * riscv64 Syscall Table ++ * ++ * Copyright (C) 2016 Red Hat Inc. ++ * Author: Richard W.M. Jones <rjones@redhat.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 <stdlib.h> ++#include <errno.h> ++#include <linux/audit.h> ++ ++#include "arch.h" ++#include "arch-riscv64.h" ++ ++const struct arch_def arch_def_riscv64 = { ++ .token = SCMP_ARCH_RISCV64, ++ .token_bpf = AUDIT_ARCH_RISCV64, ++ .size = ARCH_SIZE_64, ++ .endian = ARCH_ENDIAN_LITTLE, ++ .syscall_resolve_name = riscv64_syscall_resolve_name, ++ .syscall_resolve_num = riscv64_syscall_resolve_num, ++ .syscall_rewrite = NULL, ++ .rule_add = NULL, ++}; +diff -rupN a/arch-riscv64.h b/arch-riscv64.h +--- a/arch-riscv64.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch-riscv64.h 2018-02-14 21:00:10.318752719 +0100 +@@ -0,0 +1,34 @@ ++/** ++ * riscv64 Syscall Table ++ * ++ * Copyright (C) 2016 Red Hat Inc. ++ * Author: Richard W.M. Jones <rjones@redhat.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_RISCV64_H ++#define _ARCH_RISCV64_H ++ ++#include <inttypes.h> ++ ++#include "arch.h" ++#include "system.h" ++ ++extern const struct arch_def arch_def_riscv64; ++ ++int riscv64_syscall_resolve_name(const char *name); ++const char *riscv64_syscall_resolve_num(int num); ++ ++const struct arch_syscall_def *riscv64_syscall_iterate(unsigned int spot); ++#endif +diff -rupN a/arch-riscv64-syscalls.c b/arch-riscv64-syscalls.c +--- a/arch-riscv64-syscalls.c 1970-01-01 01:00:00.000000000 +0100 ++++ b/arch-riscv64-syscalls.c 2018-02-14 20:59:14.404727806 +0100 +@@ -0,0 +1,517 @@ ++/** ++ * riscv64 Syscall Table ++ * ++ * Copyright (C) 2016 Red Hat Inc. ++ * Author: Richard W.M. Jones <rjones@redhat.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-riscv64.h" ++ ++/* Based on Linux 4.1 */ ++const struct arch_syscall_def riscv64_syscall_table[] = { \ ++ { "_llseek", __PNR__llseek }, ++ { "_newselect", __PNR__newselect }, ++ { "_sysctl", __PNR__sysctl }, ++ { "accept", 202 }, ++ { "accept4", 242 }, ++ { "access", __PNR_access }, ++ { "acct", 89 }, ++ { "add_key", 217 }, ++ { "adjtimex", 171 }, ++ { "afs_syscall", __PNR_afs_syscall }, ++ { "alarm", __PNR_alarm }, ++ { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, ++ { "arm_sync_file_range", __PNR_arm_sync_file_range }, ++ { "arch_prctl", __PNR_arch_prctl }, ++ { "bdflush", __PNR_bdflush }, ++ { "bind", 200 }, ++ { "bpf", 280 }, ++ { "break", __PNR_break }, ++ { "breakpoint", __PNR_breakpoint }, ++ { "brk", 214 }, ++ { "cachectl", __PNR_cachectl }, ++ { "cacheflush", __PNR_cacheflush }, ++ { "capget", 90 }, ++ { "capset", 91 }, ++ { "chdir", 49 }, ++ { "chmod", __PNR_chmod }, ++ { "chown", __PNR_chown }, ++ { "chown32", __PNR_chown32 }, ++ { "chroot", 51 }, ++ { "clock_adjtime", 266 }, ++ { "clock_getres", 114 }, ++ { "clock_gettime", 113 }, ++ { "clock_nanosleep", 115 }, ++ { "clock_settime", 112 }, ++ { "clone", 220 }, ++ { "close", 57 }, ++ { "connect", 203 }, ++ { "copy_file_range", 285 }, ++ { "creat", __PNR_creat }, ++ { "create_module", __PNR_create_module }, ++ { "delete_module", 106 }, ++ { "dup", 23 }, ++ { "dup2", __PNR_dup2 }, ++ { "dup3", 24 }, ++ { "epoll_create", __PNR_epoll_create }, ++ { "epoll_create1", 20 }, ++ { "epoll_ctl", 21 }, ++ { "epoll_ctl_old", __PNR_epoll_ctl_old }, ++ { "epoll_pwait", 22 }, ++ { "epoll_wait", __PNR_epoll_wait }, ++ { "epoll_wait_old", __PNR_epoll_wait_old }, ++ { "eventfd", __PNR_eventfd }, ++ { "eventfd2", 19 }, ++ { "execve", 221 }, ++ { "execveat", 281 }, ++ { "exit", 93 }, ++ { "exit_group", 94 }, ++ { "faccessat", 48 }, ++ { "fadvise64", 223 }, ++ { "fadvise64_64", __PNR_fadvise64_64 }, ++ { "fallocate", 47 }, ++ { "fanotify_init", 262 }, ++ { "fanotify_mark", 263 }, ++ { "fchdir", 50 }, ++ { "fchmod", 52 }, ++ { "fchmodat", 53 }, ++ { "fchown", 55 }, ++ { "fchown32", __PNR_fchown32 }, ++ { "fchownat", 54 }, ++ { "fcntl", 25 }, ++ { "fcntl64", __PNR_fcntl64 }, ++ { "fdatasync", 83 }, ++ { "fgetxattr", 10 }, ++ { "finit_module", 273 }, ++ { "flistxattr", 13 }, ++ { "flock", 32 }, ++ { "fork", __PNR_fork }, ++ { "fremovexattr", 16 }, ++ { "fsetxattr", 7 }, ++ { "fstat", 80 }, ++ { "fstat64", __PNR_fstat64 }, ++ { "fstatat64", __PNR_fstatat64 }, ++ { "fstatfs", 44 }, ++ { "fstatfs64", __PNR_fstatfs64 }, ++ { "fsync", 82 }, ++ { "ftime", __PNR_ftime }, ++ { "ftruncate", 46 }, ++ { "ftruncate64", __PNR_ftruncate64 }, ++ { "futex", 98 }, ++ { "futimesat", __PNR_futimesat }, ++ { "get_kernel_syms", __PNR_get_kernel_syms }, ++ { "get_mempolicy", 236 }, ++ { "get_robust_list", 100 }, ++ { "get_thread_area", __PNR_get_thread_area }, ++ { "getcpu", 168 }, ++ { "getcwd", 17 }, ++ { "getdents", __PNR_getdents }, ++ { "getdents64", 61 }, ++ { "getegid", 177 }, ++ { "getegid32", __PNR_getegid32 }, ++ { "geteuid", 175 }, ++ { "geteuid32", __PNR_geteuid32 }, ++ { "getgid", 176 }, ++ { "getgid32", __PNR_getgid32 }, ++ { "getgroups", 158 }, ++ { "getgroups32", __PNR_getgroups32 }, ++ { "getitimer", 102 }, ++ { "getpeername", 205 }, ++ { "getpgid", 155 }, ++ { "getpgrp", __PNR_getpgrp }, ++ { "getpid", 172 }, ++ { "getpmsg", __PNR_getpmsg }, ++ { "getppid", 173 }, ++ { "getpriority", 141 }, ++ { "getrandom", 278 }, ++ { "getresgid", 150 }, ++ { "getresgid32", __PNR_getresgid32 }, ++ { "getresuid", 148 }, ++ { "getresuid32", __PNR_getresuid32 }, ++ { "getrlimit", 163 }, ++ { "getrusage", 165 }, ++ { "getsid", 156 }, ++ { "getsockname", 204 }, ++ { "getsockopt", 209 }, ++ { "gettid", 178 }, ++ { "gettimeofday", 169 }, ++ { "getuid", 174 }, ++ { "getuid32", __PNR_getuid32 }, ++ { "getxattr", 8 }, ++ { "gtty", __PNR_gtty }, ++ { "idle", __PNR_idle }, ++ { "init_module", 105 }, ++ { "inotify_add_watch", 27 }, ++ { "inotify_init", __PNR_inotify_init }, ++ { "inotify_init1", 26 }, ++ { "inotify_rm_watch", 28 }, ++ { "io_cancel", 3 }, ++ { "io_destroy", 1 }, ++ { "io_getevents", 4 }, ++ { "io_setup", 0 }, ++ { "io_submit", 2 }, ++ { "ioctl", 29 }, ++ { "ioperm", __PNR_ioperm }, ++ { "iopl", __PNR_iopl }, ++ { "ioprio_get", 31 }, ++ { "ioprio_set", 30 }, ++ { "ipc", __PNR_ipc }, ++ { "kcmp", 272 }, ++ { "kexec_file_load", __PNR_kexec_file_load }, ++ { "kexec_load", 104 }, ++ { "keyctl", 219 }, ++ { "kill", 129 }, ++ { "lchown", __PNR_lchown }, ++ { "lchown32", __PNR_lchown32 }, ++ { "lgetxattr", 9 }, ++ { "link", __PNR_link }, ++ { "linkat", 37 }, ++ { "listen", 201 }, ++ { "listxattr", 11 }, ++ { "llistxattr", 12 }, ++ { "lock", __PNR_lock }, ++ { "lookup_dcookie", 18 }, ++ { "lremovexattr", 15 }, ++ { "lseek", 62 }, ++ { "lsetxattr", 6 }, ++ { "lstat", __PNR_lstat }, ++ { "lstat64", __PNR_lstat64 }, ++ { "madvise", 233 }, ++ { "mbind", 235 }, ++ { "membarrier", 283 }, ++ { "memfd_create", 279 }, ++ { "migrate_pages", 238 }, ++ { "mincore", 232 }, ++ { "mkdir", __PNR_mkdir }, ++ { "mkdirat", 34 }, ++ { "mknod", __PNR_mknod }, ++ { "mknodat", 33 }, ++ { "mlock", 228 }, ++ { "mlock2", 284 }, ++ { "mlockall", 230 }, ++ { "mmap", 222 }, ++ { "mmap2", __PNR_mmap2 }, ++ { "modify_ldt", __PNR_modify_ldt }, ++ { "mount", 40 }, ++ { "move_pages", 239 }, ++ { "mprotect", 226 }, ++ { "mpx", __PNR_mpx }, ++ { "mq_getsetattr", 185 }, ++ { "mq_notify", 184 }, ++ { "mq_open", 180 }, ++ { "mq_timedreceive", 183 }, ++ { "mq_timedsend", 182 }, ++ { "mq_unlink", 181 }, ++ { "mremap", 216 }, ++ { "msgctl", 187 }, ++ { "msgget", 186 }, ++ { "msgrcv", 188 }, ++ { "msgsnd", 189 }, ++ { "msync", 227 }, ++ { "multiplexer", __PNR_multiplexer }, ++ { "munlock", 229 }, ++ { "munlockall", 231 }, ++ { "munmap", 215 }, ++ { "name_to_handle_at", 264 }, ++ { "nanosleep", 101 }, ++ { "newfstatat", 79 }, ++ { "nfsservctl", 42 }, ++ { "nice", __PNR_nice }, ++ { "oldfstat", __PNR_oldfstat }, ++ { "oldlstat", __PNR_oldlstat }, ++ { "oldolduname", __PNR_oldolduname }, ++ { "oldstat", __PNR_oldstat }, ++ { "olduname", __PNR_olduname }, ++ { "oldwait4", __PNR_oldwait4 }, ++ { "open", __PNR_open }, ++ { "open_by_handle_at", 265 }, ++ { "openat", 56 }, ++ { "pause", __PNR_pause }, ++ { "pciconfig_iobase", __PNR_pciconfig_iobase }, ++ { "pciconfig_read", __PNR_pciconfig_read }, ++ { "pciconfig_write", __PNR_pciconfig_write }, ++ { "perf_event_open", 241 }, ++ { "personality", 92 }, ++ { "pipe", __PNR_pipe }, ++ { "pipe2", 59 }, ++ { "pivot_root", 41 }, ++ { "poll", __PNR_poll }, ++ { "ppoll", 73 }, ++ { "prctl", 167 }, ++ { "pread64", 67 }, ++ { "preadv", 69 }, ++ { "preadv2", 286 }, ++ { "prlimit64", 261 }, ++ { "process_vm_readv", 270 }, ++ { "process_vm_writev", 271 }, ++ { "prof", __PNR_prof }, ++ { "profil", __PNR_profil }, ++ { "pselect6", 72 }, ++ { "ptrace", 117 }, ++ { "putpmsg", __PNR_putpmsg }, ++ { "pwrite64", 68 }, ++ { "pwritev", 70 }, ++ { "pwritev2", 287 }, ++ { "query_module", __PNR_query_module }, ++ { "quotactl", 60 }, ++ { "read", 63 }, ++ { "readahead", 213 }, ++ { "readdir", __PNR_readdir }, ++ { "readlink", __PNR_readlink }, ++ { "readlinkat", 78 }, ++ { "readv", 65 }, ++ { "reboot", 142 }, ++ { "recv", __PNR_recv }, ++ { "recvfrom", 207 }, ++ { "recvmmsg", 243 }, ++ { "recvmsg", 212 }, ++ { "remap_file_pages", 234 }, ++ { "removexattr", 14 }, ++ { "rename", __PNR_rename }, ++ { "renameat", 38 }, ++ { "renameat2", 276 }, ++ { "request_key", 218 }, ++ { "restart_syscall", 128 }, ++ { "rmdir", __PNR_rmdir }, ++ { "rt_sigaction", 134 }, ++ { "rt_sigpending", 136 }, ++ { "rt_sigprocmask", 135 }, ++ { "rt_sigqueueinfo", 138 }, ++ { "rt_sigreturn", 139 }, ++ { "rt_sigsuspend", 133 }, ++ { "rt_sigtimedwait", 137 }, ++ { "rt_tgsigqueueinfo", 240 }, ++ { "rtas", __PNR_rtas }, ++ { "s390_pci_mmio_read", __PNR_s390_pci_mmio_read }, ++ { "s390_pci_mmio_write", __PNR_s390_pci_mmio_write }, ++ { "s390_runtime_instr", __PNR_s390_runtime_instr }, ++ { "sched_get_priority_max", 125 }, ++ { "sched_get_priority_min", 126 }, ++ { "sched_getaffinity", 123 }, ++ { "sched_getattr", 275 }, ++ { "sched_getparam", 121 }, ++ { "sched_getscheduler", 120 }, ++ { "sched_rr_get_interval", 127 }, ++ { "sched_setaffinity", 122 }, ++ { "sched_setattr", 274 }, ++ { "sched_setparam", 118 }, ++ { "sched_setscheduler", 119 }, ++ { "sched_yield", 124 }, ++ { "seccomp", 277 }, ++ { "security", __PNR_security }, ++ { "select", __PNR_select }, ++ { "semctl", 191 }, ++ { "semget", 190 }, ++ { "semop", 193 }, ++ { "semtimedop", 192 }, ++ { "send", __PNR_send }, ++ { "sendfile", 71 }, ++ { "sendfile64", __PNR_sendfile64 }, ++ { "sendmmsg", 269 }, ++ { "sendmsg", 211 }, ++ { "sendto", 206 }, ++ { "set_mempolicy", 237 }, ++ { "set_robust_list", 99 }, ++ { "set_thread_area", __PNR_set_thread_area }, ++ { "set_tid_address", 96 }, ++ { "set_tls", __PNR_set_tls }, ++ { "setdomainname", 162 }, ++ { "setfsgid", 152 }, ++ { "setfsgid32", __PNR_setfsgid32 }, ++ { "setfsuid", 151 }, ++ { "setfsuid32", __PNR_setfsuid32 }, ++ { "setgid", 144 }, ++ { "setgid32", __PNR_setgid32 }, ++ { "setgroups", 159 }, ++ { "setgroups32", __PNR_setgroups32 }, ++ { "sethostname", 161 }, ++ { "setitimer", 103 }, ++ { "setns", 268 }, ++ { "setpgid", 154 }, ++ { "setpriority", 140 }, ++ { "setregid", 143 }, ++ { "setregid32", __PNR_setregid32 }, ++ { "setresgid", 149 }, ++ { "setresgid32", __PNR_setresgid32 }, ++ { "setresuid", 147 }, ++ { "setresuid32", __PNR_setresuid32 }, ++ { "setreuid", 145 }, ++ { "setreuid32", __PNR_setreuid32 }, ++ { "setrlimit", 164 }, ++ { "setsid", 157 }, ++ { "setsockopt", 208 }, ++ { "settimeofday", 170 }, ++ { "setuid", 146 }, ++ { "setuid32", __PNR_setuid32 }, ++ { "setxattr", 5 }, ++ { "sgetmask", __PNR_sgetmask }, ++ { "shmat", 196 }, ++ { "shmctl", 195 }, ++ { "shmdt", 197 }, ++ { "shmget", 194 }, ++ { "shutdown", 210 }, ++ { "sigaction", __PNR_sigaction }, ++ { "sigaltstack", 132 }, ++ { "signal", __PNR_signal }, ++ { "signalfd", __PNR_signalfd }, ++ { "signalfd4", 74 }, ++ { "sigpending", __PNR_sigpending }, ++ { "sigprocmask", __PNR_sigprocmask }, ++ { "sigreturn", __PNR_sigreturn }, ++ { "sigsuspend", __PNR_sigsuspend }, ++ { "socket", 198 }, ++ { "socketcall", __PNR_socketcall }, ++ { "socketpair", 199 }, ++ { "splice", 76 }, ++ { "spu_create", __PNR_spu_create }, ++ { "spu_run", __PNR_spu_run }, ++ { "ssetmask", __PNR_ssetmask }, ++ { "stat", __PNR_stat }, ++ { "stat64", __PNR_stat64 }, ++ { "statfs", 43 }, ++ { "statfs64", __PNR_statfs64 }, ++ { "stime", __PNR_stime }, ++ { "stty", __PNR_stty }, ++ { "subpage_prot", __PNR_subpage_prot }, ++ { "swapcontext", __PNR_swapcontext }, ++ { "swapoff", 225 }, ++ { "swapon", 224 }, ++ { "switch_endian", __PNR_switch_endian }, ++ { "symlink", __PNR_symlink }, ++ { "symlinkat", 36 }, ++ { "sync", 81 }, ++ { "sync_file_range", 84 }, ++ { "sync_file_range2", __PNR_sync_file_range2 }, ++ { "syncfs", 267 }, ++ { "syscall", __PNR_syscall }, ++ { "sys_debug_setcontext", __PNR_sys_debug_setcontext }, ++ { "sysfs", __PNR_sysfs }, ++ { "sysinfo", 179 }, ++ { "syslog", 116 }, ++ { "sysmips", __PNR_sysmips }, ++ { "tee", 77 }, ++ { "tgkill", 131 }, ++ { "time", __PNR_time }, ++ { "timer_create", 107 }, ++ { "timer_delete", 111 }, ++ { "timer_getoverrun", 109 }, ++ { "timer_gettime", 108 }, ++ { "timer_settime", 110 }, ++ { "timerfd", __PNR_timerfd }, ++ { "timerfd_create", 85 }, ++ { "timerfd_gettime", 87 }, ++ { "timerfd_settime", 86 }, ++ { "times", 153 }, ++ { "tkill", 130 }, ++ { "truncate", 45 }, ++ { "truncate64", __PNR_truncate64 }, ++ { "tuxcall", __PNR_tuxcall }, ++ { "ugetrlimit", __PNR_ugetrlimit }, ++ { "ulimit", __PNR_ulimit }, ++ { "umask", 166 }, ++ { "umount", __PNR_umount }, ++ { "umount2", 39 }, ++ { "uname", 160 }, ++ { "unlink", __PNR_unlink }, ++ { "unlinkat", 35 }, ++ { "unshare", 97 }, ++ { "uselib", __PNR_uselib }, ++ { "userfaultfd", 282 }, ++ { "usr26", __PNR_usr26 }, ++ { "usr32", __PNR_usr32 }, ++ { "ustat", __PNR_ustat }, ++ { "utime", __PNR_utime }, ++ { "utimensat", 88 }, ++ { "utimes", __PNR_utimes }, ++ { "vfork", __PNR_vfork }, ++ { "vhangup", 58 }, ++ { "vm86", __PNR_vm86 }, ++ { "vm86old", __PNR_vm86old }, ++ { "vmsplice", 75 }, ++ { "vserver", __PNR_vserver }, ++ { "wait4", 260 }, ++ { "waitid", 95 }, ++ { "waitpid", __PNR_waitpid }, ++ { "write", 64 }, ++ { "writev", 66 }, ++ ++ { NULL, __NR_SCMP_ERROR }, ++}; ++ ++/** ++ * Resolve a syscall name to a number ++ * @param name the syscall name ++ * ++ * Resolve the given syscall name to the syscall number using the syscall table. ++ * Returns the syscall number on success, including negative pseudo syscall ++ * numbers; returns __NR_SCMP_ERROR on failure. ++ * ++ */ ++int riscv64_syscall_resolve_name(const char *name) ++{ ++ unsigned int iter; ++ const struct arch_syscall_def *table = riscv64_syscall_table; ++ ++ /* XXX - plenty of room for future improvement here */ ++ for (iter = 0; table[iter].name != NULL; iter++) { ++ if (strcmp(name, table[iter].name) == 0) ++ return table[iter].num; ++ } ++ ++ return __NR_SCMP_ERROR; ++} ++ ++/** ++ * Resolve a syscall number to a name ++ * @param num the syscall number ++ * ++ * Resolve the given syscall number to the syscall name using the syscall table. ++ * Returns a pointer to the syscall name string on success, including pseudo ++ * syscall names; returns NULL on failure. ++ * ++ */ ++const char *riscv64_syscall_resolve_num(int num) ++{ ++ unsigned int iter; ++ const struct arch_syscall_def *table = riscv64_syscall_table; ++ ++ /* XXX - plenty of room for future improvement here */ ++ for (iter = 0; table[iter].num != __NR_SCMP_ERROR; iter++) { ++ if (num == table[iter].num) ++ return table[iter].name; ++ } ++ ++ return NULL; ++} ++ ++ ++/** ++ * Iterate through the syscall table and return the syscall 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 struct arch_syscall_def *riscv64_syscall_iterate(unsigned int spot) ++{ ++ /* XXX - no safety checks here */ ++ return &riscv64_syscall_table[spot]; ++} +diff -rupN a/PKGBUILD b/PKGBUILD +--- a/PKGBUILD 2018-02-14 21:03:51.000000000 +0100 ++++ b/PKGBUILD 2018-02-14 21:10:38.666524551 +0100 +@@ -11,9 +11,15 @@ url="https://github.com/seccomp/libsecco + depends=('glibc') + validpgpkeys=('7100AADFAE6E6E940D2E0AD655E45A5AE8CA7C8A') # Paul Moore <paul@paul-moore.com> + source=("https://github.com/seccomp/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz"{,.asc} ++ "riscv64.patch" ++ "arch-riscv64"{.c,.h,-syscalls.c} + '0001-arch-add-the-statx-syscall.patch') + sha256sums=('3ddc8c037956c0a5ac19664ece4194743f59e1ccd4adde848f4f0dae7f77bca1' + 'SKIP' ++ 'debd7d4e89711709b65bfdd9c2f6513f3d16789fe3c359297258d10313684fa0' ++ '85557980ebea8f3f2480e9ef426637317883331641422ed763f3d4bd3c80e745' ++ '14e2e30edc69e4c2fea339ec510ea867189042c7b2f4e43c523d96e74dbe72b7' ++ '7aad9fb6057e571ed8a6a828684ae4f29397f27172cfebcb3632a08337d42a64' + '190c6dd821ddad9ee0aefa720a86dd744acd279c095b07f099a7e0e72d1ce543') + + prepare() { +@@ -21,11 +27,16 @@ prepare() { + + # arch: add the statx syscall + patch -Np1 < "${srcdir}"/0001-arch-add-the-statx-syscall.patch ++ ++ # add riscv64 support ++ patch -Np1 < "${srcdir}"/riscv64.patch ++ cp "$srcdir"/arch-riscv64{.c,.h,-syscalls.c} src/ + } + + build() { + cd $pkgname-$pkgver +- ./configure --prefix=/usr ++ autoreconf ++ ./configure --host=@TARGET@ --prefix=/usr CFLAGS="-D__riscv64=1 $CFLAGS" + make + } + +diff -rupN a/riscv64.patch b/riscv64.patch +--- a/riscv64.patch 1970-01-01 01:00:00.000000000 +0100 ++++ b/riscv64.patch 2018-02-14 20:58:10.290601468 +0100 +@@ -0,0 +1,454 @@ ++diff --git a/include/seccomp.h.in b/include/seccomp.h.in ++index 5b9057f..03b84a1 100644 ++--- a/include/seccomp.h.in +++++ b/include/seccomp.h.in ++@@ -179,6 +179,14 @@ struct scmp_arg_cmp { ++ #endif ++ #define SCMP_ARCH_PPC64LE AUDIT_ARCH_PPC64LE ++ +++/** +++ * The RISC-V architecture tokens +++ */ +++#define SCMP_ARCH_RISCV64 AUDIT_ARCH_RISCV64 +++#ifndef AUDIT_ARCH_RISCV64 +++#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +++#endif +++ ++ /** ++ * The S390 architecture tokens ++ */ ++diff --git a/src/Makefile.am b/src/Makefile.am ++index dcc79d9..3021f2e 100644 ++--- a/src/Makefile.am +++++ b/src/Makefile.am ++@@ -37,6 +37,7 @@ SOURCES_ALL = \ ++ 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 \ +++ arch-riscv64.h arch-riscv64.c arch-riscv64-syscalls.c \ ++ arch-s390.h arch-s390.c arch-s390-syscalls.c \ ++ arch-s390x.h arch-s390x.c arch-s390x-syscalls.c ++ ++diff --git a/src/arch-syscall-check.c b/src/arch-syscall-check.c ++index db7fb89..b453277 100644 ++--- a/src/arch-syscall-check.c +++++ b/src/arch-syscall-check.c ++@@ -35,6 +35,7 @@ ++ #include "arch-mips64n32.h" ++ #include "arch-ppc.h" ++ #include "arch-ppc64.h" +++#include "arch-riscv64.h" ++ #include "arch-s390.h" ++ #include "arch-s390x.h" ++ ++@@ -73,6 +74,7 @@ int main(int argc, char *argv[]) ++ int i_mips64n32 = 0; ++ int i_ppc = 0; ++ int i_ppc64 = 0; +++ int i_riscv64 = 0; ++ int i_s390 = 0; ++ int i_s390x = 0; ++ char str_miss[256]; ++@@ -107,6 +109,8 @@ int main(int argc, char *argv[]) ++ ppc_syscall_iterate(i_ppc)); ++ syscall_check(str_miss, sys_name, "ppc64", ++ ppc64_syscall_iterate(i_ppc64)); +++ syscall_check(str_miss, sys_name, "riscv64", +++ riscv64_syscall_iterate(i_riscv64)); ++ syscall_check(str_miss, sys_name, "s390", ++ s390_syscall_iterate(i_s390)); ++ syscall_check(str_miss, sys_name, "s390x", ++@@ -141,6 +145,8 @@ int main(int argc, char *argv[]) ++ i_ppc = -1; ++ if (!ppc64_syscall_iterate(++i_ppc64)->name) ++ i_ppc64 = -1; +++ if (!riscv64_syscall_iterate(++i_riscv64)->name) +++ i_riscv64 = -1; ++ if (!s390_syscall_iterate(++i_s390)->name) ++ i_s390 = -1; ++ if (!s390x_syscall_iterate(++i_s390x)->name) ++@@ -149,6 +155,7 @@ int main(int argc, char *argv[]) ++ i_arm >= 0 && i_aarch64 >= 0 && ++ i_mips >= 0 && i_mips64 >= 0 && i_mips64n32 >= 0 && ++ i_ppc >= 0 && i_ppc64 >= 0 && +++ i_riscv64 >= 0 && ++ i_s390 >= 0 && i_s390x >= 0); ++ ++ /* check for any leftovers */ ++@@ -193,6 +200,10 @@ int main(int argc, char *argv[]) ++ printf("ERROR, ppc64 has additional syscalls\n"); ++ return 1; ++ } +++ if (i_riscv64 >= 0) { +++ printf("ERROR, riscv64 has additional syscalls\n"); +++ return 1; +++ } ++ if (i_s390 >= 0) { ++ printf("ERROR, s390 has additional syscalls\n"); ++ return 1; ++diff --git a/src/arch-syscall-dump.c b/src/arch-syscall-dump.c ++index c95b899..d119bf9 100644 ++--- a/src/arch-syscall-dump.c +++++ b/src/arch-syscall-dump.c ++@@ -40,6 +40,7 @@ ++ #include "arch-aarch64.h" ++ #include "arch-ppc.h" ++ #include "arch-ppc64.h" +++#include "arch-riscv64.h" ++ #include "arch-s390.h" ++ #include "arch-s390x.h" ++ ++@@ -122,6 +123,9 @@ int main(int argc, char *argv[]) ++ case SCMP_ARCH_PPC64LE: ++ sys = ppc64_syscall_iterate(iter); ++ break; +++ case SCMP_ARCH_RISCV64: +++ sys_name = riscv64_syscall_iterate(iter); +++ break; ++ case SCMP_ARCH_S390: ++ sys = s390_syscall_iterate(iter); ++ break; ++diff --git a/src/arch-syscall-validate b/src/arch-syscall-validate ++index 2a83098..fcb9f1c 100755 ++--- a/src/arch-syscall-validate +++++ b/src/arch-syscall-validate ++@@ -201,19 +201,19 @@ function dump_sys_aarch64() { ++ sed -e '/__NR_syscalls/d' | \ ++ sed -e '/__NR_arch_specific_syscall/d' | \ ++ sed -e 's/#define[ \t]\+__NR_\([^ \t]\+\)[ \t]\+\(.*\)/\1\t\2/' | \ ++- sed -e 's/__NR3264_statfs/43/' | \ ++- sed -e 's/__NR3264_ftruncate/46/' | \ ++- sed -e 's/__NR3264_truncate/45/' | \ ++- sed -e 's/__NR3264_lseek/62/' | \ ++- sed -e 's/__NR3264_sendfile/71/' | \ +++ sed -e 's/__NR3264_fadvise64/223/' | \ +++ sed -e 's/__NR3264_fcntl/25/' | \ ++ sed -e 's/__NR3264_fstatat/79/' | \ ++ sed -e 's/__NR3264_fstatfs/44/' | \ ++- sed -e 's/__NR3264_fcntl/25/' | \ ++- sed -e 's/__NR3264_fadvise64/223/' | \ ++- sed -e 's/__NR3264_mmap/222/' | \ ++ sed -e 's/__NR3264_fstat/80/' | \ +++ sed -e 's/__NR3264_ftruncate/46/' | \ +++ sed -e 's/__NR3264_lseek/62/' | \ ++ sed -e 's/__NR3264_lstat/1039/' | \ +++ sed -e 's/__NR3264_mmap/222/' | \ +++ sed -e 's/__NR3264_sendfile/71/' | \ +++ sed -e 's/__NR3264_statfs/43/' | \ ++ sed -e 's/__NR3264_stat/1038/' | \ +++ sed -e 's/__NR3264_truncate/45/' | \ ++ sort ++ } ++ ++@@ -376,6 +376,42 @@ function dump_lib_ppc64() { ++ dump_lib_arch ppc64 ++ } ++ +++# +++# Dump the riscv64 system syscall table +++# +++# Arguments: +++# 1 path to the kernel source +++# +++# Dump the architecture's syscall table to stdout. +++# +++function dump_sys_riscv64() { +++ gcc -E -dM -D__riscv64 $1/arch/riscv/include/uapi/asm/unistd.h | \ +++ grep "^#define __NR_" | \ +++ sed -e '/__NR_arch_specific_syscall/d' | \ +++ sed -e 's/__NR3264_fadvise64/223/' | \ +++ sed -e 's/__NR3264_fcntl/25/' | \ +++ sed -e 's/__NR3264_fstatat/79/' | \ +++ sed -e 's/__NR3264_fstatfs/44/' | \ +++ sed -e 's/__NR3264_fstat/80/' | \ +++ sed -e 's/__NR3264_ftruncate/46/' | \ +++ sed -e 's/__NR3264_lseek/62/' | \ +++ sed -e 's/__NR3264_mmap/222/' | \ +++ sed -e 's/__NR3264_sendfile/71/' | \ +++ sed -e 's/__NR3264_statfs/43/' | \ +++ sed -e 's/__NR3264_truncate/45/' | \ +++ sed -e 's/#define[ \t]\+__NR_\([a-z0-9_]\+\)[ \t]\+\([0-9]\+\)/\1\t\2/' | \ +++ sort +++} +++ +++# +++# Dump the riscv64 library syscall table +++# +++# Dump the library's syscall table to stdout. +++# +++function dump_lib_riscv64() { +++ dump_lib_arch riscv64 +++} +++ ++ # ++ # Dump the s390 system syscall table ++ # ++@@ -477,6 +513,9 @@ function dump_sys() { ++ ppc64) ++ dump_sys_ppc64 "$2" ++ ;; +++ riscv64) +++ dump_sys_riscv64 "$2" +++ ;; ++ s390) ++ dump_sys_s390 "$2" ++ ;; ++@@ -532,6 +571,9 @@ function dump_lib() { ++ ppc64) ++ dump_lib_ppc64 "$2" ++ ;; +++ riscv64) +++ dump_lib_riscv64 "$2" +++ ;; ++ s390) ++ dump_lib_s390 "$2" ++ ;; ++@@ -592,6 +634,7 @@ if [[ $opt_arches == "" ]]; then ++ arm aarch64 \ ++ mips mips64 mips64n32 \ ++ ppc ppc64 \ +++ riscv64 \ ++ s390 s390x" ++ fi ++ ++diff --git a/src/arch.c b/src/arch.c ++index f5a898d..0df3f06 100644 ++--- a/src/arch.c +++++ b/src/arch.c ++@@ -40,6 +40,7 @@ ++ #include "arch-mips64n32.h" ++ #include "arch-ppc.h" ++ #include "arch-ppc64.h" +++#include "arch-riscv64.h" ++ #include "arch-s390.h" ++ #include "arch-s390x.h" ++ #include "db.h" ++@@ -85,6 +86,8 @@ const struct arch_def *arch_def_native = &arch_def_ppc64le; ++ #endif ++ #elif __PPC__ ++ const struct arch_def *arch_def_native = &arch_def_ppc; +++#elif __riscv64 +++const struct arch_def *arch_def_native = &arch_def_riscv64; ++ #elif __s390x__ /* s390x must be checked before s390 */ ++ const struct arch_def *arch_def_native = &arch_def_s390x; ++ #elif __s390__ ++@@ -143,6 +146,8 @@ const struct arch_def *arch_def_lookup(uint32_t token) ++ return &arch_def_ppc64; ++ case SCMP_ARCH_PPC64LE: ++ return &arch_def_ppc64le; +++ case SCMP_ARCH_RISCV64: +++ return &arch_def_riscv64; ++ case SCMP_ARCH_S390: ++ return &arch_def_s390; ++ case SCMP_ARCH_S390X: ++@@ -189,6 +194,8 @@ const struct arch_def *arch_def_lookup_name(const char *arch_name) ++ return &arch_def_ppc64; ++ else if (strcmp(arch_name, "ppc64le") == 0) ++ return &arch_def_ppc64le; +++ else if (strcmp(arch_name, "riscv64") == 0) +++ return &arch_def_riscv64; ++ else if (strcmp(arch_name, "s390") == 0) ++ return &arch_def_s390; ++ else if (strcmp(arch_name, "s390x") == 0) ++diff --git a/src/gen_pfc.c b/src/gen_pfc.c ++index b9c122e..ac189ad 100644 ++--- a/src/gen_pfc.c +++++ b/src/gen_pfc.c ++@@ -77,6 +77,8 @@ static const char *_pfc_arch(const struct arch_def *arch) ++ return "ppc64le"; ++ case SCMP_ARCH_PPC: ++ return "ppc"; +++ case SCMP_ARCH_RISCV64: +++ return "riscv64"; ++ case SCMP_ARCH_S390X: ++ return "s390x"; ++ case SCMP_ARCH_S390: ++diff --git a/src/python/libseccomp.pxd b/src/python/libseccomp.pxd ++index 500da15..09c5a58 100644 ++--- a/src/python/libseccomp.pxd +++++ b/src/python/libseccomp.pxd ++@@ -46,6 +46,7 @@ cdef extern from "seccomp.h": ++ SCMP_ARCH_PPC ++ SCMP_ARCH_PPC64 ++ SCMP_ARCH_PPC64LE +++ SCMP_ARCH_RISCV64 ++ SCMP_ARCH_S390 ++ SCMP_ARCH_S390X ++ ++diff --git a/src/python/seccomp.pyx b/src/python/seccomp.pyx ++index cb17642..7b908f7 100644 ++--- a/src/python/seccomp.pyx +++++ b/src/python/seccomp.pyx ++@@ -168,6 +168,7 @@ cdef class Arch: ++ MIPSEL64N32 - MIPS little endian N32 ABI ++ PPC64 - 64-bit PowerPC ++ PPC - 32-bit PowerPC +++ RISCV64 - 64-bit RISC-V ++ """ ++ ++ cdef int _token ++@@ -187,6 +188,7 @@ cdef class Arch: ++ PPC = libseccomp.SCMP_ARCH_PPC ++ PPC64 = libseccomp.SCMP_ARCH_PPC64 ++ PPC64LE = libseccomp.SCMP_ARCH_PPC64LE +++ RISCV64 = libseccomp.SCMP_ARCH_RISCV64 ++ S390 = libseccomp.SCMP_ARCH_S390 ++ S390X = libseccomp.SCMP_ARCH_S390X ++ ++@@ -230,6 +232,8 @@ cdef class Arch: ++ self._token = libseccomp.SCMP_ARCH_PPC64 ++ elif arch == libseccomp.SCMP_ARCH_PPC64LE: ++ self._token = libseccomp.SCMP_ARCH_PPC64LE +++ elif arch == libseccomp.SCMP_ARCH_RISCV64: +++ self._token = libseccomp.SCMP_ARCH_RISCV64 ++ elif arch == libseccomp.SCMP_ARCH_S390: ++ self._token = libseccomp.SCMP_ARCH_S390 ++ elif arch == libseccomp.SCMP_ARCH_S390X: ++diff --git a/tests/04-sim-multilevel_chains.tests b/tests/04-sim-multilevel_chains.tests ++index 6613f9a..150d609 100644 ++--- a/tests/04-sim-multilevel_chains.tests +++++ b/tests/04-sim-multilevel_chains.tests ++@@ -8,7 +8,7 @@ ++ test type: bpf-sim ++ ++ # Testname Arch Syscall Arg0 Arg1 Arg2 Arg3 Arg4 Arg5 Result ++-04-sim-multilevel_chains all,-aarch64 open 0x856B008 4 N N N N ALLOW +++04-sim-multilevel_chains all,-aarch64,-riscv64 open 0x856B008 4 N N N N ALLOW ++ 04-sim-multilevel_chains all close 4 N N N N N ALLOW ++ 04-sim-multilevel_chains x86 read 0 0x856B008 0x7FFFFFFE N N N ALLOW ++ 04-sim-multilevel_chains x86_64 read 0 0x856B008 0x7FFFFFFFFFFFFFFE N N N ALLOW ++diff --git a/tests/06-sim-actions.tests b/tests/06-sim-actions.tests ++index d0c2e44..eb59dde 100644 ++--- a/tests/06-sim-actions.tests +++++ b/tests/06-sim-actions.tests ++@@ -11,7 +11,7 @@ test type: bpf-sim ++ 06-sim-actions all read 4 0x856B008 80 N N N ALLOW ++ 06-sim-actions all write 1 0x856B008 N N N N ERRNO(1) ++ 06-sim-actions all close 4 N N N N N TRAP ++-06-sim-actions all,-aarch64 open 0x856B008 4 N N N N TRACE(1234) +++06-sim-actions all,-aarch64,-riscv64 open 0x856B008 4 N N N N TRACE(1234) ++ 06-sim-actions x86 0-2 N N N N N N KILL ++ 06-sim-actions x86 7-350 N N N N N N KILL ++ 06-sim-actions x86_64 4-350 N N N N N N KILL ++diff --git a/tests/16-sim-arch_basic.c b/tests/16-sim-arch_basic.c ++index df89aa3..e4a3257 100644 ++--- a/tests/16-sim-arch_basic.c +++++ b/tests/16-sim-arch_basic.c ++@@ -69,6 +69,9 @@ int main(int argc, char *argv[]) ++ if (rc != 0) ++ goto out; ++ rc = seccomp_arch_add(ctx, SCMP_ARCH_PPC64LE); +++ if (rc != 0) +++ goto out; +++ rc = seccomp_arch_add(ctx, SCMP_ARCH_RISCV64); ++ if (rc != 0) ++ goto out; ++ ++diff --git a/tests/16-sim-arch_basic.py b/tests/16-sim-arch_basic.py ++index 1bf92d6..b2fd551 100755 ++--- a/tests/16-sim-arch_basic.py +++++ b/tests/16-sim-arch_basic.py ++@@ -40,6 +40,7 @@ def test(args): ++ f.add_arch(Arch("mipsel64")) ++ f.add_arch(Arch("mipsel64n32")) ++ f.add_arch(Arch("ppc64le")) +++ f.add_arch(Arch("riscv64")) ++ f.add_rule(ALLOW, "read", Arg(0, EQ, sys.stdin.fileno())) ++ f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stdout.fileno())) ++ f.add_rule(ALLOW, "write", Arg(0, EQ, sys.stderr.fileno())) ++diff --git a/tests/23-sim-arch_all_le_basic.c b/tests/23-sim-arch_all_le_basic.c ++index 5672980..32739e5 100644 ++--- a/tests/23-sim-arch_all_le_basic.c +++++ b/tests/23-sim-arch_all_le_basic.c ++@@ -69,6 +69,9 @@ int main(int argc, char *argv[]) ++ if (rc != 0) ++ goto out; ++ rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("ppc64le")); +++ if (rc != 0) +++ goto out; +++ rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("riscv64")); ++ if (rc != 0) ++ goto out; ++ ++diff --git a/tests/regression b/tests/regression ++index 40567d5..156478b 100755 ++--- a/tests/regression +++++ b/tests/regression ++@@ -25,7 +25,8 @@ GLBL_ARCH_LE_SUPPORT=" \ ++ x86 x86_64 x32 \ ++ arm aarch64 \ ++ mipsel mipsel64 mipsel64n32 \ ++- ppc64le" +++ ppc64le \ +++ riscv64" ++ GLBL_ARCH_BE_SUPPORT=" \ ++ mips mips64 mips64n32 \ ++ ppc ppc64 \ ++diff --git a/tools/scmp_arch_detect.c b/tools/scmp_arch_detect.c ++index ad43f2d..c9f42d7 100644 ++--- a/tools/scmp_arch_detect.c +++++ b/tools/scmp_arch_detect.c ++@@ -108,6 +108,9 @@ int main(int argc, char *argv[]) ++ case SCMP_ARCH_PPC64LE: ++ printf("ppc64le\n"); ++ break; +++ case SCMP_ARCH_RISCV64: +++ printf("riscv64\n"); +++ break; ++ case SCMP_ARCH_S390: ++ printf("s390\n"); ++ break; ++diff --git a/tools/scmp_bpf_disasm.c b/tools/scmp_bpf_disasm.c ++index 05590f4..5fe79cc 100644 ++--- a/tools/scmp_bpf_disasm.c +++++ b/tools/scmp_bpf_disasm.c ++@@ -492,6 +492,8 @@ int main(int argc, char *argv[]) ++ arch = AUDIT_ARCH_PPC64LE; ++ else if (strcmp(optarg, "ppc") == 0) ++ arch = AUDIT_ARCH_PPC; +++ else if (strcmp(optarg, "riscv64") == 0) +++ arch = AUDIT_ARCH_RISCV64; ++ else if (strcmp(optarg, "s390") == 0) ++ arch = AUDIT_ARCH_S390; ++ else if (strcmp(optarg, "s390x") == 0) ++diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c ++index 3d3204a..92215e1 100644 ++--- a/tools/scmp_bpf_sim.c +++++ b/tools/scmp_bpf_sim.c ++@@ -271,6 +271,8 @@ int main(int argc, char *argv[]) ++ arch = AUDIT_ARCH_PPC64; ++ else if (strcmp(optarg, "ppc64le") == 0) ++ arch = AUDIT_ARCH_PPC64LE; +++ else if (strcmp(optarg, "riscv64") == 0) +++ arch = AUDIT_ARCH_RISCV64; ++ else if (strcmp(optarg, "s390") == 0) ++ arch = AUDIT_ARCH_S390; ++ else if (strcmp(optarg, "s390x") == 0) ++diff --git a/tools/util.c b/tools/util.c ++index 7122335..30c2322 100644 ++--- a/tools/util.c +++++ b/tools/util.c ++@@ -70,6 +70,8 @@ ++ #endif ++ #elif __PPC__ ++ #define ARCH_NATIVE AUDIT_ARCH_PPC +++#elif __riscv64 +++#define ARCH_NATIVE AUDIT_ARCH_RISCV64 ++ #elif __s390x__ /* s390x must be checked before s390 */ ++ #define ARCH_NATIVE AUDIT_ARCH_S390X ++ #elif __s390__ ++diff --git a/tools/util.h b/tools/util.h ++index 08c4839..31011df 100644 ++--- a/tools/util.h +++++ b/tools/util.h ++@@ -72,6 +72,10 @@ ++ #define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) ++ #endif ++ +++#ifndef AUDIT_ARCH_RISCV64 +++#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +++#endif +++ ++ extern uint32_t arch; ++ ++ uint16_t ttoh16(uint32_t arch, uint16_t val); |