svn commit: r295249 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Feb 4 10:49:36 UTC 2016


Author: kib
Date: Thu Feb  4 10:49:34 2016
New Revision: 295249
URL: https://svnweb.freebsd.org/changeset/base/295249

Log:
  Guard against runnable td2 exiting and than being reused for unrelated
  process when the parent sleeps waiting for the debugger attach on
  fork.
  
  Diagnosed and reviewed by:	mjg
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Thu Feb  4 09:39:08 2016	(r295248)
+++ head/sys/kern/kern_fork.c	Thu Feb  4 10:49:34 2016	(r295249)
@@ -777,7 +777,7 @@ do_fork(struct thread *td, struct fork_r
 	/*
 	 * Wait until debugger is attached to child.
 	 */
-	while ((td2->td_dbgflags & TDB_STOPATFORK) != 0)
+	while (td2->td_proc == p2 && (td2->td_dbgflags & TDB_STOPATFORK) != 0)
 		cv_wait(&p2->p_dbgwait, &p2->p_mtx);
 	_PRELE(p2);
 	racct_proc_fork_done(p2);


More information about the svn-src-all mailing list