tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Anomalies while handling p_nstopchild count



On Sun, Oct 11, 2015 at 04:39:55AM +0700, Robert Elz wrote:
> This in spawn_return() [kern_exec.c]
> 
> There the status of the process is set to SSTOP without incrementing
> the parent's p_nstopchild, violating the definition of that field.
> But then it is (fairly soon after) set back again .. if no error occurred.
> 
> If there was an error, spawn_return() calls exit1(), which (eventually)
> sets the process state to SDEAD and increments the parent's p_nstopchild
> (regardless of the state of the process when exit1() was called).
> (Before SDEAD the state is set to SDYING, where p_nstopchild should not
> count it.)
> 
> Hence if p_nstopchild had been incremented in spawn_return() and not
> decremented again (as the state is left at SSTOP in the error case),
> then exit1() would cause the process to be counted twice.

We should still fix this error path!

Martin


Home | Main Index | Thread Index | Old Index