summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-05-24 07:32:02 +0000
committerkib <kib@FreeBSD.org>2015-05-24 07:32:02 +0000
commit0d8ee7566b4bab2d197db6ce3ad8e5f4667ab319 (patch)
tree10a359f89eb0d5ea4f3d3643fb851c21a9bba508 /sys/amd64
parentb7a860bb3a919e24d54388f1a29bff11e93832e0 (diff)
downloadFreeBSD-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/amd64')
-rw-r--r--sys/amd64/linux32/linux32_machdep.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 2b955d0..155e90b 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -137,6 +137,7 @@ int
linux_execve(struct thread *td, struct linux_execve_args *args)
{
struct image_args eargs;
+ struct vmspace *oldvmspace;
char *path;
int error;
@@ -147,12 +148,17 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
printf(ARGS(execve, "%s"), path);
#endif
+ error = pre_execve(td, &oldvmspace);
+ if (error != 0) {
+ free(path, M_TEMP);
+ return (error);
+ }
error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
args->argp, args->envp);
free(path, M_TEMP);
if (error == 0)
error = kern_execve(td, &eargs, NULL);
- if (error == 0)
+ if (error == 0) {
/* Linux process can execute FreeBSD one, do not attempt
* to create emuldata for such process using
* linux_proc_init, this leads to a panic on KASSERT
@@ -160,6 +166,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);
}
OpenPOWER on IntegriCloud