On 17/02/25(Mon) 03:16, Claudio Jeker wrote: > CVSROOT: /cvs > Module name: src > Changes by: clau...@cvs.openbsd.org 2025/02/17 03:16:05 > > Modified files: > sys/kern : kern_exit.c > > Log message: > Use ps_mtx to lock the child process that is being checked by dowait6. > > The checks of the various ps_flags field is all but atomic so we need > to lock the process before doing all these checks. Only that way a > reliable result is seen. It also ensures that the child process did > finish the transition before signaling up to the parent.
Why not read `ps_flags' only once? Anyway I don't understand what is being protected here. It is really hard to follow without documentation. Can you tells us which fields you're serializing access with `ps_mtx' in sys/proc.h? This should be like the manual rule. Locking MUST BE documented.