Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2019 20:14:52 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352179 - stable/12/sys/kern
Message-ID:  <201909102014.x8AKEqDo051576@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Tue Sep 10 20:14:52 2019
New Revision: 352179
URL: https://svnweb.freebsd.org/changeset/base/352179

Log:
  MFCr350610:
    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

Modified:
  stable/12/sys/kern/kern_exit.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_exit.c
==============================================================================
--- stable/12/sys/kern/kern_exit.c	Tue Sep 10 20:11:00 2019	(r352178)
+++ stable/12/sys/kern/kern_exit.c	Tue Sep 10 20:14:52 2019	(r352179)
@@ -335,7 +335,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;
 
 	/*
@@ -437,6 +436,11 @@ exit1(struct thread *td, int rval, int signo)
 	LIST_INSERT_HEAD(&zombproc, p, p_list);
 	LIST_REMOVE(p, p_hash);
 	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?201909102014.x8AKEqDo051576>