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/mn10300 | |
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/mn10300')
-rw-r--r-- | arch/mn10300/Kconfig | 1 | ||||
-rw-r--r-- | arch/mn10300/include/asm/signal.h | 4 | ||||
-rw-r--r-- | arch/mn10300/include/asm/unistd.h | 4 | ||||
-rw-r--r-- | arch/mn10300/kernel/entry.S | 7 | ||||
-rw-r--r-- | arch/mn10300/kernel/process.c | 33 |
5 files changed, 10 insertions, 39 deletions
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 04669fac117b..72471744a912 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -9,6 +9,7 @@ config MN10300 | |||
9 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER | 9 | select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER |
10 | select GENERIC_CLOCKEVENTS | 10 | select GENERIC_CLOCKEVENTS |
11 | select GENERIC_KERNEL_THREAD | 11 | select GENERIC_KERNEL_THREAD |
12 | select GENERIC_KERNEL_EXECVE | ||
12 | select MODULES_USE_ELF_RELA | 13 | select MODULES_USE_ELF_RELA |
13 | 14 | ||
14 | config AM33_2 | 15 | config AM33_2 |
diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h index f9668ec3040c..d280e9780793 100644 --- a/arch/mn10300/include/asm/signal.h +++ b/arch/mn10300/include/asm/signal.h | |||
@@ -45,8 +45,4 @@ struct k_sigaction { | |||
45 | }; | 45 | }; |
46 | #include <asm/sigcontext.h> | 46 | #include <asm/sigcontext.h> |
47 | 47 | ||
48 | |||
49 | struct pt_regs; | ||
50 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
51 | |||
52 | #endif /* _ASM_SIGNAL_H */ | 48 | #endif /* _ASM_SIGNAL_H */ |
diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h index 55bbec1887e9..cabf8ba73b27 100644 --- a/arch/mn10300/include/asm/unistd.h +++ b/arch/mn10300/include/asm/unistd.h | |||
@@ -44,7 +44,9 @@ | |||
44 | #define __ARCH_WANT_SYS_RT_SIGACTION | 44 | #define __ARCH_WANT_SYS_RT_SIGACTION |
45 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 45 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
46 | #define __ARCH_WANT_SYS_EXECVE | 46 | #define __ARCH_WANT_SYS_EXECVE |
47 | #define __ARCH_WANT_KERNEL_EXECVE | 47 | #define __ARCH_WANT_SYS_FORK |
48 | #define __ARCH_WANT_SYS_VFORK | ||
49 | #define __ARCH_WANT_SYS_CLONE | ||
48 | 50 | ||
49 | /* | 51 | /* |
50 | * "Conditional" syscalls | 52 | * "Conditional" syscalls |
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S index 0c631d34c8d7..68fcab8f8f6f 100644 --- a/arch/mn10300/kernel/entry.S +++ b/arch/mn10300/kernel/entry.S | |||
@@ -60,13 +60,8 @@ ENTRY(ret_from_kernel_thread) | |||
60 | mov (REG_D0,fp),d0 | 60 | mov (REG_D0,fp),d0 |
61 | mov (REG_A0,fp),a0 | 61 | mov (REG_A0,fp),a0 |
62 | calls (a0) | 62 | calls (a0) |
63 | jmp sys_exit | ||
64 | |||
65 | ENTRY(ret_from_kernel_execve) | ||
66 | add -12,d0 /* pt_regs -> frame */ | ||
67 | mov d0,sp | ||
68 | GET_THREAD_INFO a2 | ||
69 | clr d0 | 63 | clr d0 |
64 | mov d0,(REG_D0,fp) | ||
70 | jmp syscall_exit | 65 | jmp syscall_exit |
71 | 66 | ||
72 | ############################################################################### | 67 | ############################################################################### |
diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index d0c671b6d9ff..eb09f5a552ff 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c | |||
@@ -206,7 +206,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
206 | */ | 206 | */ |
207 | int copy_thread(unsigned long clone_flags, | 207 | int copy_thread(unsigned long clone_flags, |
208 | unsigned long c_usp, unsigned long ustk_size, | 208 | unsigned long c_usp, unsigned long ustk_size, |
209 | struct task_struct *p, struct pt_regs *kregs) | 209 | struct task_struct *p) |
210 | { | 210 | { |
211 | struct thread_info *ti = task_thread_info(p); | 211 | struct thread_info *ti = task_thread_info(p); |
212 | struct pt_regs *c_regs; | 212 | struct pt_regs *c_regs; |
@@ -227,7 +227,7 @@ int copy_thread(unsigned long clone_flags, | |||
227 | p->thread.wchan = p->thread.pc; | 227 | p->thread.wchan = p->thread.pc; |
228 | p->thread.usp = c_usp; | 228 | p->thread.usp = c_usp; |
229 | 229 | ||
230 | if (unlikely(!kregs)) { | 230 | if (unlikely(p->flags & PF_KTHREAD)) { |
231 | memset(c_regs, 0, sizeof(struct pt_regs)); | 231 | memset(c_regs, 0, sizeof(struct pt_regs)); |
232 | c_regs->a0 = c_usp; /* function */ | 232 | c_regs->a0 = c_usp; /* function */ |
233 | c_regs->d0 = ustk_size; /* argument */ | 233 | c_regs->d0 = ustk_size; /* argument */ |
@@ -236,8 +236,9 @@ int copy_thread(unsigned long clone_flags, | |||
236 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | 236 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | *c_regs = *kregs; | 239 | *c_regs = *current_pt_regs(); |
240 | c_regs->sp = c_usp; | 240 | if (c_usp) |
241 | c_regs->sp = c_usp; | ||
241 | c_regs->epsw &= ~EPSW_FE; /* my FPU */ | 242 | c_regs->epsw &= ~EPSW_FE; /* my FPU */ |
242 | 243 | ||
243 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ | 244 | /* the new TLS pointer is passed in as arg #5 to sys_clone() */ |
@@ -249,30 +250,6 @@ int copy_thread(unsigned long clone_flags, | |||
249 | return 0; | 250 | return 0; |
250 | } | 251 | } |
251 | 252 | ||
252 | /* | ||
253 | * clone a process | ||
254 | * - tlsptr is retrieved by copy_thread() from current_frame()->d3 | ||
255 | */ | ||
256 | asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
257 | int __user *parent_tidptr, int __user *child_tidptr, | ||
258 | int __user *tlsptr) | ||
259 | { | ||
260 | return do_fork(clone_flags, newsp ?: current_frame()->sp, | ||
261 | current_frame(), 0, parent_tidptr, child_tidptr); | ||
262 | } | ||
263 | |||
264 | asmlinkage long sys_fork(void) | ||
265 | { | ||
266 | return do_fork(SIGCHLD, current_frame()->sp, | ||
267 | current_frame(), 0, NULL, NULL); | ||
268 | } | ||
269 | |||
270 | asmlinkage long sys_vfork(void) | ||
271 | { | ||
272 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, current_frame()->sp, | ||
273 | current_frame(), 0, NULL, NULL); | ||
274 | } | ||
275 | |||
276 | unsigned long get_wchan(struct task_struct *p) | 253 | unsigned long get_wchan(struct task_struct *p) |
277 | { | 254 | { |
278 | return p->thread.wchan; | 255 | return p->thread.wchan; |