fork: hold newly created processes

John Baldwin jhb at freebsd.org
Tue Oct 7 16:22:32 UTC 2014


On Sunday, October 05, 2014 6:29:12 am Mateusz Guzik wrote:
> fork: hold newly created processes
> 
> Consumers of fork1 -> do_fork receive new proc pointer, but nothing
> guarnatees its stability at that time.
> 
> New process could already exit and be waited for, in which case we get a
> use after free.
> 
> This is a temporary fix.

As Konstantin noted, this is just a bug in the callers.  If they want to 
access the proc pointer after calling fork(), they should use RF_STOPPED
and setrunqueue() the first thread after they are finished working with it.

-- 
John Baldwin


More information about the freebsd-hackers mailing list