mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 10:10:24 -04:00
reap_kill_subtree_once(): handle proctree_lock unlock in reap_kill_proc()
Recorded reaper might loose its reaper status, so we should not assert it, but check and avoid signalling if this happens. Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 week Differential revision: https://reviews.freebsd.org/D35310
This commit is contained in:
parent
addf103ce6
commit
1d4abf2cfa
1 changed files with 13 additions and 1 deletions
|
|
@ -370,8 +370,20 @@ reap_kill_subtree_once(struct thread *td, struct proc *p, struct proc *reaper,
|
|||
TAILQ_INIT(&tracker);
|
||||
reap_kill_sched(&tracker, reaper);
|
||||
while ((t = TAILQ_FIRST(&tracker)) != NULL) {
|
||||
MPASS((t->parent->p_treeflag & P_TREE_REAPER) != 0);
|
||||
TAILQ_REMOVE(&tracker, t, link);
|
||||
|
||||
/*
|
||||
* Since reap_kill_proc() drops proctree_lock sx, it
|
||||
* is possible that the tracked reaper is no longer.
|
||||
* In this case the subtree is reparented to the new
|
||||
* reaper, which should handle it.
|
||||
*/
|
||||
if ((t->parent->p_treeflag & P_TREE_REAPER) == 0) {
|
||||
free(t, M_TEMP);
|
||||
res = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
LIST_FOREACH(p2, &t->parent->p_reaplist, p_reapsibling) {
|
||||
if (t->parent == reaper &&
|
||||
(rk->rk_flags & REAPER_KILL_SUBTREE) != 0 &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue