svn commit: r352179 - stable/12/sys/kern

Mariusz Zaborski oshogbo at FreeBSD.org
Tue Sep 10 20:14:52 UTC 2019


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:


More information about the svn-src-stable-12 mailing list