Re: fork: out of memory

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Wed, 26 Nov 1997 19:14:52 +0100 (MET)


Alan Cox wrote:
>
> > I really don't get it.
> >
> > before after
> > 0x12345 0x23456
> > blah -> files -> [ 0 ] blah -> files -> [ 0 ]
> > [ 1 ] [ 1 ]
> > ... ...
> > [ n ] ----> somefile [ n ] ----> somefile
> > ... ...
> > [ 64 ] [1024]
> >
>
> Try
>
> blah->files 0x123456, then take an interrupt, (busy)
>
> other CPU
> move blah->files
> free original
> realloc it
> scribble
>
> first CPU again
> *0123456 - wrong address
> defer file pointer
> Squawk, bang bang Im dead
>
>

Ah. Now I see how you could come to this conclusion. I was working on
the assumtion that the files array could not be freed, because it was
part of the structure that contained it.

You need a complete (also against readers) if you're going to free the
original.

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** +31-15-2137555 ** http://www.BitWizard.nl/ **
Florida -- A 39 year old construction worker woke up this morning when a
109-car freight train drove over him. According to the police the man was 
drunk. The man himself claims he slipped while walking the dog. 080897