diff options
author | sobomax <sobomax@FreeBSD.org> | 2005-01-29 23:12:00 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2005-01-29 23:12:00 +0000 |
commit | f489acaf0f5bae70444702cdcc02ab81d3b6b51a (patch) | |
tree | c697d47092272c8c6973b42ba0a424e9763f7ce5 /sys/i386/linux/linux_machdep.c | |
parent | 1c7b5012657233c6ea65df68e8223e60b6f822a0 (diff) | |
download | FreeBSD-src-f489acaf0f5bae70444702cdcc02ab81d3b6b51a.zip FreeBSD-src-f489acaf0f5bae70444702cdcc02ab81d3b6b51a.tar.gz |
o Split out kernel part of execve(2) syscall into two parts: one that
copies arguments into the kernel space and one that operates
completely in the kernel space;
o use kernel-only version of execve(2) to kill another stackgap in
linuxlator/i386.
Obtained from: DragonFlyBSD (partially)
MFC after: 2 weeks
Diffstat (limited to 'sys/i386/linux/linux_machdep.c')
-rw-r--r-- | sys/i386/linux/linux_machdep.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 2a825e8..77c49b1 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -31,7 +31,9 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/imgact.h> #include <sys/lock.h> +#include <sys/malloc.h> #include <sys/mman.h> #include <sys/mutex.h> #include <sys/proc.h> @@ -104,21 +106,27 @@ bsd_to_linux_sigaltstack(int bsa) int linux_execve(struct thread *td, struct linux_execve_args *args) { - struct execve_args bsd; - caddr_t sg; + int error; + char *newpath; + struct image_args eargs; - sg = stackgap_init(); - CHECKALTEXIST(td, &sg, args->path); + error = linux_emul_convpath(td, args->path, UIO_USERSPACE, + &newpath, 0); + if (newpath == NULL) + return (error); #ifdef DEBUG if (ldebug(execve)) - printf(ARGS(execve, "%s"), args->path); + printf(ARGS(execve, "%s"), newpath); #endif - bsd.fname = args->path; - bsd.argv = args->argp; - bsd.envv = args->envp; - return (execve(td, &bsd)); + error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE, + args->argp, args->envp); + free(newpath, M_TEMP); + if (error == 0) + kern_execve(td, &eargs, NULL); + exec_free_args(&eargs); + return (error); } struct l_ipc_kludge { |