diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-02 15:05:11 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-30 22:53:32 -0400 |
commit | 6783eaa2e1253fbcbe2c2f6bb4c843abf1343caf (patch) | |
tree | 457e7b1d54396ed31ba92b7fe7024723d26ba565 /arch/um/kernel | |
parent | 7076aada1040de4ed79a5977dbabdb5e5ea5e249 (diff) |
x86, um/x86: switch to generic sys_execve and kernel_execve
32bit wrapper is lost on that; 64bit one is *not*, since
we need to arrange for full pt_regs on stack when we call
sys_execve() and we need to load callee-saved ones from
there afterwards.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/um/kernel')
-rw-r--r-- | arch/um/kernel/exec.c | 25 | ||||
-rw-r--r-- | arch/um/kernel/internal.h | 1 | ||||
-rw-r--r-- | arch/um/kernel/syscall.c | 17 |
3 files changed, 2 insertions, 41 deletions
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index 8c82786da823..e427301f55d6 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include "mem_user.h" | 16 | #include "mem_user.h" |
17 | #include "skas.h" | 17 | #include "skas.h" |
18 | #include "os.h" | 18 | #include "os.h" |
19 | #include "internal.h" | ||
20 | 19 | ||
21 | void flush_thread(void) | 20 | void flush_thread(void) |
22 | { | 21 | { |
@@ -49,27 +48,7 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp) | |||
49 | } | 48 | } |
50 | EXPORT_SYMBOL(start_thread); | 49 | EXPORT_SYMBOL(start_thread); |
51 | 50 | ||
52 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) | 51 | void __noreturn ret_from_kernel_execve(struct pt_regs *unused) |
53 | { | 52 | { |
54 | long err; | 53 | UML_LONGJMP(current->thread.exec_buf, 1); |
55 | |||
56 | err = do_execve(file, argv, env, ¤t->thread.regs); | ||
57 | if (!err) | ||
58 | UML_LONGJMP(current->thread.exec_buf, 1); | ||
59 | return err; | ||
60 | } | ||
61 | |||
62 | long sys_execve(const char __user *file, const char __user *const __user *argv, | ||
63 | const char __user *const __user *env) | ||
64 | { | ||
65 | long error; | ||
66 | char *filename; | ||
67 | |||
68 | filename = getname(file); | ||
69 | error = PTR_ERR(filename); | ||
70 | if (IS_ERR(filename)) goto out; | ||
71 | error = do_execve(filename, argv, env, ¤t->thread.regs); | ||
72 | putname(filename); | ||
73 | out: | ||
74 | return error; | ||
75 | } | 54 | } |
diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h deleted file mode 100644 index 5bf97db24a04..000000000000 --- a/arch/um/kernel/internal.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | 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/syscall.c b/arch/um/kernel/syscall.c index a4c6d8eee74c..a5639c472772 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include "asm/mman.h" | 13 | #include "asm/mman.h" |
14 | #include "asm/uaccess.h" | 14 | #include "asm/uaccess.h" |
15 | #include "asm/unistd.h" | 15 | #include "asm/unistd.h" |
16 | #include "internal.h" | ||
17 | 16 | ||
18 | long sys_fork(void) | 17 | long sys_fork(void) |
19 | { | 18 | { |
@@ -50,19 +49,3 @@ long old_mmap(unsigned long addr, unsigned long len, | |||
50 | out: | 49 | out: |
51 | return err; | 50 | return err; |
52 | } | 51 | } |
53 | |||
54 | int kernel_execve(const char *filename, | ||
55 | const char *const argv[], | ||
56 | const char *const envp[]) | ||
57 | { | ||
58 | mm_segment_t fs; | ||
59 | int ret; | ||
60 | |||
61 | fs = get_fs(); | ||
62 | set_fs(KERNEL_DS); | ||
63 | ret = um_execve(filename, (const char __user *const __user *)argv, | ||
64 | (const char __user *const __user *) envp); | ||
65 | set_fs(fs); | ||
66 | |||
67 | return ret; | ||
68 | } | ||