diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 12:02:25 +0900 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 12:02:25 +0900 |
commit | 42859eea96ba6beabfb0369a1eeffa3c7d2bd9cb (patch) | |
tree | fa38aeda0d6e7a4c48a882b166b8643594a1ad50 /arch/um | |
parent | f59b51fe3d3092c08d7d554ecb40db24011b2ebc (diff) | |
parent | f322220d6159455da2b5a8a596d802c8695fed30 (diff) | |
download | linux-3.10-42859eea96ba6beabfb0369a1eeffa3c7d2bd9cb.tar.gz linux-3.10-42859eea96ba6beabfb0369a1eeffa3c7d2bd9cb.tar.bz2 linux-3.10-42859eea96ba6beabfb0369a1eeffa3c7d2bd9cb.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull generic execve() changes from Al Viro:
"This introduces the generic kernel_thread() and kernel_execve()
functions, and switches x86, arm, alpha, um and s390 over to them."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: (26 commits)
s390: convert to generic kernel_execve()
s390: switch to generic kernel_thread()
s390: fold kernel_thread_helper() into ret_from_fork()
s390: fold execve_tail() into start_thread(), convert to generic sys_execve()
um: switch to generic kernel_thread()
x86, um/x86: switch to generic sys_execve and kernel_execve
x86: split ret_from_fork
alpha: introduce ret_from_kernel_execve(), switch to generic kernel_execve()
alpha: switch to generic kernel_thread()
alpha: switch to generic sys_execve()
arm: get rid of execve wrapper, switch to generic execve() implementation
arm: optimized current_pt_regs()
arm: introduce ret_from_kernel_execve(), switch to generic kernel_execve()
arm: split ret_from_fork, simplify kernel_thread() [based on patch by rmk]
generic sys_execve()
generic kernel_execve()
new helper: current_pt_regs()
preparation for generic kernel_thread()
um: kill thread->forking
um: let signal_delivered() do SIGTRAP on singlestepping into handler
...
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/include/asm/processor-generic.h | 2 | ||||
-rw-r--r-- | arch/um/kernel/exec.c | 25 | ||||
-rw-r--r-- | arch/um/kernel/internal.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/process.c | 17 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 17 |
5 files changed, 5 insertions, 57 deletions
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h index 24e97be814b..1e82e954e97 100644 --- a/arch/um/include/asm/processor-generic.h +++ b/arch/um/include/asm/processor-generic.h @@ -63,8 +63,6 @@ static inline void release_thread(struct task_struct *task) { } -extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); - extern unsigned long thread_saved_pc(struct task_struct *t); static inline void mm_copy_segments(struct mm_struct *from_mm, diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index de66c421ae9..ab019c7f0b5 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c @@ -16,7 +16,6 @@ #include <mem_user.h> #include <skas.h> #include <os.h> -#include "internal.h" void flush_thread(void) { @@ -49,27 +48,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) } EXPORT_SYMBOL(start_thread); -long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) +void __noreturn ret_from_kernel_execve(struct pt_regs *unused) { - long err; - - err = do_execve(file, argv, env, ¤t->thread.regs); - if (!err) - UML_LONGJMP(current->thread.exec_buf, 1); - return err; -} - -long sys_execve(const char __user *file, const char __user *const __user *argv, - const char __user *const __user *env) -{ - long error; - char *filename; - - filename = getname(file); - error = PTR_ERR(filename); - if (IS_ERR(filename)) goto out; - error = do_execve(filename, argv, env, ¤t->thread.regs); - putname(filename); - out: - return error; + UML_LONGJMP(current->thread.exec_buf, 1); } diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h deleted file mode 100644 index 5bf97db24a0..00000000000 --- a/arch/um/kernel/internal.h +++ /dev/null @@ -1 +0,0 @@ -extern long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env); diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index 41f53240e79..30629783b3e 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -69,18 +69,6 @@ unsigned long alloc_stack(int order, int atomic) return page; } -int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - int pid; - - current->thread.request.u.thread.proc = fn; - current->thread.request.u.thread.arg = arg; - pid = do_fork(CLONE_VM | CLONE_UNTRACED | flags, 0, - ¤t->thread.regs, 0, NULL, NULL); - return pid; -} -EXPORT_SYMBOL(kernel_thread); - static inline void set_current(struct task_struct *task) { cpu_tasks[task_thread_info(task)->cpu] = ((struct cpu_task) @@ -177,7 +165,7 @@ void fork_handler(void) } int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long stack_top, struct task_struct * p, + unsigned long arg, struct task_struct * p, struct pt_regs *regs) { void (*handler)(void); @@ -198,7 +186,8 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, arch_copy_thread(¤t->thread.arch, &p->thread.arch); } else { get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp); - p->thread.request.u.thread = current->thread.request.u.thread; + p->thread.request.u.thread.proc = (int (*)(void *))sp; + p->thread.request.u.thread.arg = (void *)arg; handler = new_thread_handler; } diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 10808bda367..a81f3705e90 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c @@ -13,7 +13,6 @@ #include <asm/mman.h> #include <asm/uaccess.h> #include <asm/unistd.h> -#include "internal.h" long sys_fork(void) { @@ -50,19 +49,3 @@ long old_mmap(unsigned long addr, unsigned long len, out: return err; } - -int kernel_execve(const char *filename, - const char *const argv[], - const char *const envp[]) -{ - mm_segment_t fs; - int ret; - - fs = get_fs(); - set_fs(KERNEL_DS); - ret = um_execve(filename, (const char __user *const __user *)argv, - (const char __user *const __user *) envp); - set_fs(fs); - - return ret; -} |