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/mips/kernel/syscall.c | |
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/mips/kernel/syscall.c')
-rw-r--r-- | arch/mips/kernel/syscall.c | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 2bd561bc05ae..201cb76b4df9 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -92,7 +92,7 @@ save_static_function(sys_fork); | |||
92 | static int __used noinline | 92 | static int __used noinline |
93 | _sys_fork(nabi_no_regargs struct pt_regs regs) | 93 | _sys_fork(nabi_no_regargs struct pt_regs regs) |
94 | { | 94 | { |
95 | return do_fork(SIGCHLD, regs.regs[29], ®s, 0, NULL, NULL); | 95 | return do_fork(SIGCHLD, regs.regs[29], 0, NULL, NULL); |
96 | } | 96 | } |
97 | 97 | ||
98 | save_static_function(sys_clone); | 98 | save_static_function(sys_clone); |
@@ -123,32 +123,10 @@ _sys_clone(nabi_no_regargs struct pt_regs regs) | |||
123 | #else | 123 | #else |
124 | child_tidptr = (int __user *) regs.regs[8]; | 124 | child_tidptr = (int __user *) regs.regs[8]; |
125 | #endif | 125 | #endif |
126 | return do_fork(clone_flags, newsp, ®s, 0, | 126 | return do_fork(clone_flags, newsp, 0, |
127 | parent_tidptr, child_tidptr); | 127 | parent_tidptr, child_tidptr); |
128 | } | 128 | } |
129 | 129 | ||
130 | /* | ||
131 | * sys_execve() executes a new program. | ||
132 | */ | ||
133 | asmlinkage int sys_execve(nabi_no_regargs struct pt_regs regs) | ||
134 | { | ||
135 | int error; | ||
136 | struct filename *filename; | ||
137 | |||
138 | filename = getname((const char __user *) (long)regs.regs[4]); | ||
139 | error = PTR_ERR(filename); | ||
140 | if (IS_ERR(filename)) | ||
141 | goto out; | ||
142 | error = do_execve(filename->name, | ||
143 | (const char __user *const __user *) (long)regs.regs[5], | ||
144 | (const char __user *const __user *) (long)regs.regs[6], | ||
145 | ®s); | ||
146 | putname(filename); | ||
147 | |||
148 | out: | ||
149 | return error; | ||
150 | } | ||
151 | |||
152 | SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) | 130 | SYSCALL_DEFINE1(set_thread_area, unsigned long, addr) |
153 | { | 131 | { |
154 | struct thread_info *ti = task_thread_info(current); | 132 | struct thread_info *ti = task_thread_info(current); |
@@ -313,34 +291,3 @@ asmlinkage void bad_stack(void) | |||
313 | { | 291 | { |
314 | do_exit(SIGSEGV); | 292 | do_exit(SIGSEGV); |
315 | } | 293 | } |
316 | |||
317 | /* | ||
318 | * Do a system call from kernel instead of calling sys_execve so we | ||
319 | * end up with proper pt_regs. | ||
320 | */ | ||
321 | int kernel_execve(const char *filename, | ||
322 | const char *const argv[], | ||
323 | const char *const envp[]) | ||
324 | { | ||
325 | register unsigned long __a0 asm("$4") = (unsigned long) filename; | ||
326 | register unsigned long __a1 asm("$5") = (unsigned long) argv; | ||
327 | register unsigned long __a2 asm("$6") = (unsigned long) envp; | ||
328 | register unsigned long __a3 asm("$7"); | ||
329 | unsigned long __v0; | ||
330 | |||
331 | __asm__ volatile (" \n" | ||
332 | " .set noreorder \n" | ||
333 | " li $2, %5 # __NR_execve \n" | ||
334 | " syscall \n" | ||
335 | " move %0, $2 \n" | ||
336 | " .set reorder \n" | ||
337 | : "=&r" (__v0), "=r" (__a3) | ||
338 | : "r" (__a0), "r" (__a1), "r" (__a2), "i" (__NR_execve) | ||
339 | : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", | ||
340 | "memory"); | ||
341 | |||
342 | if (__a3 == 0) | ||
343 | return __v0; | ||
344 | |||
345 | return -__v0; | ||
346 | } | ||