The branch main has been updated by mjg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=49afea10591249b6cb73ea1c51a28d2334d7dd52

commit 49afea10591249b6cb73ea1c51a28d2334d7dd52
Author:     Mateusz Guzik <m...@freebsd.org>
AuthorDate: 2022-08-25 17:26:49 +0000
Commit:     Mateusz Guzik <m...@freebsd.org>
CommitDate: 2022-08-25 17:26:49 +0000

    proc: read the pid prior to unlocking in report_alive_proc1
    
    In principle another thread could have reaped the process by that time.
---
 sys/kern/kern_exit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index cb51193a26e0..4cf31aa73e56 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1269,8 +1269,8 @@ report_alive_proc(struct thread *td, struct proc *p, 
siginfo_t *siginfo,
        }
        if (status != NULL)
                *status = cont ? SIGCONT : W_STOPCODE(p->p_xsig);
-       PROC_UNLOCK(p);
        td->td_retval[0] = p->p_pid;
+       PROC_UNLOCK(p);
 }
 
 int

Reply via email to