summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_exit.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index a923c02..2f3fb3a 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -430,6 +430,13 @@ exit1(struct thread *td, int rv)
if (q->p_flag & P_TRACED) {
struct thread *temp;
+ /*
+ * Since q was found on our children list, the
+ * proc_reparent() call moved q to the orphan
+ * list due to present P_TRACED flag. Clear
+ * orphan link for q now while q is locked.
+ */
+ clear_orphan(q);
q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE);
FOREACH_THREAD_IN_PROC(q, temp)
temp->td_dbgflags &= ~TDB_SUSPEND;
@@ -438,6 +445,15 @@ exit1(struct thread *td, int rv)
PROC_UNLOCK(q);
}
+ /*
+ * Also get rid of our orphans.
+ */
+ while ((q = LIST_FIRST(&p->p_orphans)) != NULL) {
+ PROC_LOCK(q);
+ clear_orphan(q);
+ PROC_UNLOCK(q);
+ }
+
/* Save exit status. */
PROC_LOCK(p);
p->p_xthread = td;
OpenPOWER on IntegriCloud