Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Aug 2019 19:59:23 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350610 - head/sys/kern
Message-ID:  <201908051959.x75JxNIm076485@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Mon Aug  5 19:59:23 2019
New Revision: 350610
URL: https://svnweb.freebsd.org/changeset/base/350610

Log:
  exit1: postpone clearing P_TRACED flag until the proctree lock is acquired
  
  In case of the process being debugged. The P_TRACED is cleared very early,
  which would make procdesc_close() not calling proc_clear_orphan().
  That would result in the debugged process can not be able to collect
  status of the process with process descriptor.
  
  Reviewed by:	markj, kib
  Tested by:	pho
  MFC after:	1 month

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Mon Aug  5 19:30:28 2019	(r350609)
+++ head/sys/kern/kern_exit.c	Mon Aug  5 19:59:23 2019	(r350610)
@@ -355,7 +355,6 @@ exit1(struct thread *td, int rval, int signo)
 	 */
 	PROC_LOCK(p);
 	stopprofclock(p);
-	p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
 	p->p_ptevents = 0;
 
 	/*
@@ -458,6 +457,9 @@ exit1(struct thread *td, int rval, int signo)
 	sx_xunlock(&allproc_lock);
 
 	sx_xlock(&proctree_lock);
+	PROC_LOCK(p);
+	p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
+	PROC_UNLOCK(p);
 
 	/*
 	 * Reparent all children processes:



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