svn commit: r364329 - head/sys/compat/linux

Mark Johnston markj at FreeBSD.org
Mon Aug 17 21:30:49 UTC 2020


Author: markj
Date: Mon Aug 17 21:30:49 2020
New Revision: 364329
URL: https://svnweb.freebsd.org/changeset/base/364329

Log:
  Remove "emulation" of clone(CLONE_PARENT | CLONE_THREAD).
  
  On Linux this is supposed to result in EINVAL.
  
  Reported by:	syzkaller
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/compat/linux/linux_fork.c

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c	Mon Aug 17 21:30:15 2020	(r364328)
+++ head/sys/compat/linux/linux_fork.c	Mon Aug 17 21:30:49 2020	(r364329)
@@ -244,6 +244,8 @@ linux_clone_thread(struct thread *td, struct linux_clo
 	    td->td_tid, (unsigned)args->flags,
 	    args->parent_tidptr, args->child_tidptr);
 
+	if ((args->flags & LINUX_CLONE_PARENT) != 0)
+		return (EINVAL);
 	if (args->flags & LINUX_CLONE_PARENT_SETTID)
 		if (args->parent_tidptr == NULL)
 			return (EINVAL);
@@ -304,12 +306,8 @@ linux_clone_thread(struct thread *td, struct linux_clo
 
 	PROC_LOCK(p);
 	p->p_flag |= P_HADTHREADS;
+	thread_link(newtd, p);
 	bcopy(p->p_comm, newtd->td_name, sizeof(newtd->td_name));
-
-	if (args->flags & LINUX_CLONE_PARENT)
-		thread_link(newtd, p->p_pptr);
-	else
-		thread_link(newtd, p);
 
 	thread_lock(td);
 	/* let the scheduler know about these things. */


More information about the svn-src-all mailing list