Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2022 17:31:45 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 49afea105912 - main - proc: read the pid prior to unlocking in report_alive_proc1
Message-ID:  <202208251731.27PHVjxf043731@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208251731.27PHVjxf043731>