Skip to content

Commit

Permalink
Fix Aarch64 syscalls (#897)
Browse files Browse the repository at this point in the history
* Remove unavailable syscalls from AArch64

The Linux kernel has apparently stopped supporting these

* Rewrite shellcraft.aarch64.linux.cat, add open which uses openat

Fixes #896

* Fix doctests to use openat
  • Loading branch information
zachriggle authored Feb 13, 2017
1 parent 3937513 commit 71855eb
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 307 deletions.
111 changes: 0 additions & 111 deletions pwnlib/constants/linux/aarch64.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pwnlib.constants.constant import Constant

__NR_io_setup = Constant('__NR_io_setup',0)
__NR_io_destroy = Constant('__NR_io_destroy',1)
__NR_io_submit = Constant('__NR_io_submit',2)
Expand Down Expand Up @@ -259,63 +258,6 @@
__NR_process_vm_writev = Constant('__NR_process_vm_writev',271)
__NR_kcmp = Constant('__NR_kcmp',272)
__NR_finit_module = Constant('__NR_finit_module',273)
__NR_open = Constant('__NR_open',1024)
__NR_link = Constant('__NR_link',1025)
__NR_unlink = Constant('__NR_unlink',1026)
__NR_mknod = Constant('__NR_mknod',1027)
__NR_chmod = Constant('__NR_chmod',1028)
__NR_chown = Constant('__NR_chown',1029)
__NR_mkdir = Constant('__NR_mkdir',1030)
__NR_rmdir = Constant('__NR_rmdir',1031)
__NR_lchown = Constant('__NR_lchown',1032)
__NR_access = Constant('__NR_access',1033)
__NR_rename = Constant('__NR_rename',1034)
__NR_readlink = Constant('__NR_readlink',1035)
__NR_symlink = Constant('__NR_symlink',1036)
__NR_utimes = Constant('__NR_utimes',1037)
__NR_stat = Constant('__NR_stat',1038)
__NR_lstat = Constant('__NR_lstat',1039)
__NR_pipe = Constant('__NR_pipe',1040)
__NR_dup2 = Constant('__NR_dup2',1041)
__NR_epoll_create = Constant('__NR_epoll_create',1042)
__NR_inotify_init = Constant('__NR_inotify_init',1043)
__NR_eventfd = Constant('__NR_eventfd',1044)
__NR_signalfd = Constant('__NR_signalfd',1045)
__NR_sendfile64 = Constant('__NR_sendfile64',1046)
__NR_ftruncate64 = Constant('__NR_ftruncate64',1047)
__NR_truncate64 = Constant('__NR_truncate64',1048)
__NR_stat64 = Constant('__NR_stat64',1049)
__NR_lstat64 = Constant('__NR_lstat64',1050)
__NR_fstat64 = Constant('__NR_fstat64',1051)
__NR_fcntl64 = Constant('__NR_fcntl64',1052)
__NR_newfstatat = Constant('__NR_newfstatat',1054)
__NR_fstatfs64 = Constant('__NR_fstatfs64',1055)
__NR_statfs64 = Constant('__NR_statfs64',1056)
__NR_lseek64 = Constant('__NR_lseek64',1057)
__NR_mmap64 = Constant('__NR_mmap64',1058)
__NR_alarm = Constant('__NR_alarm',1059)
__NR_getpgrp = Constant('__NR_getpgrp',1060)
__NR_pause = Constant('__NR_pause',1061)
__NR_time = Constant('__NR_time',1062)
__NR_utime = Constant('__NR_utime',1063)
__NR_creat = Constant('__NR_creat',1064)
__NR_getdents = Constant('__NR_getdents',1065)
__NR_futimesat = Constant('__NR_futimesat',1066)
__NR_select = Constant('__NR_select',1067)
__NR_poll = Constant('__NR_poll',1068)
__NR_epoll_wait = Constant('__NR_epoll_wait',1069)
__NR_ustat = Constant('__NR_ustat',1070)
__NR_vfork = Constant('__NR_vfork',1071)
__NR_oldwait4 = Constant('__NR_oldwait4',1072)
__NR_recv = Constant('__NR_recv',1073)
__NR_send = Constant('__NR_send',1074)
__NR_bdflush = Constant('__NR_bdflush',1075)
__NR_umount = Constant('__NR_umount',1076)
__NR_uselib = Constant('__NR_uselib',1077)
__NR__sysctl = Constant('__NR__sysctl',1078)
__NR_fork = Constant('__NR_fork',1079)
__NR_syscalls = Constant('__NR_syscalls',(1079+1))
__NR_sigreturn = Constant('__NR_sigreturn',1999)
MAP_32BIT = Constant('MAP_32BIT',0x40)
INADDR_ANY = Constant('INADDR_ANY',0)
INADDR_BROADCAST = Constant('INADDR_BROADCAST',0xffffffff)
Expand Down Expand Up @@ -944,19 +886,14 @@
PCMASK = Constant('PCMASK',0)
SYS_accept = Constant('SYS_accept',202)
SYS_accept4 = Constant('SYS_accept4',242)
SYS_access = Constant('SYS_access',1033)
SYS_acct = Constant('SYS_acct',89)
SYS_add_key = Constant('SYS_add_key',217)
SYS_adjtimex = Constant('SYS_adjtimex',171)
SYS_alarm = Constant('SYS_alarm',1059)
SYS_bdflush = Constant('SYS_bdflush',1075)
SYS_bind = Constant('SYS_bind',200)
SYS_brk = Constant('SYS_brk',214)
SYS_capget = Constant('SYS_capget',90)
SYS_capset = Constant('SYS_capset',91)
SYS_chdir = Constant('SYS_chdir',49)
SYS_chmod = Constant('SYS_chmod',1028)
SYS_chown = Constant('SYS_chown',1029)
SYS_chroot = Constant('SYS_chroot',51)
SYS_clock_getres = Constant('SYS_clock_getres',114)
SYS_clock_gettime = Constant('SYS_clock_gettime',113)
Expand All @@ -965,17 +902,12 @@
SYS_clone = Constant('SYS_clone',220)
SYS_close = Constant('SYS_close',57)
SYS_connect = Constant('SYS_connect',203)
SYS_creat = Constant('SYS_creat',1064)
SYS_delete_module = Constant('SYS_delete_module',106)
SYS_dup = Constant('SYS_dup',23)
SYS_dup2 = Constant('SYS_dup2',1041)
SYS_dup3 = Constant('SYS_dup3',24)
SYS_epoll_create = Constant('SYS_epoll_create',1042)
SYS_epoll_create1 = Constant('SYS_epoll_create1',20)
SYS_epoll_ctl = Constant('SYS_epoll_ctl',21)
SYS_epoll_pwait = Constant('SYS_epoll_pwait',22)
SYS_epoll_wait = Constant('SYS_epoll_wait',1069)
SYS_eventfd = Constant('SYS_eventfd',1044)
SYS_eventfd2 = Constant('SYS_eventfd2',19)
SYS_execve = Constant('SYS_execve',221)
SYS_exit = Constant('SYS_exit',93)
Expand All @@ -991,27 +923,20 @@
SYS_fchown = Constant('SYS_fchown',55)
SYS_fchownat = Constant('SYS_fchownat',54)
SYS_fcntl = Constant('SYS_fcntl',25)
SYS_fcntl64 = Constant('SYS_fcntl64',1052)
SYS_fdatasync = Constant('SYS_fdatasync',83)
SYS_fgetxattr = Constant('SYS_fgetxattr',10)
SYS_flistxattr = Constant('SYS_flistxattr',13)
SYS_flock = Constant('SYS_flock',32)
SYS_fork = Constant('SYS_fork',1079)
SYS_fremovexattr = Constant('SYS_fremovexattr',16)
SYS_fsetxattr = Constant('SYS_fsetxattr',7)
SYS_fstat = Constant('SYS_fstat',80)
SYS_fstat64 = Constant('SYS_fstat64',1051)
SYS_fstatat64 = Constant('SYS_fstatat64',79)
SYS_fstatfs = Constant('SYS_fstatfs',44)
SYS_fstatfs64 = Constant('SYS_fstatfs64',1055)
SYS_fsync = Constant('SYS_fsync',82)
SYS_ftruncate = Constant('SYS_ftruncate',46)
SYS_ftruncate64 = Constant('SYS_ftruncate64',1047)
SYS_futex = Constant('SYS_futex',98)
SYS_futimesat = Constant('SYS_futimesat',1066)
SYS_getcpu = Constant('SYS_getcpu',168)
SYS_getcwd = Constant('SYS_getcwd',17)
SYS_getdents = Constant('SYS_getdents',1065)
SYS_getdents64 = Constant('SYS_getdents64',61)
SYS_getegid = Constant('SYS_getegid',177)
SYS_geteuid = Constant('SYS_geteuid',175)
Expand All @@ -1021,7 +946,6 @@
SYS_get_mempolicy = Constant('SYS_get_mempolicy',236)
SYS_getpeername = Constant('SYS_getpeername',205)
SYS_getpgid = Constant('SYS_getpgid',155)
SYS_getpgrp = Constant('SYS_getpgrp',1060)
SYS_getpid = Constant('SYS_getpid',172)
SYS_getppid = Constant('SYS_getppid',173)
SYS_getpriority = Constant('SYS_getpriority',141)
Expand All @@ -1039,7 +963,6 @@
SYS_getxattr = Constant('SYS_getxattr',8)
SYS_init_module = Constant('SYS_init_module',105)
SYS_inotify_add_watch = Constant('SYS_inotify_add_watch',27)
SYS_inotify_init = Constant('SYS_inotify_init',1043)
SYS_inotify_init1 = Constant('SYS_inotify_init1',26)
SYS_inotify_rm_watch = Constant('SYS_inotify_rm_watch',28)
SYS_io_cancel = Constant('SYS_io_cancel',3)
Expand All @@ -1053,9 +976,7 @@
SYS_kexec_load = Constant('SYS_kexec_load',104)
SYS_keyctl = Constant('SYS_keyctl',219)
SYS_kill = Constant('SYS_kill',129)
SYS_lchown = Constant('SYS_lchown',1032)
SYS_lgetxattr = Constant('SYS_lgetxattr',9)
SYS_link = Constant('SYS_link',1025)
SYS_linkat = Constant('SYS_linkat',37)
SYS_listen = Constant('SYS_listen',201)
SYS_listxattr = Constant('SYS_listxattr',11)
Expand All @@ -1064,15 +985,11 @@
SYS_lremovexattr = Constant('SYS_lremovexattr',15)
SYS_lseek = Constant('SYS_lseek',62)
SYS_lsetxattr = Constant('SYS_lsetxattr',6)
SYS_lstat = Constant('SYS_lstat',1039)
SYS_lstat64 = Constant('SYS_lstat64',1050)
SYS_madvise = Constant('SYS_madvise',233)
SYS_mbind = Constant('SYS_mbind',235)
SYS_migrate_pages = Constant('SYS_migrate_pages',238)
SYS_mincore = Constant('SYS_mincore',232)
SYS_mkdir = Constant('SYS_mkdir',1030)
SYS_mkdirat = Constant('SYS_mkdirat',34)
SYS_mknod = Constant('SYS_mknod',1027)
SYS_mknodat = Constant('SYS_mknodat',33)
SYS_mlock = Constant('SYS_mlock',228)
SYS_mlockall = Constant('SYS_mlockall',230)
Expand All @@ -1096,17 +1013,12 @@
SYS_munlockall = Constant('SYS_munlockall',231)
SYS_munmap = Constant('SYS_munmap',215)
SYS_nanosleep = Constant('SYS_nanosleep',101)
SYS_newfstatat = Constant('SYS_newfstatat',1054)
SYS_nfsservctl = Constant('SYS_nfsservctl',42)
SYS_open = Constant('SYS_open',1024)
SYS_openat = Constant('SYS_openat',56)
SYS_pause = Constant('SYS_pause',1061)
SYS_perf_event_open = Constant('SYS_perf_event_open',241)
SYS_personality = Constant('SYS_personality',92)
SYS_pipe = Constant('SYS_pipe',1040)
SYS_pipe2 = Constant('SYS_pipe2',59)
SYS_pivot_root = Constant('SYS_pivot_root',41)
SYS_poll = Constant('SYS_poll',1068)
SYS_ppoll = Constant('SYS_ppoll',73)
SYS_prctl = Constant('SYS_prctl',167)
SYS_pread64 = Constant('SYS_pread64',67)
Expand All @@ -1119,21 +1031,17 @@
SYS_quotactl = Constant('SYS_quotactl',60)
SYS_read = Constant('SYS_read',63)
SYS_readahead = Constant('SYS_readahead',213)
SYS_readlink = Constant('SYS_readlink',1035)
SYS_readlinkat = Constant('SYS_readlinkat',78)
SYS_readv = Constant('SYS_readv',65)
SYS_reboot = Constant('SYS_reboot',142)
SYS_recv = Constant('SYS_recv',1073)
SYS_recvfrom = Constant('SYS_recvfrom',207)
SYS_recvmmsg = Constant('SYS_recvmmsg',243)
SYS_recvmsg = Constant('SYS_recvmsg',212)
SYS_remap_file_pages = Constant('SYS_remap_file_pages',234)
SYS_removexattr = Constant('SYS_removexattr',14)
SYS_rename = Constant('SYS_rename',1034)
SYS_renameat = Constant('SYS_renameat',38)
SYS_request_key = Constant('SYS_request_key',218)
SYS_restart_syscall = Constant('SYS_restart_syscall',128)
SYS_rmdir = Constant('SYS_rmdir',1031)
SYS_rt_sigaction = Constant('SYS_rt_sigaction',134)
SYS_rt_sigpending = Constant('SYS_rt_sigpending',136)
SYS_rt_sigprocmask = Constant('SYS_rt_sigprocmask',135)
Expand All @@ -1152,14 +1060,11 @@
SYS_sched_setparam = Constant('SYS_sched_setparam',118)
SYS_sched_setscheduler = Constant('SYS_sched_setscheduler',119)
SYS_sched_yield = Constant('SYS_sched_yield',124)
SYS_select = Constant('SYS_select',1067)
SYS_semctl = Constant('SYS_semctl',191)
SYS_semget = Constant('SYS_semget',190)
SYS_semop = Constant('SYS_semop',193)
SYS_semtimedop = Constant('SYS_semtimedop',192)
SYS_send = Constant('SYS_send',1074)
SYS_sendfile = Constant('SYS_sendfile',71)
SYS_sendfile64 = Constant('SYS_sendfile64',1046)
SYS_sendmsg = Constant('SYS_sendmsg',211)
SYS_sendto = Constant('SYS_sendto',206)
SYS_setdomainname = Constant('SYS_setdomainname',162)
Expand Down Expand Up @@ -1190,28 +1095,20 @@
SYS_shmget = Constant('SYS_shmget',194)
SYS_shutdown = Constant('SYS_shutdown',210)
SYS_sigaltstack = Constant('SYS_sigaltstack',132)
SYS_signalfd = Constant('SYS_signalfd',1045)
SYS_signalfd4 = Constant('SYS_signalfd4',74)
SYS_sigreturn = Constant('SYS_sigreturn',1999)
SYS_socket = Constant('SYS_socket',198)
SYS_socketpair = Constant('SYS_socketpair',199)
SYS_splice = Constant('SYS_splice',76)
SYS_stat = Constant('SYS_stat',1038)
SYS_stat64 = Constant('SYS_stat64',1049)
SYS_statfs = Constant('SYS_statfs',43)
SYS_statfs64 = Constant('SYS_statfs64',1056)
SYS_swapoff = Constant('SYS_swapoff',225)
SYS_swapon = Constant('SYS_swapon',224)
SYS_symlink = Constant('SYS_symlink',1036)
SYS_symlinkat = Constant('SYS_symlinkat',36)
SYS_sync = Constant('SYS_sync',81)
SYS_sync_file_range2 = Constant('SYS_sync_file_range2',84)
SYS__sysctl = Constant('SYS__sysctl',1078)
SYS_sysinfo = Constant('SYS_sysinfo',179)
SYS_syslog = Constant('SYS_syslog',116)
SYS_tee = Constant('SYS_tee',77)
SYS_tgkill = Constant('SYS_tgkill',131)
SYS_time = Constant('SYS_time',1062)
SYS_timer_create = Constant('SYS_timer_create',107)
SYS_timer_delete = Constant('SYS_timer_delete',111)
SYS_timerfd_create = Constant('SYS_timerfd_create',85)
Expand All @@ -1223,20 +1120,12 @@
SYS_times = Constant('SYS_times',153)
SYS_tkill = Constant('SYS_tkill',130)
SYS_truncate = Constant('SYS_truncate',45)
SYS_truncate64 = Constant('SYS_truncate64',1048)
SYS_umask = Constant('SYS_umask',166)
SYS_umount = Constant('SYS_umount',1076)
SYS_umount2 = Constant('SYS_umount2',39)
SYS_uname = Constant('SYS_uname',160)
SYS_unlink = Constant('SYS_unlink',1026)
SYS_unlinkat = Constant('SYS_unlinkat',35)
SYS_unshare = Constant('SYS_unshare',97)
SYS_uselib = Constant('SYS_uselib',1077)
SYS_ustat = Constant('SYS_ustat',1070)
SYS_utime = Constant('SYS_utime',1063)
SYS_utimensat = Constant('SYS_utimensat',88)
SYS_utimes = Constant('SYS_utimes',1037)
SYS_vfork = Constant('SYS_vfork',1071)
SYS_vhangup = Constant('SYS_vhangup',58)
SYS_vmsplice = Constant('SYS_vmsplice',75)
SYS_wait4 = Constant('SYS_wait4',260)
Expand Down
59 changes: 0 additions & 59 deletions pwnlib/data/includes/generator/linux/diet/aarch64/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,62 +262,3 @@
#define __NR_process_vm_writev 271
#define __NR_kcmp 272
#define __NR_finit_module 273
#define __NR_open 1024
#define __NR_link 1025
#define __NR_unlink 1026
#define __NR_mknod 1027
#define __NR_chmod 1028
#define __NR_chown 1029
#define __NR_mkdir 1030
#define __NR_rmdir 1031
#define __NR_lchown 1032
#define __NR_access 1033
#define __NR_rename 1034
#define __NR_readlink 1035
#define __NR_symlink 1036
#define __NR_utimes 1037
#define __NR_stat 1038
#define __NR_lstat 1039
#define __NR_pipe 1040
#define __NR_dup2 1041
#define __NR_epoll_create 1042
#define __NR_inotify_init 1043
#define __NR_eventfd 1044
#define __NR_signalfd 1045
#define __NR_sendfile64 1046
#define __NR_ftruncate64 1047
#define __NR_truncate64 1048
#define __NR_stat64 1049
#define __NR_lstat64 1050
#define __NR_fstat64 1051
#define __NR_fcntl64 1052
/* #define __NR_fadvise64 1053 */
#define __NR_newfstatat 1054
#define __NR_fstatfs64 1055
#define __NR_statfs64 1056
#define __NR_lseek64 1057
#define __NR_mmap64 1058
#define __NR_alarm 1059
#define __NR_getpgrp 1060
#define __NR_pause 1061
#define __NR_time 1062
#define __NR_utime 1063
#define __NR_creat 1064
#define __NR_getdents 1065
#define __NR_futimesat 1066
#define __NR_select 1067
#define __NR_poll 1068
#define __NR_epoll_wait 1069
#define __NR_ustat 1070
#define __NR_vfork 1071
#define __NR_oldwait4 1072
#define __NR_recv 1073
#define __NR_send 1074
#define __NR_bdflush 1075
#define __NR_umount 1076
#define __NR_uselib 1077
#define __NR__sysctl 1078
#define __NR_fork 1079
#define __NR_syscalls (__NR_fork+1)

#define __NR_sigreturn 1999
Loading

0 comments on commit 71855eb

Please sign in to comment.