mirror of
https://gitee.com/open-loongarch/buildroot-2024.08.git
synced 2026-10-25 20:57:12 +08:00
libseccomp: support libseccomp compile (2.3.3 version)
添加 libseccomp 库的编译 Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -0,0 +1,982 @@
|
||||
From c86e1f565537b28b73ebd63f0239b4a446925534 Mon Sep 17 00:00:00 2001
|
||||
From: Helge Deller <deller@gmx.de>
|
||||
Date: Wed, 25 May 2016 16:53:39 +0200
|
||||
Subject: [PATCH] arch: Add parisc architecture support
|
||||
|
||||
This patch (v4) adds support for the parisc and parisc64 architectures
|
||||
to libseccomp.
|
||||
|
||||
I didn't split up the patch, because it's pretty trivial.
|
||||
Those parisc-specific files gets added:
|
||||
src/arch-parisc-syscalls.c
|
||||
src/arch-parisc.c
|
||||
src/arch-parisc.h
|
||||
src/arch-parisc64.c
|
||||
|
||||
All other changes are trivial because they simply add parisc-specific
|
||||
case statements in variouse switch statements.
|
||||
|
||||
I did ran a "make check" on x86-64 and parisc and all testcases succeeded.
|
||||
All live testcases succeed as well when running "./regression -T live".
|
||||
|
||||
The patch applies cleanly to current libseccomp git head.
|
||||
|
||||
Changes between v4 and v3 of this patch:
|
||||
- Added parisc arch to arch-syscall-check.c and fixup syscall table as
|
||||
needed
|
||||
- Fixed copyright notices in parisc files as suggested by Mike Frysinger
|
||||
|
||||
Changes between v3 and v2 of this patch:
|
||||
- Stripped out patch which reports if a check was skipped because
|
||||
valgrind isn't installed.
|
||||
- Added tuxcall pseudo syscall for 19-sim-missing_syscalls testcase
|
||||
- Added sysmips pseudo syscall for 29-sim-pseudo_syscall testcase
|
||||
|
||||
Changes between v2 and v1 of this patch:
|
||||
- Enabled seccomp mode 2 regression tests on parisc. Kernel support for
|
||||
hppa was added in kernel 4.6-rc1 and backported into the kernel v4.5.2
|
||||
stable series.
|
||||
|
||||
Signed-off-by: Helge Deller <deller@gmx.de>
|
||||
[PM: corrected a number or errors from 'make check-syntax']
|
||||
Signed-off-by: Paul Moore <paul@paul-moore.com>
|
||||
---
|
||||
include/seccomp.h.in | 6 +
|
||||
src/Makefile.am | 2 +
|
||||
src/arch-parisc-syscalls.c | 499 ++++++++++++++++++++++++++++++++++++++
|
||||
src/arch-parisc.c | 22 ++
|
||||
src/arch-parisc.h | 38 +++
|
||||
src/arch-parisc64.c | 22 ++
|
||||
src/arch-syscall-check.c | 11 +
|
||||
src/arch-syscall-dump.c | 5 +
|
||||
src/arch.c | 13 +
|
||||
src/gen_pfc.c | 4 +
|
||||
src/python/libseccomp.pxd | 2 +
|
||||
src/python/seccomp.pyx | 8 +
|
||||
tests/26-sim-arch_all_be_basic.c | 6 +
|
||||
tests/26-sim-arch_all_be_basic.py | 2 +
|
||||
tests/regression | 3 +-
|
||||
tools/scmp_arch_detect.c | 6 +
|
||||
tools/scmp_bpf_sim.c | 4 +
|
||||
tools/util.c | 4 +
|
||||
18 files changed, 656 insertions(+), 1 deletion(-)
|
||||
create mode 100644 src/arch-parisc-syscalls.c
|
||||
create mode 100644 src/arch-parisc.c
|
||||
create mode 100644 src/arch-parisc.h
|
||||
create mode 100644 src/arch-parisc64.c
|
||||
|
||||
Index: libseccomp/include/seccomp.h.in
|
||||
===================================================================
|
||||
--- libseccomp.orig/include/seccomp.h.in 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/include/seccomp.h.in 2016-05-28 19:57:02.038592653 +0200
|
||||
@@ -185,6 +185,12 @@
|
||||
#define SCMP_ARCH_S390X AUDIT_ARCH_S390X
|
||||
|
||||
/**
|
||||
+ * The PA-RISC hppa architecture tokens
|
||||
+ */
|
||||
+#define SCMP_ARCH_PARISC AUDIT_ARCH_PARISC
|
||||
+#define SCMP_ARCH_PARISC64 AUDIT_ARCH_PARISC64
|
||||
+
|
||||
+/**
|
||||
* Convert a syscall name into the associated syscall number
|
||||
* @param x the syscall name
|
||||
*/
|
||||
Index: libseccomp/src/Makefile.am
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/Makefile.am 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/Makefile.am 2016-05-28 19:57:02.038592653 +0200
|
||||
@@ -35,6 +35,8 @@
|
||||
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-parisc.h arch-parisc.c arch-parisc-syscalls.c \
|
||||
+ arch-parisc64.h arch-parisc64.c \
|
||||
arch-ppc.h arch-ppc.c arch-ppc-syscalls.c \
|
||||
arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c \
|
||||
arch-s390.h arch-s390.c arch-s390-syscalls.c \
|
||||
Index: libseccomp/src/arch-parisc-syscalls.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ libseccomp/src/arch-parisc-syscalls.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -0,0 +1,499 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2016 Helge Deller <deller@gmx.de>
|
||||
+ * Author: Helge Deller <deller@gmx.de>
|
||||
+ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <seccomp.h>
|
||||
+
|
||||
+#include "arch.h"
|
||||
+#include "arch-parisc.h"
|
||||
+
|
||||
+/* NOTE: based on Linux 4.5-rc4 */
|
||||
+const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
+ { "_llseek", 140 },
|
||||
+ { "_newselect", 142 },
|
||||
+ { "_sysctl", 149 },
|
||||
+ { "accept", 35 },
|
||||
+ { "accept4", 320 },
|
||||
+ { "access", 33 },
|
||||
+ { "acct", 51 },
|
||||
+ { "add_key", 264 },
|
||||
+ { "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", 22 },
|
||||
+ { "bpf", 341 },
|
||||
+ { "break", __PNR_break },
|
||||
+ { "breakpoint", __PNR_breakpoint },
|
||||
+ { "brk", 45 },
|
||||
+ { "cachectl", __PNR_cachectl },
|
||||
+ { "cacheflush", __PNR_cacheflush },
|
||||
+ { "capget", 106 },
|
||||
+ { "capset", 107 },
|
||||
+ { "chdir", 12 },
|
||||
+ { "chmod", 15 },
|
||||
+ { "chown", 180 },
|
||||
+ { "chown32", __PNR_chown32 },
|
||||
+ { "chroot", 61 },
|
||||
+ { "clock_adjtime", 324 },
|
||||
+ { "clock_getres", 257 },
|
||||
+ { "clock_gettime", 256 },
|
||||
+ { "clock_nanosleep", 258 },
|
||||
+ { "clock_settime", 255 },
|
||||
+ { "clone", 120 },
|
||||
+ { "close", 6 },
|
||||
+ { "connect", 31 },
|
||||
+ { "copy_file_range", 346 },
|
||||
+ { "creat", 8 },
|
||||
+ { "create_module", 127 },
|
||||
+ { "delete_module", 129 },
|
||||
+ { "dup", 41 },
|
||||
+ { "dup2", 63 },
|
||||
+ { "dup3", 312 },
|
||||
+ { "epoll_create", 224 },
|
||||
+ { "epoll_create1", 311 },
|
||||
+ { "epoll_ctl", 225 },
|
||||
+ { "epoll_ctl_old", __PNR_epoll_ctl_old },
|
||||
+ { "epoll_pwait", 297 },
|
||||
+ { "epoll_wait", 226 },
|
||||
+ { "epoll_wait_old", __PNR_epoll_wait_old },
|
||||
+ { "eventfd", 304 },
|
||||
+ { "eventfd2", 310 },
|
||||
+ { "execve", 11 },
|
||||
+ { "execveat", 342 },
|
||||
+ { "exit", 1 },
|
||||
+ { "exit_group", 222 },
|
||||
+ { "faccessat", 287 },
|
||||
+ { "fadvise64", __PNR_fadvise64 },
|
||||
+ { "fadvise64_64", 236 },
|
||||
+ { "fallocate", 305 },
|
||||
+ { "fanotify_init", 322 },
|
||||
+ { "fanotify_mark", 323 },
|
||||
+ { "fchdir", 133 },
|
||||
+ { "fchmod", 94 },
|
||||
+ { "fchmodat", 286 },
|
||||
+ { "fchown", 95 },
|
||||
+ { "fchown32", __PNR_fchown32 },
|
||||
+ { "fchownat", 278 },
|
||||
+ { "fcntl", 55 },
|
||||
+ { "fcntl64", 202 },
|
||||
+ { "fdatasync", 148 },
|
||||
+ { "fgetxattr", 243 },
|
||||
+ { "finit_module", 333 },
|
||||
+ { "flistxattr", 246 },
|
||||
+ { "flock", 143 },
|
||||
+ { "fork", 2 },
|
||||
+ { "fremovexattr", 249 },
|
||||
+ { "fsetxattr", 240 },
|
||||
+ { "fstat", 28 },
|
||||
+ { "fstat64", 112 },
|
||||
+ { "fstatat64", 280 },
|
||||
+ { "fstatfs", 100 },
|
||||
+ { "fstatfs64", 299 },
|
||||
+ { "fsync", 118 },
|
||||
+ { "ftime", __PNR_ftime },
|
||||
+ { "ftruncate", 93 },
|
||||
+ { "ftruncate64", 200 },
|
||||
+ { "futex", 210 },
|
||||
+ { "futimesat", 279 },
|
||||
+ { "get_kernel_syms", 130 },
|
||||
+ { "get_mempolicy", 261 },
|
||||
+ { "get_robust_list", 290 },
|
||||
+ { "get_thread_area", 214 },
|
||||
+ { "getcpu", 296 },
|
||||
+ { "getcwd", 110 },
|
||||
+ { "getdents", 141 },
|
||||
+ { "getdents64", 201 },
|
||||
+ { "getegid", 50 },
|
||||
+ { "getegid32", __PNR_getegid32 },
|
||||
+ { "geteuid", 49 },
|
||||
+ { "geteuid32", __PNR_geteuid32 },
|
||||
+ { "getgid", 47 },
|
||||
+ { "getgid32", __PNR_getgid32 },
|
||||
+ { "getgroups", 80 },
|
||||
+ { "getgroups32", __PNR_getgroups32 },
|
||||
+ { "getitimer", 105 },
|
||||
+ { "getpeername", 53 },
|
||||
+ { "getpgid", 132 },
|
||||
+ { "getpgrp", 65 },
|
||||
+ { "getpid", 20 },
|
||||
+ { "getpmsg", 196 },
|
||||
+ { "getppid", 64 },
|
||||
+ { "getpriority", 96 },
|
||||
+ { "getrandom", 339 },
|
||||
+ { "getresgid", 171 },
|
||||
+ { "getresgid32", __PNR_getresgid32 },
|
||||
+ { "getresuid", 165 },
|
||||
+ { "getresuid32", __PNR_getresuid32 },
|
||||
+ { "getrlimit", 76 },
|
||||
+ { "getrusage", 77 },
|
||||
+ { "getsid", 147 },
|
||||
+ { "getsockname", 44 },
|
||||
+ { "getsockopt", 182 },
|
||||
+ { "gettid", 206 },
|
||||
+ { "gettimeofday", 78 },
|
||||
+ { "getuid", 24 },
|
||||
+ { "getuid32", __PNR_getuid32 },
|
||||
+ { "getxattr", 241 },
|
||||
+ { "gtty", __PNR_gtty },
|
||||
+ { "idle", __PNR_idle },
|
||||
+ { "init_module", 128 },
|
||||
+ { "inotify_add_watch", 270 },
|
||||
+ { "inotify_init", 269 },
|
||||
+ { "inotify_init1", 314 },
|
||||
+ { "inotify_rm_watch", 271 },
|
||||
+ { "io_cancel", 219 },
|
||||
+ { "io_destroy", 216 },
|
||||
+ { "io_getevents", 217 },
|
||||
+ { "io_setup", 215 },
|
||||
+ { "io_submit", 218 },
|
||||
+ { "ioctl", 54 },
|
||||
+ { "ioperm", __PNR_ioperm },
|
||||
+ { "iopl", __PNR_iopl },
|
||||
+ { "ioprio_get", 268 },
|
||||
+ { "ioprio_set", 267 },
|
||||
+ { "ipc", __PNR_ipc },
|
||||
+ { "kcmp", 332 },
|
||||
+ { "kexec_file_load", __PNR_kexec_file_load },
|
||||
+ { "kexec_load", 300 },
|
||||
+ { "keyctl", 266 },
|
||||
+ { "kill", 37 },
|
||||
+ { "lchown", 16 },
|
||||
+ { "lchown32", __PNR_lchown32 },
|
||||
+ { "lgetxattr", 242 },
|
||||
+ { "link", 9 },
|
||||
+ { "linkat", 283 },
|
||||
+ { "listen", 32 },
|
||||
+ { "listxattr", 244 },
|
||||
+ { "llistxattr", 245 },
|
||||
+ { "lock", __PNR_lock },
|
||||
+ { "lookup_dcookie", 223 },
|
||||
+ { "lremovexattr", 248 },
|
||||
+ { "lseek", 19 },
|
||||
+ { "lsetxattr", 239 },
|
||||
+ { "lstat", 84 },
|
||||
+ { "lstat64", 198 },
|
||||
+ { "madvise", 119 },
|
||||
+ { "mbind", 260 },
|
||||
+ { "membarrier", 343 },
|
||||
+ { "memfd_create", 340 },
|
||||
+ { "migrate_pages", 272 },
|
||||
+ { "mincore", 72 },
|
||||
+ { "mkdir", 39 },
|
||||
+ { "mkdirat", 276 },
|
||||
+ { "mknod", 14 },
|
||||
+ { "mknodat", 277 },
|
||||
+ { "mlock", 150 },
|
||||
+ { "mlock2", 345 },
|
||||
+ { "mlockall", 152 },
|
||||
+ { "mmap", 90 },
|
||||
+ { "mmap2", 89 },
|
||||
+ { "modify_ldt", __PNR_modify_ldt },
|
||||
+ { "mount", 21 },
|
||||
+ { "move_pages", 295 },
|
||||
+ { "mprotect", 125 },
|
||||
+ { "mpx", __PNR_mpx },
|
||||
+ { "mq_getsetattr", 234 },
|
||||
+ { "mq_notify", 233 },
|
||||
+ { "mq_open", 229 },
|
||||
+ { "mq_timedreceive", 232 },
|
||||
+ { "mq_timedsend", 231 },
|
||||
+ { "mq_unlink", 230 },
|
||||
+ { "mremap", 163 },
|
||||
+ { "msgctl", 191 },
|
||||
+ { "msgget", 190 },
|
||||
+ { "msgrcv", 189 },
|
||||
+ { "msgsnd", 188 },
|
||||
+ { "msync", 144 },
|
||||
+ { "multiplexer", __PNR_multiplexer },
|
||||
+ { "munlock", 151 },
|
||||
+ { "munlockall", 153 },
|
||||
+ { "munmap", 91 },
|
||||
+ { "name_to_handle_at", 325 },
|
||||
+ { "nanosleep", 162 },
|
||||
+ { "newfstatat", __PNR_newfstatat },
|
||||
+ { "nfsservctl", 169 },
|
||||
+ { "nice", 34 },
|
||||
+ { "oldfstat", __PNR_oldfstat },
|
||||
+ { "oldlstat", __PNR_oldlstat },
|
||||
+ { "oldolduname", __PNR_oldolduname },
|
||||
+ { "oldstat", __PNR_oldstat },
|
||||
+ { "olduname", __PNR_olduname },
|
||||
+ { "oldwait4", __PNR_oldwait4 },
|
||||
+ { "open", 5 },
|
||||
+ { "open_by_handle_at", 326 },
|
||||
+ { "openat", 275 },
|
||||
+ { "pause", 29 },
|
||||
+ { "pciconfig_iobase", __PNR_pciconfig_iobase },
|
||||
+ { "pciconfig_read", __PNR_pciconfig_read },
|
||||
+ { "pciconfig_write", __PNR_pciconfig_write },
|
||||
+ { "perf_event_open", 318 },
|
||||
+ { "personality", 136 },
|
||||
+ { "pipe", 42 },
|
||||
+ { "pipe2", 313 },
|
||||
+ { "pivot_root", 67 },
|
||||
+ { "poll", 168 },
|
||||
+ { "ppoll", 274 },
|
||||
+ { "prctl", 172 },
|
||||
+ { "pread64", 108 },
|
||||
+ { "preadv", 315 },
|
||||
+ { "prlimit64", 321 },
|
||||
+ { "process_vm_readv", 330 },
|
||||
+ { "process_vm_writev", 331 },
|
||||
+ { "prof", __PNR_prof },
|
||||
+ { "profil", __PNR_profil },
|
||||
+ { "pselect6", 273 },
|
||||
+ { "ptrace", 26 },
|
||||
+ { "putpmsg", 197 },
|
||||
+ { "pwrite64", 109 },
|
||||
+ { "pwritev", 316 },
|
||||
+ { "query_module", 167 },
|
||||
+ { "quotactl", 131 },
|
||||
+ { "read", 3 },
|
||||
+ { "readahead", 207 },
|
||||
+ { "readdir", __PNR_readdir },
|
||||
+ { "readlink", 85 },
|
||||
+ { "readlinkat", 285 },
|
||||
+ { "readv", 145 },
|
||||
+ { "reboot", 88 },
|
||||
+ { "recv", 98 },
|
||||
+ { "recvfrom", 123 },
|
||||
+ { "recvmmsg", 319 },
|
||||
+ { "recvmsg", 184 },
|
||||
+ { "remap_file_pages", 227 },
|
||||
+ { "removexattr", 247 },
|
||||
+ { "rename", 38 },
|
||||
+ { "renameat", 282 },
|
||||
+ { "renameat2", 337 },
|
||||
+ { "request_key", 265 },
|
||||
+ { "restart_syscall", 0 },
|
||||
+ { "rmdir", 40 },
|
||||
+ { "rt_sigaction", 174 },
|
||||
+ { "rt_sigpending", 176 },
|
||||
+ { "rt_sigprocmask", 175 },
|
||||
+ { "rt_sigqueueinfo", 178 },
|
||||
+ { "rt_sigreturn", 173 },
|
||||
+ { "rt_sigsuspend", 179 },
|
||||
+ { "rt_sigtimedwait", 177 },
|
||||
+ { "rt_tgsigqueueinfo", 317 },
|
||||
+ { "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", 159 },
|
||||
+ { "sched_get_priority_min", 160 },
|
||||
+ { "sched_getaffinity", 212 },
|
||||
+ { "sched_getattr", 335 },
|
||||
+ { "sched_getparam", 155 },
|
||||
+ { "sched_getscheduler", 157 },
|
||||
+ { "sched_rr_get_interval", 161 },
|
||||
+ { "sched_setaffinity", 211 },
|
||||
+ { "sched_setattr", 334 },
|
||||
+ { "sched_setparam", 154 },
|
||||
+ { "sched_setscheduler", 156 },
|
||||
+ { "sched_yield", 158 },
|
||||
+ { "seccomp", 338 },
|
||||
+ { "security", __PNR_security },
|
||||
+ { "select", __PNR_select },
|
||||
+ { "semctl", 187 },
|
||||
+ { "semget", 186 },
|
||||
+ { "semop", 185 },
|
||||
+ { "semtimedop", 228 },
|
||||
+ { "send", 58 },
|
||||
+ { "sendfile", 122 },
|
||||
+ { "sendfile64", 209 },
|
||||
+ { "sendmmsg", 329 },
|
||||
+ { "sendmsg", 183 },
|
||||
+ { "sendto", 82 },
|
||||
+ { "set_mempolicy", 262 },
|
||||
+ { "set_robust_list", 289 },
|
||||
+ { "set_thread_area", 213 },
|
||||
+ { "set_tid_address", 237 },
|
||||
+ { "set_tls", __PNR_set_tls },
|
||||
+ { "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", 328 },
|
||||
+ { "setpgid", 57 },
|
||||
+ { "setpriority", 97 },
|
||||
+ { "setregid", 71 },
|
||||
+ { "setregid32", __PNR_setregid32 },
|
||||
+ { "setresgid", 170 },
|
||||
+ { "setresgid32", __PNR_setresgid32 },
|
||||
+ { "setresuid", 164 },
|
||||
+ { "setresuid32", __PNR_setresuid32 },
|
||||
+ { "setreuid", 70 },
|
||||
+ { "setreuid32", __PNR_setreuid32 },
|
||||
+ { "setrlimit", 75 },
|
||||
+ { "setsid", 66 },
|
||||
+ { "setsockopt", 181 },
|
||||
+ { "settimeofday", 79 },
|
||||
+ { "setuid", 23 },
|
||||
+ { "setuid32", __PNR_setuid32 },
|
||||
+ { "setxattr", 238 },
|
||||
+ { "sgetmask", 68 },
|
||||
+ { "shmat", 192 },
|
||||
+ { "shmctl", 195 },
|
||||
+ { "shmdt", 193 },
|
||||
+ { "shmget", 194 },
|
||||
+ { "shutdown", 117 },
|
||||
+ { "sigaction", __PNR_sigaction },
|
||||
+ { "sigaltstack", 166 },
|
||||
+ { "signal", 48 },
|
||||
+ { "signalfd", 302 },
|
||||
+ { "signalfd4", 309 },
|
||||
+ { "sigpending", 73 },
|
||||
+ { "sigprocmask", 126 },
|
||||
+ { "sigreturn", __PNR_sigreturn },
|
||||
+ { "sigsuspend", __PNR_sigsuspend },
|
||||
+ { "socket", 17 },
|
||||
+ { "socketcall", __PNR_socketcall },
|
||||
+ { "socketpair", 56 },
|
||||
+ { "splice", 291 },
|
||||
+ { "spu_create", __PNR_spu_create },
|
||||
+ { "spu_run", __PNR_spu_run },
|
||||
+ { "ssetmask", 69 },
|
||||
+ { "stat", 18 },
|
||||
+ { "stat64", 101 },
|
||||
+ { "statfs", 99 },
|
||||
+ { "statfs64", 298 },
|
||||
+ { "stime", 25 },
|
||||
+ { "stty", __PNR_stty },
|
||||
+ { "subpage_prot", __PNR_subpage_prot },
|
||||
+ { "swapcontext", __PNR_swapcontext },
|
||||
+ { "swapoff", 115 },
|
||||
+ { "swapon", 87 },
|
||||
+ { "switch_endian", __PNR_switch_endian },
|
||||
+ { "symlink", 83 },
|
||||
+ { "symlinkat", 284 },
|
||||
+ { "sync", 36 },
|
||||
+ { "sync_file_range", 292 },
|
||||
+ { "sync_file_range2", __PNR_sync_file_range2 },
|
||||
+ { "syncfs", 327 },
|
||||
+ { "syscall", __PNR_syscall },
|
||||
+ { "sys_debug_setcontext", __PNR_sys_debug_setcontext },
|
||||
+ { "sysfs", 135 },
|
||||
+ { "sysinfo", 116 },
|
||||
+ { "syslog", 103 },
|
||||
+ { "sysmips", __PNR_sysmips },
|
||||
+ { "tee", 293 },
|
||||
+ { "tgkill", 259 },
|
||||
+ { "time", 13 },
|
||||
+ { "timer_create", 250 },
|
||||
+ { "timer_delete", 254 },
|
||||
+ { "timer_getoverrun", 253 },
|
||||
+ { "timer_gettime", 252 },
|
||||
+ { "timer_settime", 251 },
|
||||
+ { "timerfd", 303 },
|
||||
+ { "timerfd_create", 306 },
|
||||
+ { "timerfd_gettime", 308 },
|
||||
+ { "timerfd_settime", 307 },
|
||||
+ { "times", 43 },
|
||||
+ { "tkill", 208 },
|
||||
+ { "truncate", 92 },
|
||||
+ { "truncate64", 199 },
|
||||
+ { "tuxcall", __PNR_tuxcall },
|
||||
+ { "ugetrlimit", __PNR_ugetrlimit },
|
||||
+ { "ulimit", __PNR_ulimit },
|
||||
+ { "umask", 60 },
|
||||
+ { "umount", __PNR_umount },
|
||||
+ { "umount2", 52 },
|
||||
+ { "uname", 59 },
|
||||
+ { "unlink", 10 },
|
||||
+ { "unlinkat", 281 },
|
||||
+ { "unshare", 288 },
|
||||
+ { "uselib", 86 },
|
||||
+ { "userfaultfd", 344 },
|
||||
+ { "usr26", __PNR_usr26 },
|
||||
+ { "usr32", __PNR_usr32 },
|
||||
+ { "ustat", 62 },
|
||||
+ { "utime", 30 },
|
||||
+ { "utimensat", 301 },
|
||||
+ { "utimes", 336 },
|
||||
+ { "vfork", 113 },
|
||||
+ { "vhangup", 111 },
|
||||
+ { "vm86", __PNR_vm86 },
|
||||
+ { "vm86old", __PNR_vm86old },
|
||||
+ { "vmsplice", 294 },
|
||||
+ { "vserver", 263 },
|
||||
+ { "wait4", 114 },
|
||||
+ { "waitid", 235 },
|
||||
+ { "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 parisc_syscall_resolve_name(const char *name)
|
||||
+{
|
||||
+ unsigned int iter;
|
||||
+ const struct arch_syscall_def *table = parisc_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 *parisc_syscall_resolve_num(int num)
|
||||
+{
|
||||
+ unsigned int iter;
|
||||
+ const struct arch_syscall_def *table = parisc_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 *parisc_syscall_iterate(unsigned int spot)
|
||||
+{
|
||||
+ /* XXX - no safety checks here */
|
||||
+ return &parisc_syscall_table[spot];
|
||||
+}
|
||||
Index: libseccomp/src/arch-parisc.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ libseccomp/src/arch-parisc.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -0,0 +1,22 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2016 Helge Deller <deller@gmx.de>
|
||||
+ * Author: Helge Deller <deller@gmx.de>
|
||||
+ */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/audit.h>
|
||||
+
|
||||
+#include "arch.h"
|
||||
+#include "arch-parisc.h"
|
||||
+
|
||||
+const struct arch_def arch_def_parisc = {
|
||||
+ .token = SCMP_ARCH_PARISC,
|
||||
+ .token_bpf = AUDIT_ARCH_PARISC,
|
||||
+ .size = ARCH_SIZE_32,
|
||||
+ .endian = ARCH_ENDIAN_BIG,
|
||||
+ .syscall_resolve_name = parisc_syscall_resolve_name,
|
||||
+ .syscall_resolve_num = parisc_syscall_resolve_num,
|
||||
+ .syscall_rewrite = NULL,
|
||||
+ .rule_add = NULL,
|
||||
+};
|
||||
Index: libseccomp/src/arch-parisc.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ libseccomp/src/arch-parisc.h 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -0,0 +1,38 @@
|
||||
+/**
|
||||
+ * Enhanced Seccomp PARISC Specific Code
|
||||
+ *
|
||||
+ * Copyright (c) 2016 Helge Deller <deller@gmx.de>
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * 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_PARISC_H
|
||||
+#define _ARCH_PARISC_H
|
||||
+
|
||||
+#include <inttypes.h>
|
||||
+
|
||||
+#include "arch.h"
|
||||
+#include "system.h"
|
||||
+
|
||||
+extern const struct arch_def arch_def_parisc;
|
||||
+extern const struct arch_def arch_def_parisc64;
|
||||
+
|
||||
+int parisc_syscall_resolve_name(const char *name);
|
||||
+const char *parisc_syscall_resolve_num(int num);
|
||||
+
|
||||
+const struct arch_syscall_def *parisc_syscall_iterate(unsigned int spot);
|
||||
+
|
||||
+#endif
|
||||
Index: libseccomp/src/arch-parisc64.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ libseccomp/src/arch-parisc64.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -0,0 +1,22 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2016 Helge Deller <deller@gmx.de>
|
||||
+ * Author: Helge Deller <deller@gmx.de>
|
||||
+*/
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/audit.h>
|
||||
+
|
||||
+#include "arch.h"
|
||||
+#include "arch-parisc.h"
|
||||
+
|
||||
+const struct arch_def arch_def_parisc64 = {
|
||||
+ .token = SCMP_ARCH_PARISC64,
|
||||
+ .token_bpf = AUDIT_ARCH_PARISC64,
|
||||
+ .size = ARCH_SIZE_64,
|
||||
+ .endian = ARCH_ENDIAN_BIG,
|
||||
+ .syscall_resolve_name = parisc_syscall_resolve_name,
|
||||
+ .syscall_resolve_num = parisc_syscall_resolve_num,
|
||||
+ .syscall_rewrite = NULL,
|
||||
+ .rule_add = NULL,
|
||||
+};
|
||||
Index: libseccomp/src/arch-syscall-check.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/arch-syscall-check.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/arch-syscall-check.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "arch-mips.h"
|
||||
#include "arch-mips64.h"
|
||||
#include "arch-mips64n32.h"
|
||||
+#include "arch-parisc.h"
|
||||
#include "arch-ppc.h"
|
||||
#include "arch-ppc64.h"
|
||||
#include "arch-s390.h"
|
||||
@@ -71,6 +72,7 @@
|
||||
int i_mips = 0;
|
||||
int i_mips64 = 0;
|
||||
int i_mips64n32 = 0;
|
||||
+ int i_parisc = 0;
|
||||
int i_ppc = 0;
|
||||
int i_ppc64 = 0;
|
||||
int i_s390 = 0;
|
||||
@@ -101,6 +103,8 @@
|
||||
mips64_syscall_iterate(i_mips64));
|
||||
syscall_check(str_miss, sys_name, "mips64n32",
|
||||
mips64n32_syscall_iterate(i_mips64n32));
|
||||
+ syscall_check(str_miss, sys_name, "parisc",
|
||||
+ parisc_syscall_iterate(i_parisc));
|
||||
syscall_check(str_miss, sys_name, "ppc",
|
||||
ppc_syscall_iterate(i_ppc));
|
||||
syscall_check(str_miss, sys_name, "ppc64",
|
||||
@@ -135,6 +139,8 @@
|
||||
i_mips64 = -1;
|
||||
if (!mips64n32_syscall_iterate(++i_mips64n32)->name)
|
||||
i_mips64n32 = -1;
|
||||
+ if (!parisc_syscall_iterate(++i_parisc)->name)
|
||||
+ i_parisc = -1;
|
||||
if (!ppc_syscall_iterate(++i_ppc)->name)
|
||||
i_ppc = -1;
|
||||
if (!ppc64_syscall_iterate(++i_ppc64)->name)
|
||||
@@ -146,6 +152,7 @@
|
||||
} while (i_x86_64 >= 0 && i_x32 >= 0 &&
|
||||
i_arm >= 0 && i_aarch64 >= 0 &&
|
||||
i_mips >= 0 && i_mips64 >= 0 && i_mips64n32 >= 0 &&
|
||||
+ i_parisc >= 0 &&
|
||||
i_ppc >= 0 && i_ppc64 >= 0 &&
|
||||
i_s390 >= 0 && i_s390x >= 0);
|
||||
|
||||
@@ -190,6 +197,10 @@
|
||||
printf("ERROR, mips64n32 has additional syscalls\n");
|
||||
return 1;
|
||||
}
|
||||
+ if (i_parisc >= 0) {
|
||||
+ printf("ERROR, parisc has additional syscalls\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
if (i_ppc >= 0) {
|
||||
printf("ERROR, ppc has additional syscalls\n");
|
||||
return 1;
|
||||
Index: libseccomp/src/arch-syscall-dump.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/arch-syscall-dump.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/arch-syscall-dump.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "arch-mips64.h"
|
||||
#include "arch-mips64n32.h"
|
||||
#include "arch-aarch64.h"
|
||||
+#include "arch-parisc.h"
|
||||
#include "arch-ppc.h"
|
||||
#include "arch-ppc64.h"
|
||||
#include "arch-s390.h"
|
||||
@@ -116,6 +117,10 @@
|
||||
case SCMP_ARCH_MIPSEL64N32:
|
||||
sys = mips64n32_syscall_iterate(iter);
|
||||
break;
|
||||
+ case SCMP_ARCH_PARISC:
|
||||
+ case SCMP_ARCH_PARISC64:
|
||||
+ sys = parisc_syscall_iterate(iter);
|
||||
+ break;
|
||||
case SCMP_ARCH_PPC:
|
||||
sys = ppc_syscall_iterate(iter);
|
||||
break;
|
||||
Index: libseccomp/src/arch.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/arch.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/arch.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "arch-mips.h"
|
||||
#include "arch-mips64.h"
|
||||
#include "arch-mips64n32.h"
|
||||
+#include "arch-parisc.h"
|
||||
#include "arch-ppc.h"
|
||||
#include "arch-ppc64.h"
|
||||
#include "arch-s390.h"
|
||||
@@ -79,6 +80,10 @@
|
||||
#elif __MIPSEL__
|
||||
const struct arch_def *arch_def_native = &arch_def_mipsel64n32;
|
||||
#endif /* _MIPS_SIM_NABI32 */
|
||||
+#elif __hppa64__ /* hppa64 must be checked before hppa */
|
||||
+const struct arch_def *arch_def_native = &arch_def_parisc64;
|
||||
+#elif __hppa__
|
||||
+const struct arch_def *arch_def_native = &arch_def_parisc;
|
||||
#elif __PPC64__
|
||||
#ifdef __BIG_ENDIAN__
|
||||
const struct arch_def *arch_def_native = &arch_def_ppc64;
|
||||
@@ -139,6 +144,10 @@
|
||||
return &arch_def_mips64n32;
|
||||
case SCMP_ARCH_MIPSEL64N32:
|
||||
return &arch_def_mipsel64n32;
|
||||
+ case SCMP_ARCH_PARISC:
|
||||
+ return &arch_def_parisc;
|
||||
+ case SCMP_ARCH_PARISC64:
|
||||
+ return &arch_def_parisc64;
|
||||
case SCMP_ARCH_PPC:
|
||||
return &arch_def_ppc;
|
||||
case SCMP_ARCH_PPC64:
|
||||
@@ -185,6 +194,10 @@
|
||||
return &arch_def_mips64n32;
|
||||
else if (strcmp(arch_name, "mipsel64n32") == 0)
|
||||
return &arch_def_mipsel64n32;
|
||||
+ else if (strcmp(arch_name, "parisc64") == 0)
|
||||
+ return &arch_def_parisc64;
|
||||
+ else if (strcmp(arch_name, "parisc") == 0)
|
||||
+ return &arch_def_parisc;
|
||||
else if (strcmp(arch_name, "ppc") == 0)
|
||||
return &arch_def_ppc;
|
||||
else if (strcmp(arch_name, "ppc64") == 0)
|
||||
Index: libseccomp/src/gen_pfc.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/gen_pfc.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/gen_pfc.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -71,6 +71,10 @@
|
||||
return "mips64n32";
|
||||
case SCMP_ARCH_MIPSEL64N32:
|
||||
return "mipsel64n32";
|
||||
+ case SCMP_ARCH_PARISC:
|
||||
+ return "parisc";
|
||||
+ case SCMP_ARCH_PARISC64:
|
||||
+ return "parisc64";
|
||||
case SCMP_ARCH_PPC64:
|
||||
return "ppc64";
|
||||
case SCMP_ARCH_PPC64LE:
|
||||
Index: libseccomp/src/python/libseccomp.pxd
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/python/libseccomp.pxd 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/python/libseccomp.pxd 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -43,6 +43,8 @@
|
||||
SCMP_ARCH_MIPSEL
|
||||
SCMP_ARCH_MIPSEL64
|
||||
SCMP_ARCH_MIPSEL64N32
|
||||
+ SCMP_ARCH_PARISC
|
||||
+ SCMP_ARCH_PARISC64
|
||||
SCMP_ARCH_PPC
|
||||
SCMP_ARCH_PPC64
|
||||
SCMP_ARCH_PPC64LE
|
||||
Index: libseccomp/src/python/seccomp.pyx
|
||||
===================================================================
|
||||
--- libseccomp.orig/src/python/seccomp.pyx 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/src/python/seccomp.pyx 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -147,6 +147,8 @@
|
||||
MIPSEL - MIPS little endian O32 ABI
|
||||
MIPSEL64 - MIPS little endian 64-bit ABI
|
||||
MIPSEL64N32 - MIPS little endian N32 ABI
|
||||
+ PARISC - 32-bit PA-RISC
|
||||
+ PARISC64 - 64-bit PA-RISC
|
||||
PPC64 - 64-bit PowerPC
|
||||
PPC - 32-bit PowerPC
|
||||
"""
|
||||
@@ -165,6 +167,8 @@
|
||||
MIPSEL = libseccomp.SCMP_ARCH_MIPSEL
|
||||
MIPSEL64 = libseccomp.SCMP_ARCH_MIPSEL64
|
||||
MIPSEL64N32 = libseccomp.SCMP_ARCH_MIPSEL64N32
|
||||
+ PARISC = libseccomp.SCMP_ARCH_PARISC
|
||||
+ PARISC64 = libseccomp.SCMP_ARCH_PARISC64
|
||||
PPC = libseccomp.SCMP_ARCH_PPC
|
||||
PPC64 = libseccomp.SCMP_ARCH_PPC64
|
||||
PPC64LE = libseccomp.SCMP_ARCH_PPC64LE
|
||||
@@ -205,6 +209,10 @@
|
||||
self._token = libseccomp.SCMP_ARCH_MIPSEL64
|
||||
elif arch == libseccomp.SCMP_ARCH_MIPSEL64N32:
|
||||
self._token = libseccomp.SCMP_ARCH_MIPSEL64N32
|
||||
+ elif arch == libseccomp.SCMP_ARCH_PARISC:
|
||||
+ self._token = libseccomp.SCMP_ARCH_PARISC
|
||||
+ elif arch == libseccomp.SCMP_ARCH_PARISC64:
|
||||
+ self._token = libseccomp.SCMP_ARCH_PARISC64
|
||||
elif arch == libseccomp.SCMP_ARCH_PPC:
|
||||
self._token = libseccomp.SCMP_ARCH_PPC
|
||||
elif arch == libseccomp.SCMP_ARCH_PPC64:
|
||||
Index: libseccomp/tests/26-sim-arch_all_be_basic.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/tests/26-sim-arch_all_be_basic.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tests/26-sim-arch_all_be_basic.c 2016-05-28 19:57:02.042592678 +0200
|
||||
@@ -52,6 +52,12 @@
|
||||
rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("mips64n32"));
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
+ rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("parisc"));
|
||||
+ if (rc != 0)
|
||||
+ goto out;
|
||||
+ rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("parisc64"));
|
||||
+ if (rc != 0)
|
||||
+ goto out;
|
||||
rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("ppc"));
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
Index: libseccomp/tests/26-sim-arch_all_be_basic.py
|
||||
===================================================================
|
||||
--- libseccomp.orig/tests/26-sim-arch_all_be_basic.py 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tests/26-sim-arch_all_be_basic.py 2016-05-28 19:57:02.046592702 +0200
|
||||
@@ -33,6 +33,8 @@
|
||||
f.add_arch(Arch("mips"))
|
||||
f.add_arch(Arch("mips64"))
|
||||
f.add_arch(Arch("mips64n32"))
|
||||
+ f.add_arch(Arch("parisc"))
|
||||
+ f.add_arch(Arch("parisc64"))
|
||||
f.add_arch(Arch("ppc"))
|
||||
f.add_arch(Arch("ppc64"))
|
||||
f.add_arch(Arch("s390"))
|
||||
Index: libseccomp/tests/regression
|
||||
===================================================================
|
||||
--- libseccomp.orig/tests/regression 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tests/regression 2016-05-28 19:57:02.046592702 +0200
|
||||
@@ -28,6 +28,7 @@
|
||||
ppc64le"
|
||||
GLBL_ARCH_BE_SUPPORT=" \
|
||||
mips mips64 mips64n32 \
|
||||
+ parisc parisc64 \
|
||||
ppc ppc64 \
|
||||
s390 s390x"
|
||||
|
||||
@@ -701,7 +702,7 @@
|
||||
|
||||
# setup the arch specific return values
|
||||
case "$arch" in
|
||||
- x86|x86_64|x32|arm|aarch64|ppc|ppc64|ppc64le|ppc|s390|s390x)
|
||||
+ x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x)
|
||||
rc_kill=159
|
||||
rc_allow=160
|
||||
rc_trap=161
|
||||
Index: libseccomp/tools/scmp_arch_detect.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/tools/scmp_arch_detect.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tools/scmp_arch_detect.c 2016-05-28 19:57:02.046592702 +0200
|
||||
@@ -99,6 +99,12 @@
|
||||
case SCMP_ARCH_MIPSEL64N32:
|
||||
printf("mipsel64n32\n");
|
||||
break;
|
||||
+ case SCMP_ARCH_PARISC:
|
||||
+ printf("parisc\n");
|
||||
+ break;
|
||||
+ case SCMP_ARCH_PARISC64:
|
||||
+ printf("parisc64\n");
|
||||
+ break;
|
||||
case SCMP_ARCH_PPC:
|
||||
printf("ppc\n");
|
||||
break;
|
||||
Index: libseccomp/tools/scmp_bpf_sim.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/tools/scmp_bpf_sim.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tools/scmp_bpf_sim.c 2016-05-28 19:57:02.046592702 +0200
|
||||
@@ -265,6 +265,10 @@
|
||||
arch = AUDIT_ARCH_MIPS64N32;
|
||||
else if (strcmp(optarg, "mipsel64n32") == 0)
|
||||
arch = AUDIT_ARCH_MIPSEL64N32;
|
||||
+ else if (strcmp(optarg, "parisc") == 0)
|
||||
+ arch = AUDIT_ARCH_PARISC;
|
||||
+ else if (strcmp(optarg, "parisc64") == 0)
|
||||
+ arch = AUDIT_ARCH_PARISC64;
|
||||
else if (strcmp(optarg, "ppc") == 0)
|
||||
arch = AUDIT_ARCH_PPC;
|
||||
else if (strcmp(optarg, "ppc64") == 0)
|
||||
Index: libseccomp/tools/util.c
|
||||
===================================================================
|
||||
--- libseccomp.orig/tools/util.c 2016-05-28 19:57:02.050592727 +0200
|
||||
+++ libseccomp/tools/util.c 2016-05-28 19:57:02.046592702 +0200
|
||||
@@ -62,6 +62,10 @@
|
||||
#elif __MIPSEL__
|
||||
#define ARCH_NATIVE AUDIT_ARCH_MIPSEL64N32
|
||||
#endif /* _MIPS_SIM_NABI32 */
|
||||
+#elif __hppa64__
|
||||
+#define ARCH_NATIVE AUDIT_ARCH_PARISC64
|
||||
+#elif __hppa__
|
||||
+#define ARCH_NATIVE AUDIT_ARCH_PARISC
|
||||
#elif __PPC64__
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#define ARCH_NATIVE AUDIT_ARCH_PPC64
|
||||
@@ -0,0 +1,40 @@
|
||||
Description: update syscalls for Linux 4.9
|
||||
Origin: cherry-picked parts from d9102f12fd39bd77151a1f630fcfc8c80f86c55c
|
||||
|
||||
diff --git a/src/arch-parisc-syscalls.c b/src/arch-parisc-syscalls.c
|
||||
index ad50820..4690577 100644
|
||||
--- a/src/arch-parisc-syscalls.c
|
||||
+++ b/src/arch-parisc-syscalls.c
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "arch.h"
|
||||
#include "arch-parisc.h"
|
||||
|
||||
-/* NOTE: based on Linux 4.5-rc4 */
|
||||
+/* NOTE: based on Linux 4.9 */
|
||||
const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "_llseek", 140 },
|
||||
{ "_newselect", 142 },
|
||||
@@ -238,11 +238,15 @@ const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "pipe", 42 },
|
||||
{ "pipe2", 313 },
|
||||
{ "pivot_root", 67 },
|
||||
+ { "pkey_alloc", __PNR_pkey_alloc },
|
||||
+ { "pkey_free", __PNR_pkey_free },
|
||||
+ { "pkey_mprotect", __PNR_pkey_mprotect },
|
||||
{ "poll", 168 },
|
||||
{ "ppoll", 274 },
|
||||
{ "prctl", 172 },
|
||||
{ "pread64", 108 },
|
||||
{ "preadv", 315 },
|
||||
+ { "preadv2", 347 },
|
||||
{ "prlimit64", 321 },
|
||||
{ "process_vm_readv", 330 },
|
||||
{ "process_vm_writev", 331 },
|
||||
@@ -253,6 +257,7 @@ const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "putpmsg", 197 },
|
||||
{ "pwrite64", 109 },
|
||||
{ "pwritev", 316 },
|
||||
+ { "pwritev2", 348 },
|
||||
{ "query_module", 167 },
|
||||
{ "quotactl", 131 },
|
||||
{ "read", 3 },
|
||||
@@ -0,0 +1,22 @@
|
||||
Description: arch: add the statx syscall
|
||||
Origin: cherry-picked parts from 4793ea990ea80ee26ed63e2a20723fdb417abf5b
|
||||
|
||||
--- a/src/arch-parisc-syscalls.c
|
||||
+++ b/src/arch-parisc-syscalls.c
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "arch.h"
|
||||
#include "arch-parisc.h"
|
||||
|
||||
-/* NOTE: based on Linux 4.9 */
|
||||
+/* NOTE: based on Linux 4.14 */
|
||||
const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "_llseek", 140 },
|
||||
{ "_newselect", 142 },
|
||||
@@ -376,6 +376,7 @@ const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "stat64", 101 },
|
||||
{ "statfs", 99 },
|
||||
{ "statfs64", 298 },
|
||||
+ { "statx", 349 },
|
||||
{ "stime", 25 },
|
||||
{ "stty", __PNR_stty },
|
||||
{ "subpage_prot", __PNR_subpage_prot },
|
||||
@@ -0,0 +1,34 @@
|
||||
Description: arch: update the syscalls for Linux v4.15-rc7
|
||||
Origin: cherry-picked parts from c842c2f6c203ad9da37ca60219172aa0be68d26a
|
||||
|
||||
--- a/src/arch-parisc-syscalls.c
|
||||
+++ b/src/arch-parisc-syscalls.c
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "arch.h"
|
||||
#include "arch-parisc.h"
|
||||
|
||||
-/* NOTE: based on Linux 4.14 */
|
||||
+/* NOTE: based on Linux 4.15-rc7 */
|
||||
const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "_llseek", 140 },
|
||||
{ "_newselect", 142 },
|
||||
@@ -106,6 +106,7 @@ const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "get_mempolicy", 261 },
|
||||
{ "get_robust_list", 290 },
|
||||
{ "get_thread_area", 214 },
|
||||
+ { "get_tls", __PNR_get_tls },
|
||||
{ "getcpu", 296 },
|
||||
{ "getcwd", 110 },
|
||||
{ "getdents", 141 },
|
||||
@@ -288,9 +289,11 @@ const struct arch_syscall_def parisc_syscall_table[] = { \
|
||||
{ "rt_sigtimedwait", 177 },
|
||||
{ "rt_tgsigqueueinfo", 317 },
|
||||
{ "rtas", __PNR_rtas },
|
||||
+ { "s390_guarded_storage", __PNR_s390_guarded_storage },
|
||||
{ "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 },
|
||||
+ { "s390_sthyi", __PNR_s390_sthyi },
|
||||
{ "sched_get_priority_max", 159 },
|
||||
{ "sched_get_priority_min", 160 },
|
||||
{ "sched_getaffinity", 212 },
|
||||
@@ -0,0 +1,927 @@
|
||||
Description: <short summary of the patch>
|
||||
TODO: Put a short summary on the line above and replace this paragraph
|
||||
with a longer explanation of this change. Complete the meta-information
|
||||
with other relevant fields (see below for details). To make it easier, the
|
||||
information below has been extracted from the changelog. Adjust it or drop
|
||||
it.
|
||||
.
|
||||
libseccomp (2.3.3-4.lnd.1) unstable; urgency=medium
|
||||
.
|
||||
* add loongarch64 support
|
||||
* add-loongarch64-support.patch
|
||||
.
|
||||
-- heyanbing <heyanbing@loongson.cn> Wed Aug 26 15:35:27 CST 2020
|
||||
|
||||
---
|
||||
The information above should follow the Patch Tagging Guidelines, please
|
||||
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
|
||||
are templates for supplementary fields that you might want to add:
|
||||
|
||||
Origin: <vendor|upstream|other>, <url of original patch>
|
||||
Bug: <url in upstream bugtracker>
|
||||
Bug-Debian: https://bugs.debian.org/<bugnumber>
|
||||
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
|
||||
Forwarded: <no|not-needed|url proving that it has been forwarded>
|
||||
Reviewed-By: <name and email of someone who approved the patch>
|
||||
Last-Update: 2020-09-11
|
||||
|
||||
--- libseccomp-2.3.3.orig/include/seccomp.h.in
|
||||
+++ libseccomp-2.3.3/include/seccomp.h.in
|
||||
@@ -138,6 +138,19 @@ struct scmp_arg_cmp {
|
||||
#define SCMP_ARCH_AARCH64 AUDIT_ARCH_AARCH64
|
||||
|
||||
/**
|
||||
+ * The loongarch architecture tokens.
|
||||
+ *
|
||||
+ * loongarch support for audit is not ready yet.
|
||||
+ **/
|
||||
+#ifndef AUDIT_ARCH_LOONGARCH64
|
||||
+#ifndef EM_LOONGARCH
|
||||
+#define EM_LOONGARCH 258
|
||||
+#endif /* EM_LOONGARCH64 */
|
||||
+#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
+#endif /* AUDIT_ARCH_LOONGARCH64 */
|
||||
+#define SCMP_ARCH_LOONGARCH64 AUDIT_ARCH_LOONGARCH64
|
||||
+
|
||||
+/**
|
||||
* The MIPS architecture tokens
|
||||
*/
|
||||
#ifndef __AUDIT_ARCH_CONVENTION_MIPS64_N32
|
||||
@@ -1644,6 +1657,12 @@ int seccomp_export_bpf(const scmp_filter
|
||||
#define __NR_s390_sthyi __PNR_s390_sthyi
|
||||
#endif /* __NR_s390_sthyi */
|
||||
|
||||
+#define __PNR_renameat -10207
|
||||
+#ifndef __NR_renameat
|
||||
+#define __NR_renameat __PNR_renameat
|
||||
+#endif /* __NR_renameat */
|
||||
+
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
--- libseccomp-2.3.3.orig/src/Makefile.am
|
||||
+++ libseccomp-2.3.3/src/Makefile.am
|
||||
@@ -39,6 +39,7 @@ SOURCES_ALL = \
|
||||
arch-parisc64.h arch-parisc64.c \
|
||||
arch-ppc.h arch-ppc.c arch-ppc-syscalls.c \
|
||||
arch-ppc64.h arch-ppc64.c arch-ppc64-syscalls.c \
|
||||
+ arch-loongarch64.h arch-loongarch64.c arch-loongarch64-syscalls.c \
|
||||
arch-s390.h arch-s390.c arch-s390-syscalls.c \
|
||||
arch-s390x.h arch-s390x.c arch-s390x-syscalls.c
|
||||
|
||||
--- /dev/null
|
||||
+++ libseccomp-2.3.3/src/arch-loongarch64-syscalls.c
|
||||
@@ -0,0 +1,527 @@
|
||||
+/**
|
||||
+ * Enhanced Seccomp AArch64 Syscall Table
|
||||
+ *
|
||||
+ * Copyright (c) 2018 Icenowy Zheng <icenowy@aosc.io>
|
||||
+ *
|
||||
+ * Based on arch-aarch64-syscalls.c, which is:
|
||||
+ * Copyright (c) 2014 Red Hat
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * 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-loongarch64.h"
|
||||
+
|
||||
+/* NOTE: based on Linux 4.15 */
|
||||
+const struct arch_syscall_def loongarch64_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 },
|
||||
+ { "get_tls", __PNR_get_tls },
|
||||
+ { "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 },
|
||||
+ { "pkey_alloc", 289 },
|
||||
+ { "pkey_free", 290 },
|
||||
+ { "pkey_mprotect", 288 },
|
||||
+ { "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", __PNR_renameat },
|
||||
+ { "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_guarded_storage", __PNR_s390_guarded_storage },
|
||||
+ { "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 },
|
||||
+ { "s390_sthyi", __PNR_s390_sthyi },
|
||||
+ { "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 },
|
||||
+ { "statx", 291 },
|
||||
+ { "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 loongarch64_syscall_resolve_name(const char *name)
|
||||
+{
|
||||
+ unsigned int iter;
|
||||
+ const struct arch_syscall_def *table = loongarch64_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 *loongarch64_syscall_resolve_num(int num)
|
||||
+{
|
||||
+ unsigned int iter;
|
||||
+ const struct arch_syscall_def *table = loongarch64_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 mapping
|
||||
+ * @param spot the offset into the syscall table
|
||||
+ *
|
||||
+ * Return the syscall mapping at position @spot or NULL on failure. This
|
||||
+ * function should only ever be used internally by libseccomp.
|
||||
+ *
|
||||
+ */
|
||||
+const struct arch_syscall_def *loongarch64_syscall_iterate(unsigned int spot)
|
||||
+{
|
||||
+ /* XXX - no safety checks here */
|
||||
+ return &loongarch64_syscall_table[spot];
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ libseccomp-2.3.3/src/arch-loongarch64.c
|
||||
@@ -0,0 +1,37 @@
|
||||
+/**
|
||||
+ * Enhanced Seccomp MIPS64 Specific Code
|
||||
+ *
|
||||
+ * Copyright (c) 2014 Red Hat <pmoore@redhat.com>
|
||||
+ * Author: Paul Moore <paul@paul-moore.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-loongarch64.h"
|
||||
+
|
||||
+const struct arch_def arch_def_loongarch64 = {
|
||||
+ .token = SCMP_ARCH_LOONGARCH64,
|
||||
+ .token_bpf = AUDIT_ARCH_LOONGARCH64,
|
||||
+ .size = ARCH_SIZE_64,
|
||||
+ .endian = ARCH_ENDIAN_LITTLE,
|
||||
+ .syscall_resolve_name = loongarch64_syscall_resolve_name,
|
||||
+ .syscall_resolve_num = loongarch64_syscall_resolve_num,
|
||||
+ .syscall_rewrite = NULL,
|
||||
+ .rule_add = NULL,
|
||||
+};
|
||||
--- /dev/null
|
||||
+++ libseccomp-2.3.3/src/arch-loongarch64.h
|
||||
@@ -0,0 +1,38 @@
|
||||
+/**
|
||||
+ * Enhanced Seccomp MIPS64 Specific Code
|
||||
+ *
|
||||
+ * Copyright (c) 2014 Red Hat <pmoore@redhat.com>
|
||||
+ * Author: Paul Moore <paul@paul-moore.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_LOONGARCH64_H
|
||||
+#define _ARCH_LOONGARCH64_H
|
||||
+
|
||||
+#include <inttypes.h>
|
||||
+
|
||||
+#include "arch.h"
|
||||
+#include "system.h"
|
||||
+
|
||||
+extern const struct arch_def arch_def_loongarch64;
|
||||
+
|
||||
+int loongarch64_syscall_resolve_name(const char *name);
|
||||
+const char *loongarch64_syscall_resolve_num(int num);
|
||||
+
|
||||
+const struct arch_syscall_def *loongarch64_syscall_iterate(unsigned int spot);
|
||||
+
|
||||
+#endif
|
||||
--- libseccomp-2.3.3.orig/src/arch-syscall-check.c
|
||||
+++ libseccomp-2.3.3/src/arch-syscall-check.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "arch-parisc.h"
|
||||
#include "arch-ppc.h"
|
||||
#include "arch-ppc64.h"
|
||||
+#include "arch-loongarch64.h"
|
||||
#include "arch-s390.h"
|
||||
#include "arch-s390x.h"
|
||||
|
||||
@@ -75,6 +76,7 @@ int main(int argc, char *argv[])
|
||||
int i_parisc = 0;
|
||||
int i_ppc = 0;
|
||||
int i_ppc64 = 0;
|
||||
+ int i_loongarch64 = 0;
|
||||
int i_s390 = 0;
|
||||
int i_s390x = 0;
|
||||
char str_miss[256];
|
||||
@@ -111,6 +113,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, "loongarch64",
|
||||
+ loongarch64_syscall_iterate(i_loongarch64));
|
||||
syscall_check(str_miss, sys_name, "s390",
|
||||
s390_syscall_iterate(i_s390));
|
||||
syscall_check(str_miss, sys_name, "s390x",
|
||||
@@ -147,6 +151,8 @@ int main(int argc, char *argv[])
|
||||
i_ppc = -1;
|
||||
if (!ppc64_syscall_iterate(++i_ppc64)->name)
|
||||
i_ppc64 = -1;
|
||||
+ if (!loongarch64_syscall_iterate(++i_loongarch64)->name)
|
||||
+ i_loongarch64 = -1;
|
||||
if (!s390_syscall_iterate(++i_s390)->name)
|
||||
i_s390 = -1;
|
||||
if (!s390x_syscall_iterate(++i_s390x)->name)
|
||||
@@ -156,6 +162,7 @@ int main(int argc, char *argv[])
|
||||
i_mips >= 0 && i_mips64 >= 0 && i_mips64n32 >= 0 &&
|
||||
i_parisc >= 0 &&
|
||||
i_ppc >= 0 && i_ppc64 >= 0 &&
|
||||
+ i_loongarch64 >= 0 &&
|
||||
i_s390 >= 0 && i_s390x >= 0);
|
||||
|
||||
/* check for any leftovers */
|
||||
@@ -204,6 +211,10 @@ int main(int argc, char *argv[])
|
||||
printf("ERROR, ppc64 has additional syscalls\n");
|
||||
return 1;
|
||||
}
|
||||
+ if (i_loongarch64 >= 0) {
|
||||
+ printf("ERROR, loongarch64 has additional syscalls\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
if (i_s390 >= 0) {
|
||||
printf("ERROR, s390 has additional syscalls\n");
|
||||
return 1;
|
||||
--- libseccomp-2.3.3.orig/src/arch-syscall-validate
|
||||
+++ libseccomp-2.3.3/src/arch-syscall-validate
|
||||
@@ -377,6 +377,47 @@ function dump_lib_ppc64() {
|
||||
}
|
||||
|
||||
#
|
||||
+# Dump the loongarch64 system syscall table
|
||||
+#
|
||||
+# Arguments:
|
||||
+# 1 path to the kernel source
|
||||
+#
|
||||
+# Dump the architecture's syscall table to stdout.
|
||||
+#
|
||||
+function dump_sys_loongarch64() {
|
||||
+ gcc -E -dM -I$1/include/uapi \
|
||||
+ -D__BITS_PER_LONG=64 -D__ARCH_WANT_RENAMEAT \
|
||||
+ $1/include/uapi/asm-generic/unistd.h | \
|
||||
+ grep "^#define __NR_" | \
|
||||
+ 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_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_lstat/1039/' | \
|
||||
+ sed -e 's/__NR3264_stat/1038/' | \
|
||||
+ sort
|
||||
+}
|
||||
+
|
||||
+#
|
||||
+# Dump the loongarch64 library syscall table
|
||||
+#
|
||||
+# Dump the library's syscall table to stdout.
|
||||
+#
|
||||
+function dump_lib_loongarch64() {
|
||||
+ dump_lib_arch riscv64
|
||||
+}
|
||||
+
|
||||
+#
|
||||
# Dump the s390 system syscall table
|
||||
#
|
||||
# Arguments:
|
||||
@@ -477,6 +518,9 @@ function dump_sys() {
|
||||
ppc64)
|
||||
dump_sys_ppc64 "$2"
|
||||
;;
|
||||
+ loongarch64)
|
||||
+ dump_sys_loongarch64 "$2"
|
||||
+ ;;
|
||||
s390)
|
||||
dump_sys_s390 "$2"
|
||||
;;
|
||||
@@ -532,6 +576,9 @@ function dump_lib() {
|
||||
ppc64)
|
||||
dump_lib_ppc64 "$2"
|
||||
;;
|
||||
+ loongarch64)
|
||||
+ dump_lib_loongarch64 "$2"
|
||||
+ ;;
|
||||
s390)
|
||||
dump_lib_s390 "$2"
|
||||
;;
|
||||
--- libseccomp-2.3.3.orig/src/arch.c
|
||||
+++ libseccomp-2.3.3/src/arch.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "arch-parisc.h"
|
||||
#include "arch-ppc.h"
|
||||
#include "arch-ppc64.h"
|
||||
+#include "arch-loongarch64.h"
|
||||
#include "arch-s390.h"
|
||||
#include "arch-s390x.h"
|
||||
#include "db.h"
|
||||
@@ -90,6 +91,8 @@ const struct arch_def *arch_def_native =
|
||||
#endif
|
||||
#elif __PPC__
|
||||
const struct arch_def *arch_def_native = &arch_def_ppc;
|
||||
+#elif __loongarch__
|
||||
+const struct arch_def *arch_def_native = &arch_def_loongarch64;
|
||||
#elif __s390x__ /* s390x must be checked before s390 */
|
||||
const struct arch_def *arch_def_native = &arch_def_s390x;
|
||||
#elif __s390__
|
||||
@@ -150,6 +153,8 @@ const struct arch_def *arch_def_lookup(u
|
||||
return &arch_def_ppc;
|
||||
case SCMP_ARCH_PPC64:
|
||||
return &arch_def_ppc64;
|
||||
+ case SCMP_ARCH_LOONGARCH64:
|
||||
+ return &arch_def_loongarch64;
|
||||
case SCMP_ARCH_PPC64LE:
|
||||
return &arch_def_ppc64le;
|
||||
case SCMP_ARCH_S390:
|
||||
@@ -200,6 +205,8 @@ const struct arch_def *arch_def_lookup_n
|
||||
return &arch_def_ppc;
|
||||
else if (strcmp(arch_name, "ppc64") == 0)
|
||||
return &arch_def_ppc64;
|
||||
+ else if (strcmp(arch_name, "loongarch64") == 0)
|
||||
+ return &arch_def_loongarch64;
|
||||
else if (strcmp(arch_name, "ppc64le") == 0)
|
||||
return &arch_def_ppc64le;
|
||||
else if (strcmp(arch_name, "s390") == 0)
|
||||
--- libseccomp-2.3.3.orig/src/gen_bpf.c
|
||||
+++ libseccomp-2.3.3/src/gen_bpf.c
|
||||
@@ -1408,9 +1408,17 @@ static struct bpf_blk *_gen_bpf_arch(str
|
||||
}
|
||||
|
||||
/* do the ABI/architecture check */
|
||||
- _BPF_INSTR(instr, _BPF_OP(state->arch, BPF_JMP + BPF_JEQ),
|
||||
+
|
||||
+ /* skip ABI/architecture check on loongarch
|
||||
+ * call seccomp syscall check architecture is failed, so temporary skip check
|
||||
+ */
|
||||
+/* _BPF_INSTR(instr, _BPF_OP(state->arch, BPF_JMP + BPF_JEQ),
|
||||
_BPF_JMP_NO, _BPF_JMP_NXT(blk_cnt++),
|
||||
_BPF_K(state->arch, state->arch->token_bpf));
|
||||
+*/
|
||||
+ _BPF_INSTR(instr, _BPF_OP(state->arch, BPF_JMP + BPF_JGE),
|
||||
+ _BPF_JMP_NO, _BPF_JMP_NXT(blk_cnt++),
|
||||
+ _BPF_K(state->arch, 0));
|
||||
if (b_head != NULL)
|
||||
instr.jt = _BPF_JMP_HSH(b_head->hash);
|
||||
else
|
||||
--- libseccomp-2.3.3.orig/src/gen_pfc.c
|
||||
+++ libseccomp-2.3.3/src/gen_pfc.c
|
||||
@@ -85,6 +85,8 @@ static const char *_pfc_arch(const struc
|
||||
return "s390x";
|
||||
case SCMP_ARCH_S390:
|
||||
return "s390";
|
||||
+ case SCMP_ARCH_LOONGARCH64:
|
||||
+ return "loongarch64";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
--- libseccomp-2.3.3.orig/tools/scmp_arch_detect.c
|
||||
+++ libseccomp-2.3.3/tools/scmp_arch_detect.c
|
||||
@@ -81,6 +81,9 @@ int main(int argc, char *argv[])
|
||||
case SCMP_ARCH_AARCH64:
|
||||
printf("aarch64\n");
|
||||
break;
|
||||
+ case SCMP_ARCH_LOONGARCH64:
|
||||
+ printf("loongarch64\n");
|
||||
+ break;
|
||||
case SCMP_ARCH_MIPS:
|
||||
printf("mips\n");
|
||||
break;
|
||||
--- libseccomp-2.3.3.orig/tools/scmp_bpf_disasm.c
|
||||
+++ libseccomp-2.3.3/tools/scmp_bpf_disasm.c
|
||||
@@ -474,6 +474,8 @@ int main(int argc, char *argv[])
|
||||
arch = AUDIT_ARCH_ARM;
|
||||
else if (strcmp(optarg, "aarch64") == 0)
|
||||
arch = AUDIT_ARCH_AARCH64;
|
||||
+ else if (strcmp(optarg, "loongarch64") == 0)
|
||||
+ arch = AUDIT_ARCH_LOONGARCH64;
|
||||
else if (strcmp(optarg, "mips") == 0)
|
||||
arch = AUDIT_ARCH_MIPS;
|
||||
else if (strcmp(optarg, "mipsel") == 0)
|
||||
--- libseccomp-2.3.3.orig/tools/util.c
|
||||
+++ libseccomp-2.3.3/tools/util.c
|
||||
@@ -74,6 +74,11 @@
|
||||
#endif
|
||||
#elif __PPC__
|
||||
#define ARCH_NATIVE AUDIT_ARCH_PPC
|
||||
+#elif __loongarch
|
||||
+/* kernel audit support for loongarch is not yet ready */
|
||||
+//#define EM_RISCV 243
|
||||
+#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
+#define ARCH_NATIVE AUDIT_ARCH_LOONGARCH64
|
||||
#elif __s390x__ /* s390x must be checked before s390 */
|
||||
#define ARCH_NATIVE AUDIT_ARCH_S390X
|
||||
#elif __s390__
|
||||
--- libseccomp-2.3.3.orig/tools/util.h
|
||||
+++ libseccomp-2.3.3/tools/util.h
|
||||
@@ -72,6 +72,10 @@
|
||||
#define AUDIT_ARCH_PPC64LE (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
#endif
|
||||
|
||||
+#ifndef AUDIT_ARCH_LOONGARCH64
|
||||
+#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
+#endif
|
||||
+
|
||||
extern uint32_t arch;
|
||||
|
||||
uint16_t ttoh16(uint32_t arch, uint16_t val);
|
||||
@@ -0,0 +1,190 @@
|
||||
Description: <short summary of the patch>
|
||||
.
|
||||
libseccomp (2.3.3-4.lnd.2) unstable; urgency=medium
|
||||
.
|
||||
* add loongarch64 support
|
||||
.
|
||||
-- heyanbing <heyanbing@loongson.cn> Wed Aug 26 15:35:27 CST 2020
|
||||
|
||||
---
|
||||
|
||||
Origin: <vendor|upstream|other>, <url of original patch>
|
||||
Bug: <url in upstream bugtracker>
|
||||
Bug-Debian: https://bugs.debian.org/<bugnumber>
|
||||
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
|
||||
Forwarded: <no|not-needed|url proving that it has been forwarded>
|
||||
Reviewed-By: <name and email of someone who approved the patch>
|
||||
Last-Update: 2022-03-25
|
||||
|
||||
--- libseccomp-2.3.3.orig/src/arch-syscall-dump.c
|
||||
+++ libseccomp-2.3.3/src/arch-syscall-dump.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "arch-ppc64.h"
|
||||
#include "arch-s390.h"
|
||||
#include "arch-s390x.h"
|
||||
+#include "arch-loongarch64.h"
|
||||
|
||||
/**
|
||||
* Print the usage information to stderr and exit
|
||||
@@ -133,6 +134,9 @@ int main(int argc, char *argv[])
|
||||
case SCMP_ARCH_S390X:
|
||||
sys = s390x_syscall_iterate(iter);
|
||||
break;
|
||||
+ case SCMP_ARCH_LOONGARCH64:
|
||||
+ sys = loongarch64_syscall_iterate(iter);
|
||||
+ break;
|
||||
default:
|
||||
/* invalid arch */
|
||||
exit_usage(argv[0]);
|
||||
--- libseccomp-2.3.3.orig/src/arch-syscall-validate
|
||||
+++ libseccomp-2.3.3/src/arch-syscall-validate
|
||||
@@ -414,7 +414,7 @@ function dump_sys_loongarch64() {
|
||||
# Dump the library's syscall table to stdout.
|
||||
#
|
||||
function dump_lib_loongarch64() {
|
||||
- dump_lib_arch riscv64
|
||||
+ dump_lib_arch loongarch64
|
||||
}
|
||||
|
||||
#
|
||||
@@ -637,6 +637,7 @@ if [[ $opt_arches == "" ]]; then
|
||||
opt_arches=" \
|
||||
x86 x86_64 x32 \
|
||||
arm aarch64 \
|
||||
+ loongarch64 \
|
||||
mips mips64 mips64n32 \
|
||||
ppc ppc64 \
|
||||
s390 s390x"
|
||||
--- libseccomp-2.3.3.orig/src/python/seccomp.pyx
|
||||
+++ libseccomp-2.3.3/src/python/seccomp.pyx
|
||||
@@ -160,6 +160,7 @@ cdef class Arch:
|
||||
X32 - 64-bit x86 using the x32 ABI
|
||||
ARM - ARM
|
||||
AARCH64 - 64-bit ARM
|
||||
+ LOONGARCH64 - 64-bit LOONGARCH
|
||||
MIPS - MIPS O32 ABI
|
||||
MIPS64 - MIPS 64-bit ABI
|
||||
MIPS64N32 - MIPS N32 ABI
|
||||
@@ -180,6 +181,7 @@ cdef class Arch:
|
||||
X32 = libseccomp.SCMP_ARCH_X32
|
||||
ARM = libseccomp.SCMP_ARCH_ARM
|
||||
AARCH64 = libseccomp.SCMP_ARCH_AARCH64
|
||||
+ LOONGARCH64 = libseccomp.SCMP_ARCH_LOONGARCH64
|
||||
MIPS = libseccomp.SCMP_ARCH_MIPS
|
||||
MIPS64 = libseccomp.SCMP_ARCH_MIPS64
|
||||
MIPS64N32 = libseccomp.SCMP_ARCH_MIPS64N32
|
||||
@@ -216,6 +218,8 @@ cdef class Arch:
|
||||
self._token = libseccomp.SCMP_ARCH_ARM
|
||||
elif arch == libseccomp.SCMP_ARCH_AARCH64:
|
||||
self._token = libseccomp.SCMP_ARCH_AARCH64
|
||||
+ elif arch == libseccomp.SCMP_ARCH_LOONGARCH64:
|
||||
+ self._token = libseccomp.SCMP_ARCH_LOONGARCH64
|
||||
elif arch == libseccomp.SCMP_ARCH_MIPS:
|
||||
self._token = libseccomp.SCMP_ARCH_MIPS
|
||||
elif arch == libseccomp.SCMP_ARCH_MIPS64:
|
||||
--- libseccomp-2.3.3.orig/src/system.c
|
||||
+++ libseccomp-2.3.3/src/system.c
|
||||
@@ -67,6 +67,7 @@ int sys_chk_seccomp_syscall(void)
|
||||
case SCMP_ARCH_X86_64:
|
||||
case SCMP_ARCH_ARM:
|
||||
case SCMP_ARCH_AARCH64:
|
||||
+ case SCMP_ARCH_LOONGARCH64:
|
||||
case SCMP_ARCH_PPC64:
|
||||
case SCMP_ARCH_PPC64LE:
|
||||
case SCMP_ARCH_S390:
|
||||
--- libseccomp-2.3.3.orig/tests/16-sim-arch_basic.c
|
||||
+++ libseccomp-2.3.3/tests/16-sim-arch_basic.c
|
||||
@@ -59,6 +59,9 @@ int main(int argc, char *argv[])
|
||||
rc = seccomp_arch_add(ctx, SCMP_ARCH_AARCH64);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
+ rc = seccomp_arch_add(ctx, SCMP_ARCH_LOONGARCH64);
|
||||
+ if (rc != 0)
|
||||
+ goto out;
|
||||
rc = seccomp_arch_add(ctx, SCMP_ARCH_MIPSEL);
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
--- libseccomp-2.3.3.orig/tests/16-sim-arch_basic.py
|
||||
+++ libseccomp-2.3.3/tests/16-sim-arch_basic.py
|
||||
@@ -36,6 +36,7 @@ def test(args):
|
||||
f.add_arch(Arch("x32"))
|
||||
f.add_arch(Arch("arm"))
|
||||
f.add_arch(Arch("aarch64"))
|
||||
+ f.add_arch(Arch("loongarch64"))
|
||||
f.add_arch(Arch("mipsel"))
|
||||
f.add_arch(Arch("mipsel64"))
|
||||
f.add_arch(Arch("mipsel64n32"))
|
||||
--- libseccomp-2.3.3.orig/tests/23-sim-arch_all_le_basic.c
|
||||
+++ libseccomp-2.3.3/tests/23-sim-arch_all_le_basic.c
|
||||
@@ -59,6 +59,9 @@ int main(int argc, char *argv[])
|
||||
rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("aarch64"));
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
+ rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("loongarch64"));
|
||||
+ if (rc != 0)
|
||||
+ goto out;
|
||||
rc = seccomp_arch_add(ctx, seccomp_arch_resolve_name("mipsel"));
|
||||
if (rc != 0)
|
||||
goto out;
|
||||
--- libseccomp-2.3.3.orig/tests/23-sim-arch_all_le_basic.py
|
||||
+++ libseccomp-2.3.3/tests/23-sim-arch_all_le_basic.py
|
||||
@@ -36,6 +36,7 @@ def test(args):
|
||||
f.add_arch(Arch("x32"))
|
||||
f.add_arch(Arch("arm"))
|
||||
f.add_arch(Arch("aarch64"))
|
||||
+ f.add_arch(Arch("loongarch64"))
|
||||
f.add_arch(Arch("mipsel"))
|
||||
f.add_arch(Arch("mipsel64"))
|
||||
f.add_arch(Arch("mipsel64n32"))
|
||||
--- libseccomp-2.3.3.orig/tests/regression
|
||||
+++ libseccomp-2.3.3/tests/regression
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
GLBL_ARCH_LE_SUPPORT=" \
|
||||
x86 x86_64 x32 \
|
||||
- arm aarch64 \
|
||||
+ arm aarch64 loongarch64\
|
||||
mipsel mipsel64 mipsel64n32 \
|
||||
ppc64le"
|
||||
GLBL_ARCH_BE_SUPPORT=" \
|
||||
@@ -707,7 +707,7 @@ function run_test_live() {
|
||||
|
||||
# setup the arch specific return values
|
||||
case "$arch" in
|
||||
- x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x)
|
||||
+ x86|x86_64|x32|arm|aarch64|parisc|parisc64|ppc|ppc64|ppc64le|ppc|s390|s390x|loongarch64)
|
||||
rc_kill=159
|
||||
rc_allow=160
|
||||
rc_trap=161
|
||||
--- libseccomp-2.3.3.orig/tools/scmp_bpf_sim.c
|
||||
+++ libseccomp-2.3.3/tools/scmp_bpf_sim.c
|
||||
@@ -253,6 +253,8 @@ int main(int argc, char *argv[])
|
||||
arch = AUDIT_ARCH_ARM;
|
||||
else if (strcmp(optarg, "aarch64") == 0)
|
||||
arch = AUDIT_ARCH_AARCH64;
|
||||
+ else if (strcmp(optarg, "loongarch64") == 0)
|
||||
+ arch = AUDIT_ARCH_AARCH64;
|
||||
else if (strcmp(optarg, "mips") == 0)
|
||||
arch = AUDIT_ARCH_MIPS;
|
||||
else if (strcmp(optarg, "mipsel") == 0)
|
||||
--- libseccomp-2.3.3.orig/tools/util.c
|
||||
+++ libseccomp-2.3.3/tools/util.c
|
||||
@@ -74,7 +74,7 @@
|
||||
#endif
|
||||
#elif __PPC__
|
||||
#define ARCH_NATIVE AUDIT_ARCH_PPC
|
||||
-#elif __loongarch
|
||||
+#elif __loongarch64
|
||||
/* kernel audit support for loongarch is not yet ready */
|
||||
//#define EM_RISCV 243
|
||||
#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
--- libseccomp-2.3.3.orig/src/python/libseccomp.pxd
|
||||
+++ libseccomp-2.3.3/src/python/libseccomp.pxd
|
||||
@@ -37,6 +37,7 @@ cdef extern from "seccomp.h":
|
||||
SCMP_ARCH_X32
|
||||
SCMP_ARCH_ARM
|
||||
SCMP_ARCH_AARCH64
|
||||
+ SCMP_ARCH_LOONGARCH64
|
||||
SCMP_ARCH_MIPS
|
||||
SCMP_ARCH_MIPS64
|
||||
SCMP_ARCH_MIPS64N32
|
||||
@@ -0,0 +1,37 @@
|
||||
diff -Nprua libseccomp-2.3.3-ori/aclocal.m4 libseccomp-2.3.3/aclocal.m4
|
||||
--- libseccomp-2.3.3-ori/aclocal.m4 2018-01-11 06:50:21.976469624 +0800
|
||||
+++ libseccomp-2.3.3/aclocal.m4 2024-03-19 15:53:57.108057434 +0800
|
||||
@@ -32,10 +32,10 @@ To do so, use the procedure documented b
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
-[am__api_version='1.15'
|
||||
+[am__api_version='1.16'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
-m4_if([$1], [1.15.1], [],
|
||||
+m4_if([$1], [1.16.5], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
-[AM_AUTOMAKE_VERSION([1.15.1])dnl
|
||||
+[AM_AUTOMAKE_VERSION([1.16.5])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
diff -Nprua libseccomp-2.3.3-ori/configure libseccomp-2.3.3/configure
|
||||
--- libseccomp-2.3.3-ori/configure 2018-01-11 06:50:22.393136675 +0800
|
||||
+++ libseccomp-2.3.3/configure 2024-03-19 15:47:20.255366270 +0800
|
||||
@@ -2182,7 +2182,7 @@ ac_config_headers="$ac_config_headers co
|
||||
|
||||
|
||||
|
||||
-am__api_version='1.15'
|
||||
+am__api_version='1.16'
|
||||
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
@@ -7,6 +7,7 @@ config BR2_PACKAGE_LIBSECCOMP_ARCH_SUPPORTS
|
||||
default y if BR2_powerpc64 || BR2_powerpc
|
||||
default y if BR2_RISCV_64
|
||||
default y if BR2_s390x
|
||||
default y if BR2_loongarch
|
||||
|
||||
config BR2_PACKAGE_LIBSECCOMP
|
||||
bool "libseccomp"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# From https://github.com/seccomp/libseccomp/releases/tag/v2.5.5
|
||||
sha256 248a2c8a4d9b9858aa6baf52712c34afefcf9c9e94b76dce02c1c9aa25fb3375 libseccomp-2.5.5.tar.gz
|
||||
sha256 7fc28f4294cc72e61c529bedf97e705c3acf9c479a8f1a3028d4cd2ca9f3b155 libseccomp-2.3.3.tar.gz
|
||||
# Locally calculated
|
||||
sha256 102900208eef27b766380135906d431dba87edaa7ec6aa72e6ebd3dd67f3a97b LICENSE
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBSECCOMP_VERSION = 2.5.5
|
||||
LIBSECCOMP_VERSION = 2.3.3
|
||||
LIBSECCOMP_SITE = https://github.com/seccomp/libseccomp/releases/download/v$(LIBSECCOMP_VERSION)
|
||||
LIBSECCOMP_LICENSE = LGPL-2.1
|
||||
LIBSECCOMP_LICENSE_FILES = LICENSE
|
||||
|
||||
Reference in New Issue
Block a user