diff options
author | kib <kib@FreeBSD.org> | 2015-05-24 07:32:02 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-05-24 07:32:02 +0000 |
commit | 0d8ee7566b4bab2d197db6ce3ad8e5f4667ab319 (patch) | |
tree | 10a359f89eb0d5ea4f3d3643fb851c21a9bba508 /sys/i386/linux/linux_machdep.c | |
parent | b7a860bb3a919e24d54388f1a29bff11e93832e0 (diff) | |
download | FreeBSD-src-0d8ee7566b4bab2d197db6ce3ad8e5f4667ab319.zip FreeBSD-src-0d8ee7566b4bab2d197db6ce3ad8e5f4667ab319.tar.gz |
MFC r282708:
On exec, single-threading must be enforced before arguments space is
allocated from exec_map.
Diffstat (limited to 'sys/i386/linux/linux_machdep.c')
-rw-r--r-- | sys/i386/linux/linux_machdep.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index d9c28d9..effc32a 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -126,9 +126,10 @@ bsd_to_linux_sigaltstack(int bsa) int linux_execve(struct thread *td, struct linux_execve_args *args) { - int error; - char *newpath; struct image_args eargs; + struct vmspace *oldvmspace; + char *newpath; + int error; LCONVPATHEXIST(td, args->path, &newpath); @@ -137,12 +138,17 @@ linux_execve(struct thread *td, struct linux_execve_args *args) printf(ARGS(execve, "%s"), newpath); #endif + error = pre_execve(td, &oldvmspace); + if (error != 0) { + free(newpath, M_TEMP); + return (error); + } error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE, args->argp, args->envp); free(newpath, M_TEMP); if (error == 0) error = kern_execve(td, &eargs, NULL); - if (error == 0) + if (error == 0) { /* linux process can exec fbsd one, dont attempt * to create emuldata for such process using * linux_proc_init, this leads to a panic on KASSERT @@ -150,6 +156,8 @@ linux_execve(struct thread *td, struct linux_execve_args *args) */ if (SV_PROC_ABI(td->td_proc) == SV_ABI_LINUX) error = linux_proc_init(td, 0, 0); + } + post_execve(td, error, oldvmspace); return (error); } |