diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 15:22:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 15:22:13 -0500 |
commit | 9977d9b379cb77e0f67bd6f4563618106e58e11d (patch) | |
tree | 0191accfddf578edb52c69c933d64521e3dce297 /arch/arm64 | |
parent | cf4af01221579a4e895f43dbfc47598fbfc5a731 (diff) | |
parent | 541880d9a2c7871f6370071d55aa6662d329c51e (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull big execve/kernel_thread/fork unification series from Al Viro:
"All architectures are converted to new model. Quite a bit of that
stuff is actually shared with architecture trees; in such cases it's
literally shared branch pulled by both, not a cherry-pick.
A lot of ugliness and black magic is gone (-3KLoC total in this one):
- kernel_thread()/kernel_execve()/sys_execve() redesign.
We don't do syscalls from kernel anymore for either kernel_thread()
or kernel_execve():
kernel_thread() is essentially clone(2) with callback run before we
return to userland, the callbacks either never return or do
successful do_execve() before returning.
kernel_execve() is a wrapper for do_execve() - it doesn't need to
do transition to user mode anymore.
As a result kernel_thread() and kernel_execve() are
arch-independent now - they live in kernel/fork.c and fs/exec.c
resp. sys_execve() is also in fs/exec.c and it's completely
architecture-independent.
- daemonize() is gone, along with its parts in fs/*.c
- struct pt_regs * is no longer passed to do_fork/copy_process/
copy_thread/do_execve/search_binary_handler/->load_binary/do_coredump.
- sys_fork()/sys_vfork()/sys_clone() unified; some architectures
still need wrappers (ones with callee-saved registers not saved in
pt_regs on syscall entry), but the main part of those suckers is in
kernel/fork.c now."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (113 commits)
do_coredump(): get rid of pt_regs argument
print_fatal_signal(): get rid of pt_regs argument
ptrace_signal(): get rid of unused arguments
get rid of ptrace_signal_deliver() arguments
new helper: signal_pt_regs()
unify default ptrace_signal_deliver
flagday: kill pt_regs argument of do_fork()
death to idle_regs()
don't pass regs to copy_process()
flagday: don't pass regs to copy_thread()
bfin: switch to generic vfork, get rid of pointless wrappers
xtensa: switch to generic clone()
openrisc: switch to use of generic fork and clone
unicore32: switch to generic clone(2)
score: switch to generic fork/vfork/clone
c6x: sanitize copy_thread(), get rid of clone(2) wrapper, switch to generic clone()
take sys_fork/sys_vfork/sys_clone prototypes to linux/syscalls.h
mn10300: switch to generic fork/vfork/clone
h8300: switch to generic fork/vfork/clone
tile: switch to generic clone()
...
Conflicts:
arch/microblaze/include/asm/Kbuild
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/syscalls.h | 6 | ||||
-rw-r--r-- | arch/arm64/include/asm/unistd.h | 3 | ||||
-rw-r--r-- | arch/arm64/include/asm/unistd32.h | 4 | ||||
-rw-r--r-- | arch/arm64/kernel/process.c | 9 | ||||
-rw-r--r-- | arch/arm64/kernel/sys.c | 11 | ||||
-rw-r--r-- | arch/arm64/kernel/sys_compat.c | 11 |
7 files changed, 10 insertions, 35 deletions
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 2adf340b8589..f9ccff915918 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -33,6 +33,7 @@ config ARM64 | |||
33 | select RTC_LIB | 33 | select RTC_LIB |
34 | select SPARSE_IRQ | 34 | select SPARSE_IRQ |
35 | select SYSCTL_EXCEPTION_TRACE | 35 | select SYSCTL_EXCEPTION_TRACE |
36 | select CLONE_BACKWARDS | ||
36 | help | 37 | help |
37 | ARM 64-bit (AArch64) Linux support. | 38 | ARM 64-bit (AArch64) Linux support. |
38 | 39 | ||
diff --git a/arch/arm64/include/asm/syscalls.h b/arch/arm64/include/asm/syscalls.h index a1b00cd6f786..20d63b290665 100644 --- a/arch/arm64/include/asm/syscalls.h +++ b/arch/arm64/include/asm/syscalls.h | |||
@@ -27,12 +27,6 @@ asmlinkage long sys_rt_sigreturn_wrapper(void); | |||
27 | asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, | 27 | asmlinkage long sys_sigaltstack_wrapper(const stack_t __user *uss, |
28 | stack_t __user *uoss); | 28 | stack_t __user *uoss); |
29 | 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 | |||
36 | #include <asm-generic/syscalls.h> | 30 | #include <asm-generic/syscalls.h> |
37 | 31 | ||
38 | #endif /* __ASM_SYSCALLS_H */ | 32 | #endif /* __ASM_SYSCALLS_H */ |
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 43064a8bd99e..d69aeea6da1e 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h | |||
@@ -24,6 +24,9 @@ | |||
24 | #define __ARCH_WANT_SYS_SIGPROCMASK | 24 | #define __ARCH_WANT_SYS_SIGPROCMASK |
25 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND | 25 | #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND |
26 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE | 26 | #define __ARCH_WANT_COMPAT_SYS_SENDFILE |
27 | #define __ARCH_WANT_SYS_FORK | ||
28 | #define __ARCH_WANT_SYS_VFORK | ||
27 | #endif | 29 | #endif |
28 | #define __ARCH_WANT_SYS_EXECVE | 30 | #define __ARCH_WANT_SYS_EXECVE |
31 | #define __ARCH_WANT_SYS_CLONE | ||
29 | #include <uapi/asm/unistd.h> | 32 | #include <uapi/asm/unistd.h> |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index 50104e8ce55d..58432625fdb3 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) | 26 | __SYSCALL(2, 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) |
@@ -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) | 214 | __SYSCALL(190, 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/process.c b/arch/arm64/kernel/process.c index 8a5f3341861e..cb0956bc96ed 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c | |||
@@ -234,16 +234,15 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
234 | asmlinkage void ret_from_fork(void) asm("ret_from_fork"); | 234 | asmlinkage void ret_from_fork(void) asm("ret_from_fork"); |
235 | 235 | ||
236 | int copy_thread(unsigned long clone_flags, unsigned long stack_start, | 236 | int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
237 | unsigned long stk_sz, struct task_struct *p, | 237 | unsigned long stk_sz, struct task_struct *p) |
238 | struct pt_regs *regs) | ||
239 | { | 238 | { |
240 | struct pt_regs *childregs = task_pt_regs(p); | 239 | struct pt_regs *childregs = task_pt_regs(p); |
241 | unsigned long tls = p->thread.tp_value; | 240 | unsigned long tls = p->thread.tp_value; |
242 | 241 | ||
243 | memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); | 242 | memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); |
244 | 243 | ||
245 | if (likely(regs)) { | 244 | if (likely(!(p->flags & PF_KTHREAD))) { |
246 | *childregs = *regs; | 245 | *childregs = *current_pt_regs(); |
247 | childregs->regs[0] = 0; | 246 | childregs->regs[0] = 0; |
248 | if (is_compat_thread(task_thread_info(p))) { | 247 | if (is_compat_thread(task_thread_info(p))) { |
249 | if (stack_start) | 248 | if (stack_start) |
@@ -266,7 +265,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, | |||
266 | * for the new thread. | 265 | * for the new thread. |
267 | */ | 266 | */ |
268 | if (clone_flags & CLONE_SETTLS) | 267 | if (clone_flags & CLONE_SETTLS) |
269 | tls = regs->regs[3]; | 268 | tls = childregs->regs[3]; |
270 | } else { | 269 | } else { |
271 | memset(childregs, 0, sizeof(struct pt_regs)); | 270 | memset(childregs, 0, sizeof(struct pt_regs)); |
272 | childregs->pstate = PSR_MODE_EL1h; | 271 | childregs->pstate = PSR_MODE_EL1h; |
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c index 4364df85050e..8292a9b090f8 100644 --- a/arch/arm64/kernel/sys.c +++ b/arch/arm64/kernel/sys.c | |||
@@ -26,17 +26,6 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/syscalls.h> | 27 | #include <linux/syscalls.h> |
28 | 28 | ||
29 | /* | ||
30 | * Clone a task - this clones the calling program thread. | ||
31 | */ | ||
32 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
33 | int __user *parent_tidptr, unsigned long tls_val, | ||
34 | int __user *child_tidptr) | ||
35 | { | ||
36 | return do_fork(clone_flags, newsp, current_pt_regs(), 0, | ||
37 | parent_tidptr, child_tidptr); | ||
38 | } | ||
39 | |||
40 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | 29 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
41 | unsigned long prot, unsigned long flags, | 30 | unsigned long prot, unsigned long flags, |
42 | unsigned long fd, off_t off) | 31 | unsigned long fd, off_t off) |
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index 6fabc1912da0..f7b05edf8ce3 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c | |||
@@ -28,17 +28,6 @@ | |||
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(void) | ||
32 | { | ||
33 | return do_fork(SIGCHLD, 0, current_pt_regs(), 0, NULL, NULL); | ||
34 | } | ||
35 | |||
36 | asmlinkage int compat_sys_vfork(void) | ||
37 | { | ||
38 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | ||
39 | current_pt_regs(), 0, NULL, NULL); | ||
40 | } | ||
41 | |||
42 | asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, | 31 | asmlinkage int compat_sys_sched_rr_get_interval(compat_pid_t pid, |
43 | struct compat_timespec __user *interval) | 32 | struct compat_timespec __user *interval) |
44 | { | 33 | { |