aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/exec.c38
-rw-r--r--include/linux/compat.h8
2 files changed, 40 insertions, 6 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 48c525115fe4..50a1270da95b 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -401,7 +401,7 @@ struct user_arg_ptr {
401 union { 401 union {
402 const char __user *const __user *native; 402 const char __user *const __user *native;
403#ifdef CONFIG_COMPAT 403#ifdef CONFIG_COMPAT
404 compat_uptr_t __user *compat; 404 const compat_uptr_t __user *compat;
405#endif 405#endif
406 } ptr; 406 } ptr;
407}; 407};
@@ -1600,9 +1600,9 @@ int do_execve(const char *filename,
1600} 1600}
1601 1601
1602#ifdef CONFIG_COMPAT 1602#ifdef CONFIG_COMPAT
1603int compat_do_execve(char *filename, 1603int compat_do_execve(const char *filename,
1604 compat_uptr_t __user *__argv, 1604 const compat_uptr_t __user *__argv,
1605 compat_uptr_t __user *__envp, 1605 const compat_uptr_t __user *__envp,
1606 struct pt_regs *regs) 1606 struct pt_regs *regs)
1607{ 1607{
1608 struct user_arg_ptr argv = { 1608 struct user_arg_ptr argv = {
@@ -2319,6 +2319,36 @@ int dump_seek(struct file *file, loff_t off)
2319} 2319}
2320EXPORT_SYMBOL(dump_seek); 2320EXPORT_SYMBOL(dump_seek);
2321 2321
2322#ifdef __ARCH_WANT_SYS_EXECVE
2323SYSCALL_DEFINE3(execve,
2324 const char __user *, filename,
2325 const char __user *const __user *, argv,
2326 const char __user *const __user *, envp)
2327{
2328 const char *path = getname(filename);
2329 int error = PTR_ERR(path);
2330 if (!IS_ERR(path)) {
2331 error = do_execve(path, argv, envp, current_pt_regs());
2332 putname(path);
2333 }
2334 return error;
2335}
2336#ifdef CONFIG_COMPAT
2337asmlinkage long compat_sys_execve(const char __user * filename,
2338 const compat_uptr_t __user * argv,
2339 const compat_uptr_t __user * envp)
2340{
2341 const char *path = getname(filename);
2342 int error = PTR_ERR(path);
2343 if (!IS_ERR(path)) {
2344 error = compat_do_execve(path, argv, envp, current_pt_regs());
2345 putname(path);
2346 }
2347 return error;
2348}
2349#endif
2350#endif
2351
2322#ifdef __ARCH_WANT_KERNEL_EXECVE 2352#ifdef __ARCH_WANT_KERNEL_EXECVE
2323int kernel_execve(const char *filename, 2353int kernel_execve(const char *filename,
2324 const char *const argv[], 2354 const char *const argv[],
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 09b28b7369d7..c4be3f55511d 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -289,8 +289,12 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
289 const struct compat_iovec __user *vec, 289 const struct compat_iovec __user *vec,
290 unsigned long vlen, u32 pos_low, u32 pos_high); 290 unsigned long vlen, u32 pos_low, u32 pos_high);
291 291
292int compat_do_execve(char *filename, compat_uptr_t __user *argv, 292int compat_do_execve(const char *filename, const compat_uptr_t __user *argv,
293 compat_uptr_t __user *envp, struct pt_regs *regs); 293 const compat_uptr_t __user *envp, struct pt_regs *regs);
294#ifdef __ARCH_WANT_SYS_EXECVE
295asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
296 const compat_uptr_t __user *envp);
297#endif
294 298
295asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 299asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
296 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 300 compat_ulong_t __user *outp, compat_ulong_t __user *exp,