[CRIU] [PATCH 4/8] arm: fixed AArch64 syscall numbers

Alexander Kartashov alekskartashov at parallels.com
Thu Oct 10 23:48:01 PDT 2013


It turned out that AArch64 uses the UAPI syscall numbering scheme
that is incompatible with x86. Unfortunately this kills the idea
of the unified syscall table and syscall generator.

Note that the following syscalls:

* open,
* mkdir,
* rmdir,
* unlink,

are declared obsolete in the UAPI. Moreover the syscall arch_prctl
doesn't exist in the UAPI.

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/arm/gen-sys-exec-tbl.pl |    4 +-
 arch/arm/gen-syscalls.pl     |    4 +-
 arch/arm/syscall.def         |  169 +++++++++++++++++++++---------------------
 3 files changed, 90 insertions(+), 87 deletions(-)

diff --git a/arch/arm/gen-sys-exec-tbl.pl b/arch/arm/gen-sys-exec-tbl.pl
index 1746a0c..a3037b7 100755
--- a/arch/arm/gen-sys-exec-tbl.pl
+++ b/arch/arm/gen-sys-exec-tbl.pl
@@ -22,9 +22,9 @@ for (<IN>) {
 	my $sys_name;
 	my $sys_num;
 
-	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
 		$sys_name = $+{alias};
-	} elsif (/(?<name>\S+)\s+(?<code64>\d+)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
 		$sys_name = $+{name};
 	} else {
 		unlink $tblout;
diff --git a/arch/arm/gen-syscalls.pl b/arch/arm/gen-syscalls.pl
index 9176f01..6fb8f3b 100755
--- a/arch/arm/gen-syscalls.pl
+++ b/arch/arm/gen-syscalls.pl
@@ -61,10 +61,10 @@ for (<IN>) {
 	my $code_macro;
 	my $sys_name;
 
-	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+	if (/(?<name>\S+)\s+(?<alias>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
 		$code_macro = "__NR_$+{name}";
 		$sys_name   = "sys_$+{alias}";
-	} elsif (/(?<name>\S+)\s+(?<code64>\d+)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
+	} elsif (/(?<name>\S+)\s+(?<code64>\d+|\!)\s+(?<code32>(?:\d+|\!))\s+\((?<args>.+)\)/) {
 		$code_macro = "__NR_$+{name}";
 		$sys_name   = "sys_$+{name}";
 	} else {
diff --git a/arch/arm/syscall.def b/arch/arm/syscall.def
index 0ba78c3..f37f806 100644
--- a/arch/arm/syscall.def
+++ b/arch/arm/syscall.def
@@ -5,88 +5,91 @@
 # The template is (name and arguments are optinal if you need only __NR_x
 # defined, but no realy entry point in syscalls lib).
 #
-# name/alias			code	code32	arguments
+# name/alias			code64	code32	arguments
 # -----------------------------------------------------------------------
 #
-read				0	3	(int fd, void *buf, unsigned long count)
-write				1	4	(int fd, const void *buf, unsigned long count)
-open				2	5	(const char *filename, unsigned long flags, unsigned long mode)
-close				3	6	(int fd)
-lseek				8	19	(int fd, unsigned long offset, unsigned long origin)
-mmap				9	!	(void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
-mprotect			10	125	(const void *addr, unsigned long len, unsigned long prot)
-munmap				11	91	(void *addr, unsigned long len)
-brk				12	45	(void *addr)
-rt_sigaction	sigaction	13	174	(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
-rt_sigprocmask	sigprocmask	14	175	(int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
-rt_sigreturn			15	173	(void)
-ioctl				16	54	(unsigned int fd, unsigned int cmd, unsigned long arg)
-pread64				17	180	(unsigned int fd, char *buf, size_t count, loff_t pos)
-mremap				25	163	(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flag, unsigned long new_addr)
-mincore				27	219	(void *addr, unsigned long size, unsigned char *vec)
-madvise				28	220	(unsigned long start, size_t len, int behavior)
-shmat				30	305	(int shmid, void *shmaddr, int shmflag)
-pause				34	29	(void)
-nanosleep			35	162	(struct timespec *req, struct timespec *rem)
-getitimer			36	105	(int which, const struct itimerval *val)
-setitimer			38	104	(int which, const struct itimerval *val, struct itimerval *old)
-getpid				39	20	(void)
-socket				41	281	(int domain, int type, int protocol)
-connect				42	283	(int sockfd, struct sockaddr *addr, int addrlen)
-sendto				44	290	(int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
-recvfrom			52	292	(int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
-sendmsg				46	296	(int sockfd, const struct msghdr *msg, int flags)
-recvmsg				47	297	(int sockfd, struct msghdr *msg, int flags)
-shutdown			48	293	(int sockfd, int how)
-bind				49	282	(int sockfd, const struct sockaddr *addr, int addrlen)
-setsockopt			54	294	(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
-getsockopt			55	295	(int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
-clone				56	120	(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
-exit				60	1	(unsigned long error_code)
-wait4				61	114	(int pid, int *status, int options, struct rusage *ru)
-kill				62	37	(long pid, int sig)
-fcntl				72	55	(int fd, int type, long arg)
-flock				73	143	(int fd, unsigned long cmd)
-mkdir				83	39	(const char *name, int mode)
-rmdir				84	40	(const char *name)
-unlink				87	10	(char *pathname)
-readlink			89	85	(const char *path, char *buf, int bufsize)
-umask				95	60	(int mask)
-getgroups			115	205	(int gsize, unsigned int *groups)
-setresuid			117	164	(int uid, int euid, int suid)
-setresgid			119	170	(int gid, int egid, int sgid)
-getpgid				121	132	(pid_t pid)
-setfsuid			122	138	(int fsuid)
-setfsgid			123	139	(int fsgid)
-getsid				124	147	(void)
-capset				126	185	(struct cap_header *h, struct cap_data *d)
-rt_sigqueueinfo			129     178	(pid_t pid, int sig, siginfo_t *info)
-setpriority			141	97	(int which, int who, int nice)
-sched_setscheduler		144	156	(int pid, int policy, struct sched_param *p)
-sigaltstack			131	186	(const void *uss, void *uoss)
-personality			135	136	(unsigned int personality)
-prctl				157	172	(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
-arch_prctl			158	17	(int option, unsigned long addr)
-setrlimit			160	75	(int resource, struct krlimit *rlim)
-mount				165	21	(char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
-umount2				166	52	(char *name, int flags)
-gettid				186	224	(void)
-futex				202	240	(u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
-set_tid_address			218	256	(int *tid_addr)
-restart_syscall			219	0	(void)
-timer_create			222	257	(clockid_t which_clock, struct sigevent *timer_event_spec, timer_t *created_timer_id)
-timer_settime			223	258	(timer_t timer_id, int flags, const struct itimerspec *new_setting, struct itimerspec *old_setting)
-timer_gettime			224	259	(int timer_id, const struct itimerspec *setting)
-timer_getoverrun		225	260	(int timer_id)
-timer_delete			226	261	(timer_t timer_id)
-exit_group			231	248	(int error_code)
-set_robust_list			273	338	(struct robust_list_head *head, size_t len)
-get_robust_list			274	339	(int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
-signalfd4			289	355	(int fd, k_rtsigset_t *mask, size_t sizemask, int flags)
-rt_tgsigqueueinfo		297	363	(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
-vmsplice			278	343	(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags)
-fanotify_init			300	367	(unsigned int flags, unsigned int event_f_flags)
-fanotify_mark			301	368	(int fanotify_fd, unsigned int flags, u64 mask, int dfd, const char *pathname)
-open_by_handle_at		304	371	(int mountdirfd, struct file_handle *handle, int flags)
-setns				308	375	(int fd, int nstype)
-kcmp				312	378	(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
+read				63	3	(int fd, void *buf, unsigned long count)
+write				64	4	(int fd, const void *buf, unsigned long count)
+open				!	5	(const char *filename, unsigned long flags, unsigned long mode)
+close				57	6	(int fd)
+lseek				62	19	(int fd, unsigned long offset, unsigned long origin)
+mmap				222	!	(void *addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long offset)
+mprotect			226	125	(const void *addr, unsigned long len, unsigned long prot)
+munmap				215	91	(void *addr, unsigned long len)
+brk				214	45	(void *addr)
+rt_sigaction	sigaction	134	174	(int signum, const rt_sigaction_t *act, rt_sigaction_t *oldact, size_t sigsetsize)
+rt_sigprocmask	sigprocmask	135	175	(int how, k_rtsigset_t *set, k_rtsigset_t *old, size_t sigsetsize)
+rt_sigreturn			139	173	(void)
+ioctl				29	54	(unsigned int fd, unsigned int cmd, unsigned long arg)
+pread64				67	180	(unsigned int fd, char *buf, size_t count, loff_t pos)
+mremap				216	163	(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flag, unsigned long new_addr)
+mincore				232	219	(void *addr, unsigned long size, unsigned char *vec)
+madvise				233	220	(unsigned long start, size_t len, int behavior)
+shmat				196	305	(int shmid, void *shmaddr, int shmflag)
+pause				1061	29	(void)
+nanosleep			101	162	(struct timespec *req, struct timespec *rem)
+getitimer			102	105	(int which, const struct itimerval *val)
+setitimer			103	104	(int which, const struct itimerval *val, struct itimerval *old)
+getpid				172	20	(void)
+socket				198	281	(int domain, int type, int protocol)
+connect				203	283	(int sockfd, struct sockaddr *addr, int addrlen)
+sendto				206	290	(int sockfd, void *buff, size_t len, unsigned int flags, struct sockaddr *addr, int addr_len)
+recvfrom			207	292	(int sockfd, void *ubuf, size_t size, unsigned int flags, struct sockaddr *addr, int *addr_len)
+sendmsg				211	296	(int sockfd, const struct msghdr *msg, int flags)
+recvmsg				212	297	(int sockfd, struct msghdr *msg, int flags)
+shutdown			210	293	(int sockfd, int how)
+bind				235	282	(int sockfd, const struct sockaddr *addr, int addrlen)
+setsockopt			208	294	(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
+getsockopt			209	295	(int sockfd, int level, int optname, const void *optval, socklen_t *optlen)
+clone				220	120	(unsigned long flags, void *child_stack, void *parent_tid, void *child_tid)
+exit				93	1	(unsigned long error_code)
+wait4				260	114	(int pid, int *status, int options, struct rusage *ru)
+kill				129	37	(long pid, int sig)
+fcntl				25	55	(int fd, int type, long arg)
+flock				32	143	(int fd, unsigned long cmd)
+mkdir				!	39	(const char *name, int mode)
+rmdir				!	40	(const char *name)
+unlink				!	10	(char *pathname)
+readlink			78	85	(const char *path, char *buf, int bufsize)
+umask				166	60	(int mask)
+getgroups			158	205	(int gsize, unsigned int *groups)
+setresuid			147	164	(int uid, int euid, int suid)
+setresgid			149	170	(int gid, int egid, int sgid)
+getpgid				155	132	(pid_t pid)
+setfsuid			151	138	(int fsuid)
+setfsgid			152	139	(int fsgid)
+getsid				156	147	(void)
+capset				91	185	(struct cap_header *h, struct cap_data *d)
+rt_sigqueueinfo			138	178	(pid_t pid, int sig, siginfo_t *info)
+setpriority			140	97	(int which, int who, int nice)
+sched_setscheduler		119	156	(int pid, int policy, struct sched_param *p)
+sigaltstack			132	186	(const void *uss, void *uoss)
+personality			92	136	(unsigned int personality)
+prctl				167	172	(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5)
+arch_prctl			!	17	(int option, unsigned long addr)
+setrlimit			164	75	(int resource, struct krlimit *rlim)
+mount				40	21	(char *dev_nmae, char *dir_name, char *type, unsigned long flags, void *data)
+umount2				39	52	(char *name, int flags)
+gettid				178	224	(void)
+futex				98	240	(u32 *uaddr, int op, u32 val, struct timespec *utime, u32 *uaddr2, u32 val3)
+set_tid_address			96	256	(int *tid_addr)
+restart_syscall			128	0	(void)
+timer_create			107	257	(clockid_t which_clock, struct sigevent *timer_event_spec, timer_t *created_timer_id)
+timer_settime			110	258	(timer_t timer_id, int flags, const struct itimerspec *new_setting, struct itimerspec *old_setting)
+timer_gettime			108	259	(int timer_id, const struct itimerspec *setting)
+timer_getoverrun		109	260	(int timer_id)
+timer_delete			111	261	(timer_t timer_id)
+exit_group			94	248	(int error_code)
+set_robust_list			99	338	(struct robust_list_head *head, size_t len)
+get_robust_list			100	339	(int pid, struct robust_list_head **head_ptr, size_t *len_ptr)
+signalfd4			74	355	(int fd, k_rtsigset_t *mask, size_t sizemask, int flags)
+rt_tgsigqueueinfo		240	363	(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
+vmsplice			75	343	(int fd, const struct iovec *iov, unsigned long nr_segs, unsigned int flags)
+fanotify_init			262	367	(unsigned int flags, unsigned int event_f_flags)
+fanotify_mark			263	368	(int fanotify_fd, unsigned int flags, u64 mask, int dfd, const char *pathname)
+open_by_handle_at		265	371	(int mountdirfd, struct file_handle *handle, int flags)
+setns				268	375	(int fd, int nstype)
+kcmp				272	378	(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2)
+openat				56	322	(int dirfd, const char *pathname, int flags, mode_t mode)
+mkdirat				34	323	(int dirfd, const char *pathname, mode_t mode)
+unlinkat			35	328	(int dirfd, const char *pathname, int flags)
-- 
1.7.9.5



More information about the CRIU mailing list