Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Feb 2016 10:49:34 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r295249 - head/sys/kern
Message-ID:  <201602041049.u14AnY3x036359@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602041049.u14AnY3x036359>