diff options
author | Paul Moore <pmoore@redhat.com> | 2013-02-19 14:27:03 -0500 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2013-03-26 18:15:16 -0400 |
commit | 75ee9e71f858b183d9649755722f0ed4e67de923 (patch) | |
tree | 6b664dee2fe30e6a55c652d4ac7c6a0e661769a6 | |
parent | ab53042bbfc6a9a14d9e24b4944568c2c3c5e954 (diff) | |
download | libseccomp-75ee9e71f858b183d9649755722f0ed4e67de923.tar.gz |
arch: leverage the x86_64 syscall table in x32
Since the Linux Kernel really uses the same syscall table for both
x86_64 and x32 we should do the same and make life easier.
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r-- | src/arch-x32-syscalls.c | 424 |
1 files changed, 11 insertions, 413 deletions
diff --git a/src/arch-x32-syscalls.c b/src/arch-x32-syscalls.c index 2583391..79cece8 100644 --- a/src/arch-x32-syscalls.c +++ b/src/arch-x32-syscalls.c @@ -24,405 +24,10 @@ #include <seccomp.h> #include "arch.h" +#include "arch-x86_64.h" #include "arch-x32.h" -#define __X32_SYSCALL_BIT 0x40000000 - -/* NOTE: based on Linux 3.7.3 */ -const struct arch_syscall_def x32_syscall_table[] = \ -{ - { "accept", (__X32_SYSCALL_BIT + 43) }, - { "accept4", (__X32_SYSCALL_BIT + 288) }, - { "access", (__X32_SYSCALL_BIT + 21) }, - { "acct", (__X32_SYSCALL_BIT + 163) }, - { "add_key", (__X32_SYSCALL_BIT + 248) }, - { "adjtimex", (__X32_SYSCALL_BIT + 159) }, - { "afs_syscall", (__X32_SYSCALL_BIT + 183) }, - { "alarm", (__X32_SYSCALL_BIT + 37) }, - { "arm_fadvise64_64", __PNR_arm_fadvise64_64 }, - { "arm_sync_file_range", __PNR_arm_sync_file_range }, - { "arch_prctl", (__X32_SYSCALL_BIT + 158) }, - { "bdflush", __PNR_bdflush }, - { "bind", (__X32_SYSCALL_BIT + 49) }, - { "break", __PNR_break }, - { "brk", (__X32_SYSCALL_BIT + 12) }, - { "capget", (__X32_SYSCALL_BIT + 125) }, - { "capset", (__X32_SYSCALL_BIT + 126) }, - { "chdir", (__X32_SYSCALL_BIT + 80) }, - { "chmod", (__X32_SYSCALL_BIT + 90) }, - { "chown", (__X32_SYSCALL_BIT + 92) }, - { "chown32", __PNR_chown32 }, - { "chroot", (__X32_SYSCALL_BIT + 161) }, - { "clock_adjtime", (__X32_SYSCALL_BIT + 305) }, - { "clock_getres", (__X32_SYSCALL_BIT + 229) }, - { "clock_gettime", (__X32_SYSCALL_BIT + 228) }, - { "clock_nanosleep", (__X32_SYSCALL_BIT + 230) }, - { "clock_settime", (__X32_SYSCALL_BIT + 227) }, - { "clone", (__X32_SYSCALL_BIT + 56) }, - { "close", (__X32_SYSCALL_BIT + 3) }, - { "connect", (__X32_SYSCALL_BIT + 42) }, - { "creat", (__X32_SYSCALL_BIT + 85) }, - { "create_module", __PNR_create_module }, - { "delete_module", (__X32_SYSCALL_BIT + 176) }, - { "dup", (__X32_SYSCALL_BIT + 32) }, - { "dup2", (__X32_SYSCALL_BIT + 33) }, - { "dup3", (__X32_SYSCALL_BIT + 292) }, - { "epoll_create", (__X32_SYSCALL_BIT + 213) }, - { "epoll_create1", (__X32_SYSCALL_BIT + 291) }, - { "epoll_ctl", (__X32_SYSCALL_BIT + 233) }, - { "epoll_ctl_old", __PNR_epoll_ctl_old }, - { "epoll_pwait", (__X32_SYSCALL_BIT + 281) }, - { "epoll_wait", (__X32_SYSCALL_BIT + 232) }, - { "epoll_wait_old", __PNR_epoll_wait_old }, - { "eventfd", (__X32_SYSCALL_BIT + 284) }, - { "eventfd2", (__X32_SYSCALL_BIT + 290) }, - { "execve", (__X32_SYSCALL_BIT + 520) }, - { "exit", (__X32_SYSCALL_BIT + 60) }, - { "exit_group", (__X32_SYSCALL_BIT + 231) }, - { "faccessat", (__X32_SYSCALL_BIT + 269) }, - { "fadvise64", (__X32_SYSCALL_BIT + 221) }, - { "fadvise64_64", __PNR_fadvise64_64 }, - { "fallocate", (__X32_SYSCALL_BIT + 285) }, - { "fanotify_init", (__X32_SYSCALL_BIT + 300) }, - { "fanotify_mark", (__X32_SYSCALL_BIT + 301) }, - { "fchdir", (__X32_SYSCALL_BIT + 81) }, - { "fchmod", (__X32_SYSCALL_BIT + 91) }, - { "fchmodat", (__X32_SYSCALL_BIT + 268) }, - { "fchown", (__X32_SYSCALL_BIT + 93) }, - { "fchown32", __PNR_fchown32 }, - { "fchownat", (__X32_SYSCALL_BIT + 260) }, - { "fcntl", (__X32_SYSCALL_BIT + 72) }, - { "fcntl64", __PNR_fcntl64 }, - { "fdatasync", (__X32_SYSCALL_BIT + 75) }, - { "fgetxattr", (__X32_SYSCALL_BIT + 193) }, - { "finit_module", __PNR_finit_module }, - { "flistxattr", (__X32_SYSCALL_BIT + 196) }, - { "flock", (__X32_SYSCALL_BIT + 73) }, - { "fork", (__X32_SYSCALL_BIT + 57) }, - { "fremovexattr", (__X32_SYSCALL_BIT + 199) }, - { "fsetxattr", (__X32_SYSCALL_BIT + 190) }, - { "fstat", (__X32_SYSCALL_BIT + 5) }, - { "fstat64", __PNR_fstat64 }, - { "fstatat64", __PNR_fstatat64 }, - { "fstatfs", (__X32_SYSCALL_BIT + 138) }, - { "fstatfs64", __PNR_fstatfs64 }, - { "fsync", (__X32_SYSCALL_BIT + 74) }, - { "ftime", __PNR_ftime }, - { "ftruncate", (__X32_SYSCALL_BIT + 77) }, - { "ftruncate64", __PNR_ftruncate64 }, - { "futex", (__X32_SYSCALL_BIT + 202) }, - { "futimesat", (__X32_SYSCALL_BIT + 261) }, - { "get_kernel_syms", __PNR_get_kernel_syms }, - { "get_mempolicy", (__X32_SYSCALL_BIT + 239) }, - { "get_robust_list", (__X32_SYSCALL_BIT + 531) }, - { "get_thread_area", __PNR_get_thread_area }, - { "getcpu", (__X32_SYSCALL_BIT + 309) }, - { "getcwd", (__X32_SYSCALL_BIT + 79) }, - { "getdents", (__X32_SYSCALL_BIT + 78) }, - { "getdents64", (__X32_SYSCALL_BIT + 217) }, - { "getegid", (__X32_SYSCALL_BIT + 108) }, - { "getegid32", __PNR_getegid32 }, - { "geteuid", (__X32_SYSCALL_BIT + 107) }, - { "geteuid32", __PNR_geteuid32 }, - { "getgid", (__X32_SYSCALL_BIT + 104) }, - { "getgid32", __PNR_getgid32 }, - { "getgroups", (__X32_SYSCALL_BIT + 115) }, - { "getgroups32", __PNR_getgroups32 }, - { "getitimer", (__X32_SYSCALL_BIT + 36) }, - { "getpeername", (__X32_SYSCALL_BIT + 52) }, - { "getpgid", (__X32_SYSCALL_BIT + 121) }, - { "getpgrp", (__X32_SYSCALL_BIT + 111) }, - { "getpid", (__X32_SYSCALL_BIT + 39) }, - { "getpmsg", (__X32_SYSCALL_BIT + 181) }, - { "getppid", (__X32_SYSCALL_BIT + 110) }, - { "getpriority", (__X32_SYSCALL_BIT + 140) }, - { "getresgid", (__X32_SYSCALL_BIT + 120) }, - { "getresgid32", __PNR_getresgid32 }, - { "getresuid", (__X32_SYSCALL_BIT + 118) }, - { "getresuid32", __PNR_getresuid32 }, - { "getrlimit", (__X32_SYSCALL_BIT + 97) }, - { "getrusage", (__X32_SYSCALL_BIT + 98) }, - { "getsid", (__X32_SYSCALL_BIT + 124) }, - { "getsockname", (__X32_SYSCALL_BIT + 51) }, - { "getsockopt", (__X32_SYSCALL_BIT + 542) }, - { "gettid", (__X32_SYSCALL_BIT + 186) }, - { "gettimeofday", (__X32_SYSCALL_BIT + 96) }, - { "getuid", (__X32_SYSCALL_BIT + 102) }, - { "getuid32", __PNR_getuid32 }, - { "getxattr", (__X32_SYSCALL_BIT + 191) }, - { "gtty", __PNR_gtty }, - { "idle", __PNR_idle }, - { "init_module", (__X32_SYSCALL_BIT + 175) }, - { "inotify_add_watch", (__X32_SYSCALL_BIT + 254) }, - { "inotify_init", (__X32_SYSCALL_BIT + 253) }, - { "inotify_init1", (__X32_SYSCALL_BIT + 294) }, - { "inotify_rm_watch", (__X32_SYSCALL_BIT + 255) }, - { "io_cancel", (__X32_SYSCALL_BIT + 210) }, - { "io_destroy", (__X32_SYSCALL_BIT + 207) }, - { "io_getevents", (__X32_SYSCALL_BIT + 208) }, - { "io_setup", (__X32_SYSCALL_BIT + 206) }, - { "io_submit", (__X32_SYSCALL_BIT + 209) }, - { "ioctl", (__X32_SYSCALL_BIT + 514) }, - { "ioperm", (__X32_SYSCALL_BIT + 173) }, - { "iopl", (__X32_SYSCALL_BIT + 172) }, - { "ioprio_get", (__X32_SYSCALL_BIT + 252) }, - { "ioprio_set", (__X32_SYSCALL_BIT + 251) }, - { "ipc", __PNR_ipc }, - { "kcmp", (__X32_SYSCALL_BIT + 312) }, - { "kexec_load", (__X32_SYSCALL_BIT + 528) }, - { "keyctl", (__X32_SYSCALL_BIT + 250) }, - { "kill", (__X32_SYSCALL_BIT + 62) }, - { "lchown", (__X32_SYSCALL_BIT + 94) }, - { "lchown32", __PNR_lchown32 }, - { "lgetxattr", (__X32_SYSCALL_BIT + 192) }, - { "link", (__X32_SYSCALL_BIT + 86) }, - { "linkat", (__X32_SYSCALL_BIT + 265) }, - { "listen", (__X32_SYSCALL_BIT + 50) }, - { "listxattr", (__X32_SYSCALL_BIT + 194) }, - { "llistxattr", (__X32_SYSCALL_BIT + 195) }, - { "_llseek", __PNR__llseek }, - { "lock", __PNR_lock }, - { "lookup_dcookie", (__X32_SYSCALL_BIT + 212) }, - { "lremovexattr", (__X32_SYSCALL_BIT + 198) }, - { "lseek", (__X32_SYSCALL_BIT + 8) }, - { "lsetxattr", (__X32_SYSCALL_BIT + 189) }, - { "lstat", (__X32_SYSCALL_BIT + 6) }, - { "lstat64", __PNR_lstat64 }, - { "madvise", (__X32_SYSCALL_BIT + 28) }, - { "mbind", (__X32_SYSCALL_BIT + 237) }, - { "migrate_pages", (__X32_SYSCALL_BIT + 256) }, - { "mincore", (__X32_SYSCALL_BIT + 27) }, - { "mkdir", (__X32_SYSCALL_BIT + 83) }, - { "mkdirat", (__X32_SYSCALL_BIT + 258) }, - { "mknod", (__X32_SYSCALL_BIT + 133) }, - { "mknodat", (__X32_SYSCALL_BIT + 259) }, - { "mlock", (__X32_SYSCALL_BIT + 149) }, - { "mlockall", (__X32_SYSCALL_BIT + 151) }, - { "mmap", (__X32_SYSCALL_BIT + 9) }, - { "mmap2", __PNR_mmap2 }, - { "modify_ldt", (__X32_SYSCALL_BIT + 154) }, - { "mount", (__X32_SYSCALL_BIT + 165) }, - { "move_pages", (__X32_SYSCALL_BIT + 533) }, - { "mprotect", (__X32_SYSCALL_BIT + 10) }, - { "mpx", __PNR_mpx }, - { "mq_getsetattr", (__X32_SYSCALL_BIT + 245) }, - { "mq_notify", (__X32_SYSCALL_BIT + 527) }, - { "mq_open", (__X32_SYSCALL_BIT + 240) }, - { "mq_timedreceive", (__X32_SYSCALL_BIT + 243) }, - { "mq_timedsend", (__X32_SYSCALL_BIT + 242) }, - { "mq_unlink", (__X32_SYSCALL_BIT + 241) }, - { "mremap", (__X32_SYSCALL_BIT + 25) }, - { "msgctl", (__X32_SYSCALL_BIT + 71) }, - { "msgget", (__X32_SYSCALL_BIT + 68) }, - { "msgrcv", (__X32_SYSCALL_BIT + 70) }, - { "msgsnd", (__X32_SYSCALL_BIT + 69) }, - { "msync", (__X32_SYSCALL_BIT + 26) }, - { "munlock", (__X32_SYSCALL_BIT + 150) }, - { "munlockall", (__X32_SYSCALL_BIT + 152) }, - { "munmap", (__X32_SYSCALL_BIT + 11) }, - { "name_to_handle_at", (__X32_SYSCALL_BIT + 303) }, - { "nanosleep", (__X32_SYSCALL_BIT + 35) }, - { "_newselect", __PNR__newselect }, - { "newfstatat", (__X32_SYSCALL_BIT + 262) }, - { "nfsservctl", __PNR_nfsservctl }, - { "nice", __PNR_nice }, - { "oldfstat", __PNR_oldfstat }, - { "oldlstat", __PNR_oldlstat }, - { "oldolduname", __PNR_oldolduname }, - { "oldstat", __PNR_oldstat }, - { "olduname", __PNR_olduname }, - { "open", (__X32_SYSCALL_BIT + 2) }, - { "open_by_handle_at", (__X32_SYSCALL_BIT + 304) }, - { "openat", (__X32_SYSCALL_BIT + 257) }, - { "pause", (__X32_SYSCALL_BIT + 34) }, - { "pciconfig_iobase", __PNR_pciconfig_iobase }, - { "pciconfig_read", __PNR_pciconfig_read }, - { "pciconfig_write", __PNR_pciconfig_write }, - { "perf_event_open", (__X32_SYSCALL_BIT + 298) }, - { "personality", (__X32_SYSCALL_BIT + 135) }, - { "pipe", (__X32_SYSCALL_BIT + 22) }, - { "pipe2", (__X32_SYSCALL_BIT + 293) }, - { "pivot_root", (__X32_SYSCALL_BIT + 155) }, - { "poll", (__X32_SYSCALL_BIT + 7) }, - { "ppoll", (__X32_SYSCALL_BIT + 271) }, - { "prctl", (__X32_SYSCALL_BIT + 157) }, - { "pread64", (__X32_SYSCALL_BIT + 17) }, - { "preadv", (__X32_SYSCALL_BIT + 534) }, - { "prlimit64", (__X32_SYSCALL_BIT + 302) }, - { "process_vm_readv", (__X32_SYSCALL_BIT + 539) }, - { "process_vm_writev", (__X32_SYSCALL_BIT + 540) }, - { "prof", __PNR_prof }, - { "profil", __PNR_profil }, - { "pselect6", (__X32_SYSCALL_BIT + 270) }, - { "ptrace", (__X32_SYSCALL_BIT + 521) }, - { "putpmsg", (__X32_SYSCALL_BIT + 182) }, - { "pwrite64", (__X32_SYSCALL_BIT + 18) }, - { "pwritev", (__X32_SYSCALL_BIT + 535) }, - { "query_module", __PNR_query_module }, - { "quotactl", (__X32_SYSCALL_BIT + 179) }, - { "read", (__X32_SYSCALL_BIT + 0) }, - { "readahead", (__X32_SYSCALL_BIT + 187) }, - { "readdir", __PNR_readdir }, - { "readlink", (__X32_SYSCALL_BIT + 89) }, - { "readlinkat", (__X32_SYSCALL_BIT + 267) }, - { "readv", (__X32_SYSCALL_BIT + 515) }, - { "reboot", (__X32_SYSCALL_BIT + 169) }, - { "recv", __PNR_recv }, - { "recvfrom", (__X32_SYSCALL_BIT + 517) }, - { "recvmmsg", (__X32_SYSCALL_BIT + 537) }, - { "recvmsg", (__X32_SYSCALL_BIT + 519) }, - { "remap_file_pages", (__X32_SYSCALL_BIT + 216) }, - { "removexattr", (__X32_SYSCALL_BIT + 197) }, - { "rename", (__X32_SYSCALL_BIT + 82) }, - { "renameat", (__X32_SYSCALL_BIT + 264) }, - { "request_key", (__X32_SYSCALL_BIT + 249) }, - { "restart_syscall", (__X32_SYSCALL_BIT + 219) }, - { "rmdir", (__X32_SYSCALL_BIT + 84) }, - { "rt_sigaction", (__X32_SYSCALL_BIT + 512) }, - { "rt_sigpending", (__X32_SYSCALL_BIT + 522) }, - { "rt_sigprocmask", (__X32_SYSCALL_BIT + 14) }, - { "rt_sigqueueinfo", (__X32_SYSCALL_BIT + 524) }, - { "rt_sigreturn", (__X32_SYSCALL_BIT + 513) }, - { "rt_sigsuspend", (__X32_SYSCALL_BIT + 130) }, - { "rt_sigtimedwait", (__X32_SYSCALL_BIT + 523) }, - { "rt_tgsigqueueinfo", (__X32_SYSCALL_BIT + 536) }, - { "sched_get_priority_max", (__X32_SYSCALL_BIT + 146) }, - { "sched_get_priority_min", (__X32_SYSCALL_BIT + 147) }, - { "sched_getaffinity", (__X32_SYSCALL_BIT + 204) }, - { "sched_getparam", (__X32_SYSCALL_BIT + 143) }, - { "sched_getscheduler", (__X32_SYSCALL_BIT + 145) }, - { "sched_rr_get_interval", (__X32_SYSCALL_BIT + 148) }, - { "sched_setaffinity", (__X32_SYSCALL_BIT + 203) }, - { "sched_setparam", (__X32_SYSCALL_BIT + 142) }, - { "sched_setscheduler", (__X32_SYSCALL_BIT + 144) }, - { "sched_yield", (__X32_SYSCALL_BIT + 24) }, - { "security", (__X32_SYSCALL_BIT + 185) }, - { "select", (__X32_SYSCALL_BIT + 23) }, - { "semctl", (__X32_SYSCALL_BIT + 66) }, - { "semget", (__X32_SYSCALL_BIT + 64) }, - { "semop", (__X32_SYSCALL_BIT + 65) }, - { "semtimedop", (__X32_SYSCALL_BIT + 220) }, - { "send", __PNR_send }, - { "sendfile", (__X32_SYSCALL_BIT + 40) }, - { "sendfile64", __PNR_sendfile64 }, - { "sendmmsg", (__X32_SYSCALL_BIT + 538) }, - { "sendmsg", (__X32_SYSCALL_BIT + 518) }, - { "sendto", (__X32_SYSCALL_BIT + 44) }, - { "set_mempolicy", (__X32_SYSCALL_BIT + 238) }, - { "set_robust_list", (__X32_SYSCALL_BIT + 530) }, - { "set_thread_area", __PNR_set_thread_area }, - { "set_tid_address", (__X32_SYSCALL_BIT + 218) }, - { "setdomainname", (__X32_SYSCALL_BIT + 171) }, - { "setfsgid", (__X32_SYSCALL_BIT + 123) }, - { "setfsgid32", __PNR_setfsgid32 }, - { "setfsuid", (__X32_SYSCALL_BIT + 122) }, - { "setfsuid32", __PNR_setfsuid32 }, - { "setgid", (__X32_SYSCALL_BIT + 106) }, - { "setgid32", __PNR_setgid32 }, - { "setgroups", (__X32_SYSCALL_BIT + 116) }, - { "setgroups32", __PNR_setgroups32 }, - { "sethostname", (__X32_SYSCALL_BIT + 170) }, - { "setitimer", (__X32_SYSCALL_BIT + 38) }, - { "setns", (__X32_SYSCALL_BIT + 308) }, - { "setpgid", (__X32_SYSCALL_BIT + 109) }, - { "setpriority", (__X32_SYSCALL_BIT + 141) }, - { "setregid", (__X32_SYSCALL_BIT + 114) }, - { "setregid32", __PNR_setregid32 }, - { "setresgid", (__X32_SYSCALL_BIT + 119) }, - { "setresgid32", __PNR_setresgid32 }, - { "setresuid", (__X32_SYSCALL_BIT + 117) }, - { "setresuid32", __PNR_setresuid32 }, - { "setreuid", (__X32_SYSCALL_BIT + 113) }, - { "setreuid32", __PNR_setreuid32 }, - { "setrlimit", (__X32_SYSCALL_BIT + 160) }, - { "setsid", (__X32_SYSCALL_BIT + 112) }, - { "setsockopt", (__X32_SYSCALL_BIT + 541) }, - { "settimeofday", (__X32_SYSCALL_BIT + 164) }, - { "setuid", (__X32_SYSCALL_BIT + 105) }, - { "setuid32", __PNR_setuid32 }, - { "setxattr", (__X32_SYSCALL_BIT + 188) }, - { "sgetmask", __PNR_sgetmask }, - { "shmat", (__X32_SYSCALL_BIT + 30) }, - { "shmctl", (__X32_SYSCALL_BIT + 31) }, - { "shmdt", (__X32_SYSCALL_BIT + 67) }, - { "shmget", (__X32_SYSCALL_BIT + 29) }, - { "shutdown", (__X32_SYSCALL_BIT + 48) }, - { "sigaction", __PNR_sigaction }, - { "sigaltstack", (__X32_SYSCALL_BIT + 525) }, - { "signal", __PNR_signal }, - { "signalfd", (__X32_SYSCALL_BIT + 282) }, - { "signalfd4", (__X32_SYSCALL_BIT + 289) }, - { "sigpending", __PNR_sigpending }, - { "sigprocmask", __PNR_sigprocmask }, - { "sigreturn", __PNR_sigreturn }, - { "sigsuspend", __PNR_sigsuspend }, - { "socket", (__X32_SYSCALL_BIT + 41) }, - { "socketcall", __PNR_socketcall }, - { "socketpair", (__X32_SYSCALL_BIT + 53) }, - { "splice", (__X32_SYSCALL_BIT + 275) }, - { "ssetmask", __PNR_ssetmask }, - { "stat", (__X32_SYSCALL_BIT + 4) }, - { "stat64", __PNR_stat64 }, - { "statfs", (__X32_SYSCALL_BIT + 137) }, - { "statfs64", __PNR_statfs64 }, - { "stime", __PNR_stime }, - { "stty", __PNR_stty }, - { "swapoff", (__X32_SYSCALL_BIT + 168) }, - { "swapon", (__X32_SYSCALL_BIT + 167) }, - { "symlink", (__X32_SYSCALL_BIT + 88) }, - { "symlinkat", (__X32_SYSCALL_BIT + 266) }, - { "sync", (__X32_SYSCALL_BIT + 162) }, - { "sync_file_range", (__X32_SYSCALL_BIT + 277) }, - { "sync_file_range2", __PNR_sync_file_range2 }, - { "syncfs", (__X32_SYSCALL_BIT + 306) }, - { "syscall", __PNR_syscall }, - { "_sysctl", __PNR__sysctl }, - { "sysfs", (__X32_SYSCALL_BIT + 139) }, - { "sysinfo", (__X32_SYSCALL_BIT + 99) }, - { "syslog", (__X32_SYSCALL_BIT + 103) }, - { "tee", (__X32_SYSCALL_BIT + 276) }, - { "tgkill", (__X32_SYSCALL_BIT + 234) }, - { "time", (__X32_SYSCALL_BIT + 201) }, - { "timer_create", (__X32_SYSCALL_BIT + 526) }, - { "timer_delete", (__X32_SYSCALL_BIT + 226) }, - { "timer_getoverrun", (__X32_SYSCALL_BIT + 225) }, - { "timer_gettime", (__X32_SYSCALL_BIT + 224) }, - { "timer_settime", (__X32_SYSCALL_BIT + 223) }, - { "timerfd_create", (__X32_SYSCALL_BIT + 283) }, - { "timerfd_gettime", (__X32_SYSCALL_BIT + 287) }, - { "timerfd_settime", (__X32_SYSCALL_BIT + 286) }, - { "times", (__X32_SYSCALL_BIT + 100) }, - { "tkill", (__X32_SYSCALL_BIT + 200) }, - { "truncate", (__X32_SYSCALL_BIT + 76) }, - { "truncate64", __PNR_truncate64 }, - { "tuxcall", (__X32_SYSCALL_BIT + 184) }, - { "ugetrlimit", __PNR_ugetrlimit }, - { "ulimit", __PNR_ulimit }, - { "umask", (__X32_SYSCALL_BIT + 95) }, - { "umount", __PNR_umount }, - { "umount2", (__X32_SYSCALL_BIT + 166) }, - { "uname", (__X32_SYSCALL_BIT + 63) }, - { "unlink", (__X32_SYSCALL_BIT + 87) }, - { "unlinkat", (__X32_SYSCALL_BIT + 263) }, - { "unshare", (__X32_SYSCALL_BIT + 272) }, - { "uselib", __PNR_uselib }, - { "ustat", (__X32_SYSCALL_BIT + 136) }, - { "utime", (__X32_SYSCALL_BIT + 132) }, - { "utimensat", (__X32_SYSCALL_BIT + 280) }, - { "utimes", (__X32_SYSCALL_BIT + 235) }, - { "vfork", (__X32_SYSCALL_BIT + 58) }, - { "vhangup", (__X32_SYSCALL_BIT + 153) }, - { "vm86", __PNR_vm86 }, - { "vm86old", __PNR_vm86old }, - { "vmsplice", (__X32_SYSCALL_BIT + 532) }, - { "vserver", __PNR_vserver }, - { "wait4", (__X32_SYSCALL_BIT + 61) }, - { "waitid", (__X32_SYSCALL_BIT + 529) }, - { "waitpid", __PNR_waitpid }, - { "write", (__X32_SYSCALL_BIT + 1) }, - { "writev", (__X32_SYSCALL_BIT + 516) }, - { NULL, __NR_SCMP_ERROR }, -}; +#define __SCMP_X32_SYSCALL_BIT 0x40000000 /** * Resolve a syscall name to a number @@ -435,16 +40,13 @@ const struct arch_syscall_def x32_syscall_table[] = \ */ int x32_syscall_resolve_name(const char *name) { - unsigned int iter; - const struct arch_syscall_def *table = x32_syscall_table; + int syscall; - /* 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; - } + syscall = x86_64_syscall_resolve_name(name); + if (syscall >= 0) + syscall |= __SCMP_X32_SYSCALL_BIT; - return __NR_SCMP_ERROR; + return syscall; } /** @@ -458,14 +60,10 @@ int x32_syscall_resolve_name(const char *name) */ const char *x32_syscall_resolve_num(int num) { - unsigned int iter; - const struct arch_syscall_def *table = x32_syscall_table; + int syscall = num; - /* 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; - } + if (syscall >= 0) + syscall &= (~__SCMP_X32_SYSCALL_BIT); - return NULL; + return x86_64_syscall_resolve_num(syscall); } |