Linux-Seccomp

 view release on metacpan or  search on metacpan

libseccomp/src/arch-arm-syscalls.c  view on Meta::CPAN

 * 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-arm.h"

#define __SCMP_NR_OABI_SYSCALL_BASE	0x900000
#define __SCMP_ARM_NR_BASE		0x0f0000

/* NOTE: we currently only support the ARM EABI, more info at the URL below:
 *       -> http://wiki.embeddedarm.com/wiki/EABI_vs_OABI */
#if 1
#define __SCMP_NR_BASE			0
#else
#define __SCMP_NR_BASE			__SCMP_NR_OABI_SYSCALL_BASE
#endif

/* NOTE: based on Linux 4.5-rc4 */
const struct arch_syscall_def arm_syscall_table[] = { \
	/* NOTE: arm_sync_file_range() and sync_file_range2() share values */
	{ "_llseek", (__SCMP_NR_BASE + 140) },
	{ "_newselect", (__SCMP_NR_BASE + 142) },
	{ "_sysctl", (__SCMP_NR_BASE + 149) },
	{ "accept", (__SCMP_NR_BASE + 285) },
	{ "accept4", (__SCMP_NR_BASE + 366) },
	{ "access", (__SCMP_NR_BASE + 33) },
	{ "acct", (__SCMP_NR_BASE + 51) },
	{ "add_key", (__SCMP_NR_BASE + 309) },
	{ "adjtimex", (__SCMP_NR_BASE + 124) },
	{ "afs_syscall", __PNR_afs_syscall },
	{ "alarm", __PNR_alarm },
	{ "arm_fadvise64_64", (__SCMP_NR_BASE + 270) },
	{ "arm_sync_file_range", (__SCMP_NR_BASE + 341) },
	{ "arch_prctl", __PNR_arch_prctl },
	{ "bdflush", (__SCMP_NR_BASE + 134) },
	{ "bind", (__SCMP_NR_BASE + 282) },
	{ "bpf", (__SCMP_NR_BASE + 386) },
	{ "break", __PNR_break },
	{ "breakpoint", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 1)) },
	{ "brk", (__SCMP_NR_BASE + 45) },
	{ "cachectl", __PNR_cachectl },
	{ "cacheflush", (__SCMP_NR_BASE + (__SCMP_ARM_NR_BASE + 2)) },
	{ "capget", (__SCMP_NR_BASE + 184) },
	{ "capset", (__SCMP_NR_BASE + 185) },
	{ "chdir", (__SCMP_NR_BASE + 12) },
	{ "chmod", (__SCMP_NR_BASE + 15) },
	{ "chown", (__SCMP_NR_BASE + 182) },
	{ "chown32", (__SCMP_NR_BASE + 212) },
	{ "chroot", (__SCMP_NR_BASE + 61) },
	{ "clock_adjtime", (__SCMP_NR_BASE + 372) },
	{ "clock_getres", (__SCMP_NR_BASE + 264) },
	{ "clock_gettime", (__SCMP_NR_BASE + 263) },
	{ "clock_nanosleep", (__SCMP_NR_BASE + 265) },
	{ "clock_settime", (__SCMP_NR_BASE + 262) },
	{ "clone", (__SCMP_NR_BASE + 120) },
	{ "close", (__SCMP_NR_BASE +  6) },
	{ "connect", (__SCMP_NR_BASE + 283) },
	{ "copy_file_range", (__SCMP_NR_BASE + 391) },
	{ "creat", (__SCMP_NR_BASE +  8) },
	{ "create_module", __PNR_create_module },
	{ "delete_module", (__SCMP_NR_BASE + 129) },
	{ "dup", (__SCMP_NR_BASE + 41) },
	{ "dup2", (__SCMP_NR_BASE + 63) },
	{ "dup3", (__SCMP_NR_BASE + 358) },
	{ "epoll_create", (__SCMP_NR_BASE + 250) },
	{ "epoll_create1", (__SCMP_NR_BASE + 357) },
	{ "epoll_ctl", (__SCMP_NR_BASE + 251) },
	{ "epoll_ctl_old", __PNR_epoll_ctl_old },
	{ "epoll_pwait", (__SCMP_NR_BASE + 346) },
	{ "epoll_wait", (__SCMP_NR_BASE + 252) },
	{ "epoll_wait_old", __PNR_epoll_wait_old },
	{ "eventfd", (__SCMP_NR_BASE + 351) },
	{ "eventfd2", (__SCMP_NR_BASE + 356) },
	{ "execve", (__SCMP_NR_BASE + 11) },
	{ "execveat", (__SCMP_NR_BASE + 387) },
	{ "exit", (__SCMP_NR_BASE +  1) },
	{ "exit_group", (__SCMP_NR_BASE + 248) },
	{ "faccessat", (__SCMP_NR_BASE + 334) },
	{ "fadvise64", __PNR_fadvise64 },
	{ "fadvise64_64", __PNR_fadvise64_64 },
	{ "fallocate", (__SCMP_NR_BASE + 352) },
	{ "fanotify_init", (__SCMP_NR_BASE + 367) },
	{ "fanotify_mark", (__SCMP_NR_BASE + 368) },
	{ "fchdir", (__SCMP_NR_BASE + 133) },
	{ "fchmod", (__SCMP_NR_BASE + 94) },
	{ "fchmodat", (__SCMP_NR_BASE + 333) },
	{ "fchown", (__SCMP_NR_BASE + 95) },
	{ "fchown32", (__SCMP_NR_BASE + 207) },
	{ "fchownat", (__SCMP_NR_BASE + 325) },
	{ "fcntl", (__SCMP_NR_BASE + 55) },
	{ "fcntl64", (__SCMP_NR_BASE + 221) },
	{ "fdatasync", (__SCMP_NR_BASE + 148) },
	{ "fgetxattr", (__SCMP_NR_BASE + 231) },
	{ "finit_module", (__SCMP_NR_BASE + 379) },
	{ "flistxattr", (__SCMP_NR_BASE + 234) },
	{ "flock", (__SCMP_NR_BASE + 143) },
	{ "fork", (__SCMP_NR_BASE +  2) },
	{ "fremovexattr", (__SCMP_NR_BASE + 237) },
	{ "fsetxattr", (__SCMP_NR_BASE + 228) },
	{ "fstat", (__SCMP_NR_BASE + 108) },
	{ "fstat64", (__SCMP_NR_BASE + 197) },
	{ "fstatat64", (__SCMP_NR_BASE + 327) },
	{ "fstatfs", (__SCMP_NR_BASE + 100) },
	{ "fstatfs64", (__SCMP_NR_BASE + 267) },
	{ "fsync", (__SCMP_NR_BASE + 118) },
	{ "ftime", __PNR_ftime },
	{ "ftruncate", (__SCMP_NR_BASE + 93) },
	{ "ftruncate64", (__SCMP_NR_BASE + 194) },
	{ "futex", (__SCMP_NR_BASE + 240) },
	{ "futimesat", (__SCMP_NR_BASE + 326) },
	{ "get_kernel_syms", __PNR_get_kernel_syms },
	{ "get_mempolicy", (__SCMP_NR_BASE + 320) },
	{ "get_robust_list", (__SCMP_NR_BASE + 339) },
	{ "get_thread_area", __PNR_get_thread_area },
	{ "getcpu", (__SCMP_NR_BASE + 345) },
	{ "getcwd", (__SCMP_NR_BASE + 183) },
	{ "getdents", (__SCMP_NR_BASE + 141) },
	{ "getdents64", (__SCMP_NR_BASE + 217) },
	{ "getegid", (__SCMP_NR_BASE + 50) },
	{ "getegid32", (__SCMP_NR_BASE + 202) },
	{ "geteuid", (__SCMP_NR_BASE + 49) },
	{ "geteuid32", (__SCMP_NR_BASE + 201) },
	{ "getgid", (__SCMP_NR_BASE + 47) },
	{ "getgid32", (__SCMP_NR_BASE + 200) },
	{ "getgroups", (__SCMP_NR_BASE + 80) },
	{ "getgroups32", (__SCMP_NR_BASE + 205) },
	{ "getitimer", (__SCMP_NR_BASE + 105) },
	{ "getpeername", (__SCMP_NR_BASE + 287) },
	{ "getpgid", (__SCMP_NR_BASE + 132) },
	{ "getpgrp", (__SCMP_NR_BASE + 65) },
	{ "getpid", (__SCMP_NR_BASE + 20) },
	{ "getpmsg", __PNR_getpmsg },
	{ "getppid", (__SCMP_NR_BASE + 64) },
	{ "getpriority", (__SCMP_NR_BASE + 96) },
	{ "getrandom", (__SCMP_NR_BASE + 384) },
	{ "getresgid", (__SCMP_NR_BASE + 171) },
	{ "getresgid32", (__SCMP_NR_BASE + 211) },
	{ "getresuid", (__SCMP_NR_BASE + 165) },
	{ "getresuid32", (__SCMP_NR_BASE + 209) },
	{ "getrlimit", __PNR_getrlimit },
	{ "getrusage", (__SCMP_NR_BASE + 77) },
	{ "getsid", (__SCMP_NR_BASE + 147) },
	{ "getsockname", (__SCMP_NR_BASE + 286) },
	{ "getsockopt", (__SCMP_NR_BASE + 295) },
	{ "gettid", (__SCMP_NR_BASE + 224) },
	{ "gettimeofday", (__SCMP_NR_BASE + 78) },
	{ "getuid", (__SCMP_NR_BASE + 24) },
	{ "getuid32", (__SCMP_NR_BASE + 199) },
	{ "getxattr", (__SCMP_NR_BASE + 229) },
	{ "gtty", __PNR_gtty },
	{ "idle", __PNR_idle },
	{ "init_module", (__SCMP_NR_BASE + 128) },
	{ "inotify_add_watch", (__SCMP_NR_BASE + 317) },
	{ "inotify_init", (__SCMP_NR_BASE + 316) },
	{ "inotify_init1", (__SCMP_NR_BASE + 360) },
	{ "inotify_rm_watch", (__SCMP_NR_BASE + 318) },
	{ "io_cancel", (__SCMP_NR_BASE + 247) },
	{ "io_destroy", (__SCMP_NR_BASE + 244) },
	{ "io_getevents", (__SCMP_NR_BASE + 245) },
	{ "io_setup", (__SCMP_NR_BASE + 243) },
	{ "io_submit", (__SCMP_NR_BASE + 246) },
	{ "ioctl", (__SCMP_NR_BASE + 54) },
	{ "ioperm", __PNR_ioperm },
	{ "iopl", __PNR_iopl },
	{ "ioprio_get", (__SCMP_NR_BASE + 315) },
	{ "ioprio_set", (__SCMP_NR_BASE + 314) },
	{ "ipc", __PNR_ipc },
	{ "kcmp", (__SCMP_NR_BASE + 378) },
	{ "kexec_file_load", __PNR_kexec_file_load },
	{ "kexec_load", (__SCMP_NR_BASE + 347) },
	{ "keyctl", (__SCMP_NR_BASE + 311) },
	{ "kill", (__SCMP_NR_BASE + 37) },
	{ "lchown", (__SCMP_NR_BASE + 16) },
	{ "lchown32", (__SCMP_NR_BASE + 198) },
	{ "lgetxattr", (__SCMP_NR_BASE + 230) },
	{ "link", (__SCMP_NR_BASE +  9) },
	{ "linkat", (__SCMP_NR_BASE + 330) },
	{ "listen", (__SCMP_NR_BASE + 284) },
	{ "listxattr", (__SCMP_NR_BASE + 232) },
	{ "llistxattr", (__SCMP_NR_BASE + 233) },
	{ "lock", __PNR_lock },
	{ "lookup_dcookie", (__SCMP_NR_BASE + 249) },
	{ "lremovexattr", (__SCMP_NR_BASE + 236) },
	{ "lseek", (__SCMP_NR_BASE + 19) },
	{ "lsetxattr", (__SCMP_NR_BASE + 227) },
	{ "lstat", (__SCMP_NR_BASE + 107) },
	{ "lstat64", (__SCMP_NR_BASE + 196) },
	{ "madvise", (__SCMP_NR_BASE + 220) },
	{ "mbind", (__SCMP_NR_BASE + 319) },
	{ "membarrier",  (__SCMP_NR_BASE + 389) },
	{ "memfd_create", (__SCMP_NR_BASE + 385) },
	{ "migrate_pages", __PNR_migrate_pages },
	{ "mincore", (__SCMP_NR_BASE + 219) },
	{ "mkdir", (__SCMP_NR_BASE + 39) },
	{ "mkdirat", (__SCMP_NR_BASE + 323) },
	{ "mknod", (__SCMP_NR_BASE + 14) },
	{ "mknodat", (__SCMP_NR_BASE + 324) },
	{ "mlock", (__SCMP_NR_BASE + 150) },
	{ "mlock2", (__SCMP_NR_BASE + 390) },
	{ "mlockall", (__SCMP_NR_BASE + 152) },
	{ "mmap", __PNR_mmap },
	{ "mmap2", (__SCMP_NR_BASE + 192) },
	{ "modify_ldt", __PNR_modify_ldt },
	{ "mount", (__SCMP_NR_BASE + 21) },
	{ "move_pages", (__SCMP_NR_BASE + 344) },
	{ "mprotect", (__SCMP_NR_BASE + 125) },
	{ "mpx", __PNR_mpx },
	{ "mq_getsetattr", (__SCMP_NR_BASE + 279) },
	{ "mq_notify", (__SCMP_NR_BASE + 278) },
	{ "mq_open", (__SCMP_NR_BASE + 274) },
	{ "mq_timedreceive", (__SCMP_NR_BASE + 277) },
	{ "mq_timedsend", (__SCMP_NR_BASE + 276) },
	{ "mq_unlink", (__SCMP_NR_BASE + 275) },
	{ "mremap", (__SCMP_NR_BASE + 163) },
	{ "msgctl", (__SCMP_NR_BASE + 304) },
	{ "msgget", (__SCMP_NR_BASE + 303) },
	{ "msgrcv", (__SCMP_NR_BASE + 302) },
	{ "msgsnd", (__SCMP_NR_BASE + 301) },
	{ "msync", (__SCMP_NR_BASE + 144) },
	{ "multiplexer", __PNR_multiplexer },
	{ "munlock", (__SCMP_NR_BASE + 151) },
	{ "munlockall", (__SCMP_NR_BASE + 153) },
	{ "munmap", (__SCMP_NR_BASE + 91) },
	{ "name_to_handle_at", (__SCMP_NR_BASE + 370) },
	{ "nanosleep", (__SCMP_NR_BASE + 162) },
	{ "newfstatat", __PNR_newfstatat },
	{ "nfsservctl", (__SCMP_NR_BASE + 169) },
	{ "nice", (__SCMP_NR_BASE + 34) },
	{ "oldfstat", __PNR_oldfstat },
	{ "oldlstat", __PNR_oldlstat },
	{ "oldolduname", __PNR_oldolduname },
	{ "oldstat", __PNR_oldstat },
	{ "olduname", __PNR_olduname },
	{ "oldwait4", __PNR_oldwait4 },



( run in 0.640 second using v1.01-cache-2.11-cpan-71847e10f99 )