From: claudio Date: Tue, 6 Aug 2024 18:41:20 +0000 (+0000) Subject: Revert the knote_processexit() bits of the diff. It introduced a small X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=3920ff05e7c81ca8c9158fa69b8d255ed073a014;p=openbsd 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@ --- 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);