Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Oct 2014 11:24:50 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Mateusz Guzik <mjguzik@gmail.com>, kib@freebsd.org
Subject:   Re: fork: hold newly created processes
Message-ID:  <201410071124.50230.jhb@freebsd.org>
In-Reply-To: <20141005102912.GB9262@dft-labs.eu>
References:  <20141005102912.GB9262@dft-labs.eu>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410071124.50230.jhb>