git: 49afea105912 - main - proc: read the pid prior to unlocking in report_alive_proc1
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 25 Aug 2022 17:31:45 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=49afea10591249b6cb73ea1c51a28d2334d7dd52 commit 49afea10591249b6cb73ea1c51a28d2334d7dd52 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2022-08-25 17:26:49 +0000 Commit: Mateusz Guzik <mjg@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