Commit 3e86a8c6 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] Convert sys_execve to function with parameters.

Use function parameters instead of accessing the pt_regs structure
to get the parameters.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2d70ca23
...@@ -443,31 +443,26 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo) ...@@ -443,31 +443,26 @@ sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
* sys32_execve() executes a new program after the asm stub has set * sys32_execve() executes a new program after the asm stub has set
* things up for us. This should basically do what I want it to. * things up for us. This should basically do what I want it to.
*/ */
asmlinkage long sys32_execve(void) asmlinkage long sys32_execve(char __user *name, compat_uptr_t __user *argv,
compat_uptr_t __user *envp)
{ {
struct pt_regs *regs = task_pt_regs(current); struct pt_regs *regs = task_pt_regs(current);
char *filename; char *filename;
unsigned long result; long rc;
int rc;
filename = getname(name);
filename = getname(compat_ptr(regs->orig_gpr2)); rc = PTR_ERR(filename);
if (IS_ERR(filename)) { if (IS_ERR(filename))
result = PTR_ERR(filename); return rc;
rc = compat_do_execve(filename, argv, envp, regs);
if (rc)
goto out; goto out;
}
rc = compat_do_execve(filename, compat_ptr(regs->gprs[3]),
compat_ptr(regs->gprs[4]), regs);
if (rc) {
result = rc;
goto out_putname;
}
current->thread.fp_regs.fpc=0; current->thread.fp_regs.fpc=0;
asm volatile("sfpc %0,0" : : "d" (0)); asm volatile("sfpc %0,0" : : "d" (0));
result = regs->gprs[2]; rc = regs->gprs[2];
out_putname:
putname(filename);
out: out:
return result; putname(filename);
return rc;
} }
......
...@@ -198,7 +198,8 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, ...@@ -198,7 +198,8 @@ long sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
compat_sigset_t __user *oset, size_t sigsetsize); compat_sigset_t __user *oset, size_t sigsetsize);
long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize); long sys32_rt_sigpending(compat_sigset_t __user *set, size_t sigsetsize);
long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo); long sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo);
long sys32_execve(void); long sys32_execve(char __user *name, compat_uptr_t __user *argv,
compat_uptr_t __user *envp);
long sys32_init_module(void __user *umod, unsigned long len, long sys32_init_module(void __user *umod, unsigned long len,
const char __user *uargs); const char __user *uargs);
long sys32_delete_module(const char __user *name_user, unsigned int flags); long sys32_delete_module(const char __user *name_user, unsigned int flags);
......
...@@ -1848,3 +1848,10 @@ sys_clone_wrapper: ...@@ -1848,3 +1848,10 @@ sys_clone_wrapper:
llgtr %r4,%r4 # int * llgtr %r4,%r4 # int *
llgtr %r5,%r5 # int * llgtr %r5,%r5 # int *
jg sys_clone # branch to system call jg sys_clone # branch to system call
.globl sys32_execve_wrapper
sys32_execve_wrapper:
llgtr %r2,%r2 # char *
llgtr %r3,%r3 # compat_uptr_t *
llgtr %r4,%r4 # compat_uptr_t *
jg sys32_execve # branch to system call
...@@ -46,7 +46,8 @@ long sys_clone(unsigned long newsp, unsigned long clone_flags, ...@@ -46,7 +46,8 @@ long sys_clone(unsigned long newsp, unsigned long clone_flags,
int __user *parent_tidptr, int __user *child_tidptr); int __user *parent_tidptr, int __user *child_tidptr);
long sys_vfork(void); long sys_vfork(void);
void execve_tail(void); void execve_tail(void);
long sys_execve(void); long sys_execve(char __user *name, char __user * __user *argv,
char __user * __user *envp);
long sys_sigsuspend(int history0, int history1, old_sigset_t mask); long sys_sigsuspend(int history0, int history1, old_sigset_t mask);
long sys_sigaction(int sig, const struct old_sigaction __user *act, long sys_sigaction(int sig, const struct old_sigaction __user *act,
struct old_sigaction __user *oact); struct old_sigaction __user *oact);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/compat.h>
#include <asm/compat.h> #include <asm/compat.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -268,30 +269,25 @@ asmlinkage void execve_tail(void) ...@@ -268,30 +269,25 @@ asmlinkage void execve_tail(void)
/* /*
* sys_execve() executes a new program. * sys_execve() executes a new program.
*/ */
SYSCALL_DEFINE0(execve) SYSCALL_DEFINE3(execve, char __user *, name, char __user * __user *, argv,
char __user * __user *, envp)
{ {
struct pt_regs *regs = task_pt_regs(current); struct pt_regs *regs = task_pt_regs(current);
char *filename; char *filename;
unsigned long result; long rc;
int rc;
filename = getname((char __user *) regs->orig_gpr2); filename = getname(name);
if (IS_ERR(filename)) { rc = PTR_ERR(filename);
result = PTR_ERR(filename); if (IS_ERR(filename))
return rc;
rc = do_execve(filename, argv, envp, regs);
if (rc)
goto out; goto out;
}
rc = do_execve(filename, (char __user * __user *) regs->gprs[3],
(char __user * __user *) regs->gprs[4], regs);
if (rc) {
result = rc;
goto out_putname;
}
execve_tail(); execve_tail();
result = regs->gprs[2]; rc = regs->gprs[2];
out_putname:
putname(filename);
out: out:
return result; putname(filename);
return rc;
} }
/* /*
......
...@@ -19,7 +19,7 @@ SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall) ...@@ -19,7 +19,7 @@ SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall)
SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper)
SYSCALL(sys_link,sys_link,sys32_link_wrapper) SYSCALL(sys_link,sys_link,sys32_link_wrapper)
SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */ SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */
SYSCALL(sys_execve,sys_execve,sys32_execve) SYSCALL(sys_execve,sys_execve,sys32_execve_wrapper)
SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper) SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper)
SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */
SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper) SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment