Subject: Re: SMP problems in fork()?
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 12/08/2002 14:12:25
On Sun, Dec 08, 2002 at 09:42:58PM +0100, Emmanuel Dreyfus wrote:
> In fork1(), we set the child as runnable, and we use a pointer to its
> proc structure after this.
>
> On a SMP system, the child could be scheduled for running on another
> CPU, and it could even die before we get out of fork1(), thus making us
> using a stale pointer on its struct proc.
>
> It seems to me that we need to cleanup the end of fork1(), but I'm not
> sure of what should be done.
You've just discovered one of the wonderful reasons why we must still run
with a Giant Kernel Lock.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>