svn commit: r350610 - head/sys/kern
Mariusz Zaborski
oshogbo at FreeBSD.org
Mon Aug 5 19:59:23 UTC 2019
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:
More information about the svn-src-all
mailing list