svn commit: r238336 - head/sys/kern

David Xu davidxu at FreeBSD.org
Tue Jul 10 05:45:13 UTC 2012


Author: davidxu
Date: Tue Jul 10 05:45:13 2012
New Revision: 238336
URL: http://svn.freebsd.org/changeset/base/238336

Log:
  Always clear p_xthread if current thread no longer needs it, in theory, if
  debugger exited without calling ptrace(PT_DETACH), there is a time window
  that the p_xthread may be pointing to non-existing thread, in practical,
  this is not a problem because child process soon will be killed by parent
  process.

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Jul 10 05:39:06 2012	(r238335)
+++ head/sys/kern/kern_sig.c	Tue Jul 10 05:45:13 2012	(r238336)
@@ -2436,9 +2436,10 @@ ptracestop(struct thread *td, int sig)
 		}
 stopme:
 		thread_suspend_switch(td);
-		if (!(p->p_flag & P_TRACED)) {
+		if (p->p_xthread == td)
+			p->p_xthread = NULL;
+		if (!(p->p_flag & P_TRACED))
 			break;
-		}
 		if (td->td_dbgflags & TDB_SUSPEND) {
 			if (p->p_flag & P_SINGLE_EXIT)
 				break;


More information about the svn-src-all mailing list