git: 9a24a80a17be - stable/13 - reap_kill_proc(): avoid singlethreading any other process if we are exiting

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 19:37:09 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9a24a80a17be36eb63caeb9ef189b0ce0048246f

commit 9a24a80a17be36eb63caeb9ef189b0ce0048246f
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-05-16 23:47:20 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-24 14:45:50 +0000

    reap_kill_proc(): avoid singlethreading any other process if we are exiting
    
    Tested by:      pho (whole series MFC)
    
    (cherry picked from commit 1575804961d2ba1768c9a6b28438d364421718f3)
---
 sys/kern/kern_procctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
index b32a4156dafb..79725686bc44 100644
--- a/sys/kern/kern_procctl.c
+++ b/sys/kern/kern_procctl.c
@@ -291,6 +291,7 @@ reap_kill_proc_locked(struct thread *td, struct proc *p2,
 	 * race.
 	 */
 	need_stop = p2 != td->td_proc &&
+	    (td->td_proc->p_flag2 & P2_WEXIT) == 0 &&
 	    (p2->p_flag & (P_KPROC | P_SYSTEM | P_STOPPED)) == 0 &&
 	    (rk->rk_flags & REAPER_KILL_CHILDREN) == 0;