summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-08-06 18:41:21 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-08-06 18:41:21 +0000
commit2a48c4e1c18515bf90be650cbdce8aebb1f7c303 (patch)
treea9d6067e4abc2c701e6351ccc7323e957150203e /sys/kern
parentf538b0b32a5cd290f3359def193e494f1b8cda01 (diff)
Revert the knote_processexit() bits of the diff. It introduced a small
window where a knote is available but PS_ZOMBIE is not yet set (causing waitpid() to not return that pid). Requested by jca@ and deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exit.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index db989e29957..280af8ce006 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exit.c,v 1.229 2024/08/06 08:44:54 claudio Exp $ */
+/* $OpenBSD: kern_exit.c,v 1.230 2024/08/06 18:41:20 claudio Exp $ */
/* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */
/*
@@ -477,13 +477,16 @@ reaper(void *arg)
/* Release the rest of the process's vmspace */
uvm_exit(pr);
- /* Notify listeners of our demise and clean up. */
- knote_processexit(pr);
-
KERNEL_LOCK();
if ((pr->ps_flags & PS_NOZOMBIE) == 0) {
/* Process is now a true zombie. */
atomic_setbits_int(&pr->ps_flags, PS_ZOMBIE);
+ }
+
+ /* Notify listeners of our demise and clean up. */
+ knote_processexit(pr);
+
+ if (pr->ps_flags & PS_ZOMBIE) {
/* Post SIGCHLD and wake up parent. */
prsignal(pr->ps_pptr, SIGCHLD);
wakeup(pr->ps_pptr);