mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
x86: Merge sys_execve
Change 32-bit sys_execve to PTREGSCALL3, and merge with 64-bit. Signed-off-by: Brian Gerst <brgerst@gmail.com> LKML-Reference: <1260403316-5679-4-git-send-email-brgerst@gmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
27f59559d6
commit
11cf88bd0b
5 changed files with 29 additions and 49 deletions
|
@ -23,6 +23,8 @@ long sys_iopl(unsigned int, struct pt_regs *);
|
||||||
/* kernel/process.c */
|
/* kernel/process.c */
|
||||||
int sys_fork(struct pt_regs *);
|
int sys_fork(struct pt_regs *);
|
||||||
int sys_vfork(struct pt_regs *);
|
int sys_vfork(struct pt_regs *);
|
||||||
|
long sys_execve(char __user *, char __user * __user *,
|
||||||
|
char __user * __user *, struct pt_regs *);
|
||||||
|
|
||||||
/* kernel/ldt.c */
|
/* kernel/ldt.c */
|
||||||
asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
|
asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
|
||||||
|
@ -39,7 +41,6 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *);
|
||||||
|
|
||||||
/* kernel/process_32.c */
|
/* kernel/process_32.c */
|
||||||
int sys_clone(struct pt_regs *);
|
int sys_clone(struct pt_regs *);
|
||||||
int sys_execve(struct pt_regs *);
|
|
||||||
|
|
||||||
/* kernel/signal.c */
|
/* kernel/signal.c */
|
||||||
asmlinkage int sys_sigsuspend(int, int, old_sigset_t);
|
asmlinkage int sys_sigsuspend(int, int, old_sigset_t);
|
||||||
|
@ -73,9 +74,6 @@ int sys_vm86(struct pt_regs *);
|
||||||
asmlinkage long sys_clone(unsigned long, unsigned long,
|
asmlinkage long sys_clone(unsigned long, unsigned long,
|
||||||
void __user *, void __user *,
|
void __user *, void __user *,
|
||||||
struct pt_regs *);
|
struct pt_regs *);
|
||||||
asmlinkage long sys_execve(char __user *, char __user * __user *,
|
|
||||||
char __user * __user *,
|
|
||||||
struct pt_regs *);
|
|
||||||
long sys_arch_prctl(int, unsigned long);
|
long sys_arch_prctl(int, unsigned long);
|
||||||
|
|
||||||
/* kernel/signal.c */
|
/* kernel/signal.c */
|
||||||
|
|
|
@ -762,7 +762,7 @@ PTREGSCALL1(iopl)
|
||||||
PTREGSCALL0(fork)
|
PTREGSCALL0(fork)
|
||||||
PTREGSCALL0(clone)
|
PTREGSCALL0(clone)
|
||||||
PTREGSCALL0(vfork)
|
PTREGSCALL0(vfork)
|
||||||
PTREGSCALL0(execve)
|
PTREGSCALL3(execve)
|
||||||
PTREGSCALL0(sigaltstack)
|
PTREGSCALL0(sigaltstack)
|
||||||
PTREGSCALL0(sigreturn)
|
PTREGSCALL0(sigreturn)
|
||||||
PTREGSCALL0(rt_sigreturn)
|
PTREGSCALL0(rt_sigreturn)
|
||||||
|
|
|
@ -235,6 +235,32 @@ int sys_vfork(struct pt_regs *regs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* sys_execve() executes a new program.
|
||||||
|
*/
|
||||||
|
long sys_execve(char __user *name, char __user * __user *argv,
|
||||||
|
char __user * __user *envp, struct pt_regs *regs)
|
||||||
|
{
|
||||||
|
long error;
|
||||||
|
char *filename;
|
||||||
|
|
||||||
|
filename = getname(name);
|
||||||
|
error = PTR_ERR(filename);
|
||||||
|
if (IS_ERR(filename))
|
||||||
|
return error;
|
||||||
|
error = do_execve(filename, argv, envp, regs);
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86_32
|
||||||
|
if (error == 0) {
|
||||||
|
/* Make sure we don't return using sysenter.. */
|
||||||
|
set_thread_flag(TIF_IRET);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
putname(filename);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Idle related variables and functions
|
* Idle related variables and functions
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -451,31 +451,6 @@ int sys_clone(struct pt_regs *regs)
|
||||||
return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
|
return do_fork(clone_flags, newsp, regs, 0, parent_tidptr, child_tidptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* sys_execve() executes a new program.
|
|
||||||
*/
|
|
||||||
int sys_execve(struct pt_regs *regs)
|
|
||||||
{
|
|
||||||
int error;
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
filename = getname((char __user *) regs->bx);
|
|
||||||
error = PTR_ERR(filename);
|
|
||||||
if (IS_ERR(filename))
|
|
||||||
goto out;
|
|
||||||
error = do_execve(filename,
|
|
||||||
(char __user * __user *) regs->cx,
|
|
||||||
(char __user * __user *) regs->dx,
|
|
||||||
regs);
|
|
||||||
if (error == 0) {
|
|
||||||
/* Make sure we don't return using sysenter.. */
|
|
||||||
set_thread_flag(TIF_IRET);
|
|
||||||
}
|
|
||||||
putname(filename);
|
|
||||||
out:
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define top_esp (THREAD_SIZE - sizeof(unsigned long))
|
#define top_esp (THREAD_SIZE - sizeof(unsigned long))
|
||||||
#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long))
|
#define top_ebp (THREAD_SIZE - 2*sizeof(unsigned long))
|
||||||
|
|
||||||
|
|
|
@ -520,25 +520,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
|
||||||
return prev_p;
|
return prev_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* sys_execve() executes a new program.
|
|
||||||
*/
|
|
||||||
asmlinkage
|
|
||||||
long sys_execve(char __user *name, char __user * __user *argv,
|
|
||||||
char __user * __user *envp, struct pt_regs *regs)
|
|
||||||
{
|
|
||||||
long error;
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
filename = getname(name);
|
|
||||||
error = PTR_ERR(filename);
|
|
||||||
if (IS_ERR(filename))
|
|
||||||
return error;
|
|
||||||
error = do_execve(filename, argv, envp, regs);
|
|
||||||
putname(filename);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_personality_64bit(void)
|
void set_personality_64bit(void)
|
||||||
{
|
{
|
||||||
/* inherit personality from parent */
|
/* inherit personality from parent */
|
||||||
|
|
Loading…
Reference in a new issue