From: Vitaliy Makkoveev Subject: Re: Kernel protection fault in fill_kproc() To: Philip Guenther Cc: Gerhard Roth , "tech@openbsd.org" , "mpi@openbsd.org" , Carsten Beckmann Date: Tue, 12 Aug 2025 12:16:13 +0300 On Tue, Aug 12, 2025 at 02:02:45AM -0700, Philip Guenther wrote: > Nope. Hiding all zombie processes from ps is going to be both confusing and > misleading. > > Philip Guenther > So, we should do vmspace teardown after we remove the process from the allprocess list. I proposed to do this in my initial diff: Index: sys/kern/kern_exit.c =================================================================== RCS file: /cvs/src/sys/kern/kern_exit.c,v diff -u -p -r1.251 kern_exit.c --- sys/kern/kern_exit.c 3 Jun 2025 08:38:17 -0000 1.251 +++ sys/kern/kern_exit.c 11 Aug 2025 15:38:06 -0000 @@ -497,9 +497,7 @@ reaper(void *arg) proc_free(p); } else { struct process *pr = p->p_p; - - /* Release the rest of the process's vmspace */ - uvm_exit(pr); + struct vmspace *vm = pr->ps_vmspace; KERNEL_LOCK(); if ((pr->ps_flags & PS_NOZOMBIE) == 0) { @@ -521,6 +519,9 @@ reaper(void *arg) process_zap(pr); } KERNEL_UNLOCK(); + + /* Release the rest of the process's vmspace */ + uvmspace_free(vm); } } }