svn commit: r283544 - in head/sys: amd64/linux32 compat/linux i386/linux

Dmitry Chagin dchagin at FreeBSD.org
Mon May 25 20:44:48 UTC 2015


Author: dchagin
Date: Mon May 25 20:44:46 2015
New Revision: 283544
URL: https://svnweb.freebsd.org/changeset/base/283544

Log:
  When I merged the lemul branch I missied kib@'s r282708 commit.
  This is not the final fix as I need properly cleanup thread resources
  before other threads suicide.
  
  Tested by:	Ruslan Makhmatkhanov

Modified:
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/compat/linux/linux_emul.c
  head/sys/i386/linux/linux_machdep.c

Modified: head/sys/amd64/linux32/linux32_machdep.c
==============================================================================
--- head/sys/amd64/linux32/linux32_machdep.c	Mon May 25 20:29:35 2015	(r283543)
+++ head/sys/amd64/linux32/linux32_machdep.c	Mon May 25 20:44:46 2015	(r283544)
@@ -126,7 +126,6 @@ int
 linux_execve(struct thread *td, struct linux_execve_args *args)
 {
 	struct image_args eargs;
-	struct vmspace *oldvmspace;
 	char *path;
 	int error;
 
@@ -137,19 +136,11 @@ linux_execve(struct thread *td, struct l
 		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)
 		error = linux_common_execve(td, &eargs);
-	post_execve(td, error, oldvmspace);
 	return (error);
 }
 

Modified: head/sys/compat/linux/linux_emul.c
==============================================================================
--- head/sys/compat/linux/linux_emul.c	Mon May 25 20:29:35 2015	(r283543)
+++ head/sys/compat/linux/linux_emul.c	Mon May 25 20:44:46 2015	(r283544)
@@ -172,27 +172,19 @@ linux_common_execve(struct thread *td, s
 {
 	struct linux_pemuldata *pem;
 	struct epoll_emuldata *emd;
+	struct vmspace *oldvmspace;
 	struct linux_emuldata *em;
 	struct proc *p;
 	int error;
 
 	p = td->td_proc;
 
-	/*
-	 * Unlike FreeBSD abort all other threads before
-	 * proceeding exec.
-	 */
-	PROC_LOCK(p);
-	/* See exit1() comments. */
-	thread_suspend_check(0);
-	while (p->p_flag & P_HADTHREADS) {
-		if (!thread_single(p, SINGLE_EXIT))
-			break;
-		thread_suspend_check(0);
-	}
-	PROC_UNLOCK(p);
+	error = pre_execve(td, &oldvmspace);
+	if (error != 0)
+		return (error);
 
 	error = kern_execve(td, eargs, NULL);
+	post_execve(td, error, oldvmspace);
 	if (error != 0)
 		return (error);
 

Modified: head/sys/i386/linux/linux_machdep.c
==============================================================================
--- head/sys/i386/linux/linux_machdep.c	Mon May 25 20:29:35 2015	(r283543)
+++ head/sys/i386/linux/linux_machdep.c	Mon May 25 20:44:46 2015	(r283544)
@@ -104,7 +104,6 @@ int
 linux_execve(struct thread *td, struct linux_execve_args *args)
 {
 	struct image_args eargs;
-	struct vmspace *oldvmspace;
 	char *newpath;
 	int error;
 
@@ -115,19 +114,11 @@ linux_execve(struct thread *td, struct l
 		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)
 		error = linux_common_execve(td, &eargs);
-	post_execve(td, error, oldvmspace);
 	return (error);
 }
 


More information about the svn-src-head mailing list