diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-18 00:55:54 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-22 18:14:17 -0400 |
commit | e0fd18ce1169595df929373cad2ae9b00b2289c2 (patch) | |
tree | ce64180c3935d636de9bac9fbf63d27a0d4d7876 /arch/arm64 | |
parent | 6a872777ffff6184f4ac10bd71d926d5e6f2491e (diff) |
arm64: get rid of fork/vfork/clone wrappers
[fixes from Catalin Marinas folded]
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/syscalls.h | 11 | ||||
-rw-r--r-- | arch/arm64/include/asm/unistd32.h | 6 | ||||
-rw-r--r-- | arch/arm64/kernel/entry.S | 5 | ||||
-rw-r--r-- | arch/arm64/kernel/process.c | 10 | ||||
-rw-r--r-- | arch/arm64/kernel/sys.c | 11 | ||||
-rw-r--r-- | arch/arm64/kernel/sys32.S | 14 | ||||
-rw-r--r-- | arch/arm64/kernel/sys_compat.c | 20 |
7 files changed, 25 insertions, 52 deletions
diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h index 81680a0ae913..a1b00cd6f786 100644 --- a/arch/arm64/include/asm/syscalls.h +++ b/arch/arm64/include/asm/syscalls.h | |||
@@ -23,15 +23,16 @@ | |||
23 | /* | 23 | /* |
24 | * System call wrappers implemented in kernel/entry.S. | 24 | * System call wrappers implemented in kernel/entry.S. |
25 | */ | 25 | */ |
26 | asmlinkage long sys_clone_wrapper(unsigned long clone_flags, | ||
27 | unsigned long newsp, | ||
28 | void __user *parent_tid, | ||
29 | unsigned long tls_val, | ||
30 | void __user *child_tid); | ||
31 | asmlinkage long sys_rt_sigreturn_wrapper(void); | 26 | asmlinkage long sys_rt_sigreturn_wrapper(void); |
32 | asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, | 27 | asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, |
33 | stack_t __user *uoss); | 28 | stack_t __user *uoss); |
34 | 29 | ||
30 | /* | ||
31 | * AArch64 sys_clone implementation has a different prototype than the generic | ||
32 | * one (additional TLS value argument). | ||
33 | */ | ||
34 | #define sys_clone sys_clone | ||
35 | |||
35 | #include <asm-generic/syscalls.h> | 36 | #include <asm-generic/syscalls.h> |
36 | 37 | ||
37 | #endif /* __ASM_SYSCALLS_H */ | 38 | #endif /* __ASM_SYSCALLS_H */ |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 9035e6add3e4..d9850cf9870d 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | __SYSCALL(0, sys_restart_syscall) | 24 | __SYSCALL(0, sys_restart_syscall) |
25 | __SYSCALL(1, sys_exit) | 25 | __SYSCALL(1, sys_exit) |
26 | __SYSCALL(2, compat_sys_fork_wrapper) | 26 | __SYSCALL(2, compat_sys_fork) |
27 | __SYSCALL(3, sys_read) | 27 | __SYSCALL(3, sys_read) |
28 | __SYSCALL(4, sys_write) | 28 | __SYSCALL(4, sys_write) |
29 | __SYSCALL(5, compat_sys_open) | 29 | __SYSCALL(5, compat_sys_open) |
@@ -141,7 +141,7 @@ __SYSCALL(116, compat_sys_sysinfo) | |||
141 | __SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */ | 141 | __SYSCALL(117, sys_ni_syscall) /* 117 was sys_ipc */ |
142 | __SYSCALL(118, sys_fsync) | 142 | __SYSCALL(118, sys_fsync) |
143 | __SYSCALL(119, compat_sys_sigreturn_wrapper) | 143 | __SYSCALL(119, compat_sys_sigreturn_wrapper) |
144 | __SYSCALL(120, compat_sys_clone_wrapper) | 144 | __SYSCALL(120, sys_clone) |
145 | __SYSCALL(121, sys_setdomainname) | 145 | __SYSCALL(121, sys_setdomainname) |
146 | __SYSCALL(122, sys_newuname) | 146 | __SYSCALL(122, sys_newuname) |
147 | __SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */ | 147 | __SYSCALL(123, sys_ni_syscall) /* 123 was sys_modify_ldt */ |
@@ -211,7 +211,7 @@ __SYSCALL(186, compat_sys_sigaltstack_wrapper) | |||
211 | __SYSCALL(187, compat_sys_sendfile) | 211 | __SYSCALL(187, compat_sys_sendfile) |
212 | __SYSCALL(188, sys_ni_syscall) /* 188 reserved */ | 212 | __SYSCALL(188, sys_ni_syscall) /* 188 reserved */ |
213 | __SYSCALL(189, sys_ni_syscall) /* 189 reserved */ | 213 | __SYSCALL(189, sys_ni_syscall) /* 189 reserved */ |
214 | __SYSCALL(190, compat_sys_vfork_wrapper) | 214 | __SYSCALL(190, compat_sys_vfork) |
215 | __SYSCALL(191, compat_sys_getrlimit) /* SuS compliant getrlimit */ | 215 | __SYSCALL(191, compat_sys_getrlimit) /* SuS compliant getrlimit */ |
216 | __SYSCALL(192, sys_mmap_pgoff) | 216 | __SYSCALL(192, sys_mmap_pgoff) |
217 | __SYSCALL(193, compat_sys_truncate64_wrapper) | 217 | __SYSCALL(193, compat_sys_truncate64_wrapper) |
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 616531862d52..cbfa4d28100e 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S | |||
@@ -676,11 +676,6 @@ __sys_trace_return: | |||
676 | /* | 676 | /* |
677 | * Special system call wrappers. | 677 | * Special system call wrappers. |
678 | */ | 678 | */ |
679 | ENTRY(sys_clone_wrapper) | ||
680 | mov x5, sp | ||
681 | b sys_clone | ||
682 | ENDPROC(sys_clone_wrapper) | ||
683 | |||
684 | ENTRY(sys_rt_sigreturn_wrapper) | 679 | ENTRY(sys_rt_sigreturn_wrapper) |
685 | mov x0, sp | 680 | mov x0, sp |
686 | b sys_rt_sigreturn | 681 | b sys_rt_sigreturn |
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index bf615e212c6c..f82987a784af 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c | |||
@@ -246,14 +246,20 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, | |||
246 | *childregs = *regs; | 246 | *childregs = *regs; |
247 | childregs->regs[0] = 0; | 247 | childregs->regs[0] = 0; |
248 | if (is_compat_thread(task_thread_info(p))) { | 248 | if (is_compat_thread(task_thread_info(p))) { |
249 | childregs->compat_sp = stack_start; | 249 | if (stack_start) |
250 | childregs->compat_sp = stack_start; | ||
250 | } else { | 251 | } else { |
251 | /* | 252 | /* |
252 | * Read the current TLS pointer from tpidr_el0 as it may be | 253 | * Read the current TLS pointer from tpidr_el0 as it may be |
253 | * out-of-sync with the saved value. | 254 | * out-of-sync with the saved value. |
254 | */ | 255 | */ |
255 | asm("mrs %0, tpidr_el0" : "=r" (tls)); | 256 | asm("mrs %0, tpidr_el0" : "=r" (tls)); |
256 | childregs->sp = stack_start; | 257 | if (stack_start) { |
258 | /* 16-byte aligned stack mandatory on AArch64 */ | ||
259 | if (stack_start & 15) | ||
260 | return -EINVAL; | ||
261 | childregs->sp = stack_start; | ||
262 | } | ||
257 | } | 263 | } |
258 | /* | 264 | /* |
259 | * If a TLS pointer was passed to clone (4th argument), use it | 265 | * If a TLS pointer was passed to clone (4th argument), use it |
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index 9c77c0bacc1d..4364df85050e 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c | |||
@@ -31,14 +31,10 @@ | |||
31 | */ | 31 | */ |
32 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, | 32 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, |
33 | int __user *parent_tidptr, unsigned long tls_val, | 33 | int __user *parent_tidptr, unsigned long tls_val, |
34 | int __user *child_tidptr, struct pt_regs *regs) | 34 | int __user *child_tidptr) |
35 | { | 35 | { |
36 | if (!newsp) | 36 | return do_fork(clone_flags, newsp, current_pt_regs(), 0, |
37 | newsp = regs->sp; | 37 | parent_tidptr, child_tidptr); |
38 | /* 16-byte aligned stack mandatory on AArch64 */ | ||
39 | if (newsp & 15) | ||
40 | return -EINVAL; | ||
41 | return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr); | ||
42 | } | 38 | } |
43 | 39 | ||
44 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | 40 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
@@ -54,7 +50,6 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | |||
54 | /* | 50 | /* |
55 | * Wrappers to pass the pt_regs argument. | 51 | * Wrappers to pass the pt_regs argument. |
56 | */ | 52 | */ |
57 | #define sys_clone sys_clone_wrapper | ||
58 | #define sys_rt_sigreturn sys_rt_sigreturn_wrapper | 53 | #define sys_rt_sigreturn sys_rt_sigreturn_wrapper |
59 | #define sys_sigaltstack sys_sigaltstack_wrapper | 54 | #define sys_sigaltstack sys_sigaltstack_wrapper |
60 | 55 | ||
diff --git a/arch/arm64/kernel/sys32.S b/arch/arm64/kernel/sys32.S index 92145d402cf1..7ef59e9245ef 100644 --- a/arch/arm64/kernel/sys32.S +++ b/arch/arm64/kernel/sys32.S | |||
@@ -26,20 +26,6 @@ | |||
26 | /* | 26 | /* |
27 | * System call wrappers for the AArch32 compatibility layer. | 27 | * System call wrappers for the AArch32 compatibility layer. |
28 | */ | 28 | */ |
29 | compat_sys_fork_wrapper: | ||
30 | mov x0, sp | ||
31 | b compat_sys_fork | ||
32 | ENDPROC(compat_sys_fork_wrapper) | ||
33 | |||
34 | compat_sys_vfork_wrapper: | ||
35 | mov x0, sp | ||
36 | b compat_sys_vfork | ||
37 | ENDPROC(compat_sys_vfork_wrapper) | ||
38 | |||
39 | compat_sys_clone_wrapper: | ||
40 | mov x5, sp | ||
41 | b compat_sys_clone | ||
42 | ENDPROC(compat_sys_clone_wrapper) | ||
43 | 29 | ||
44 | compat_sys_sigreturn_wrapper: | 30 | compat_sys_sigreturn_wrapper: |
45 | mov x0, sp | 31 | mov x0, sp |
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index d140b73a8bc4..6fabc1912da0 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c | |||
@@ -28,25 +28,15 @@ | |||
28 | #include <asm/cacheflush.h> | 28 | #include <asm/cacheflush.h> |
29 | #include <asm/unistd32.h> | 29 | #include <asm/unistd32.h> |
30 | 30 | ||
31 | asmlinkage int compat_sys_fork(struct pt_regs *regs) | 31 | asmlinkage int compat_sys_fork(void) |
32 | { | 32 | { |
33 | return do_fork(SIGCHLD, regs->compat_sp, regs, 0, NULL, NULL); | 33 | return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL); |
34 | } | 34 | } |
35 | 35 | ||
36 | asmlinkage int compat_sys_clone(unsigned long clone_flags, unsigned long newsp, | 36 | asmlinkage int compat_sys_vfork(void) |
37 | int __user *parent_tidptr, int tls_val, | ||
38 | int __user *child_tidptr, struct pt_regs *regs) | ||
39 | { | 37 | { |
40 | if (!newsp) | 38 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, |
41 | newsp = regs->compat_sp; | 39 | current_pt_regs(), 0, NULL, NULL); |
42 | |||
43 | return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr); | ||
44 | } | ||
45 | |||
46 | asmlinkage int compat_sys_vfork(struct pt_regs *regs) | ||
47 | { | ||
48 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->compat_sp, | ||
49 | regs, 0, NULL, NULL); | ||
50 | } | 40 | } |
51 | 41 | ||
52 | asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, | 42 | asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, |