glibc 2.3 fork() on i386-gnu crashes if malloc is overridden

Marcus Brinkmann Marcus.Brinkmann@ruhr-uni-bochum.de
Mon Nov 18 14:18:00 GMT 2002


On Mon, Nov 18, 2002 at 01:41:49PM +0100, Wolfram Gloger wrote:
> > So, either ptmalloc_init must always be called for us, or the fork hook
> > code needs to be made robust not to fail if malloc wasn't initialized,
> 
> I opted for this solution, see below.

I tried your patch, and it works, thanks a lot!
 
> > the hook functions shouldn't be registered if ptmalloc_init wasn't called,
> > or another solution I can't think of.
> 
> It would be best if the atfork hooks wouldn't be registered at all if
> a non-glibc malloc was in use, just like it is on anything but Hurd.
> But I suspect this is impossible.

Roland should know.  I don't know if it is feasible, it seems to me that currently
the hooks are defined at link time, rather than run time.

I originally thought that a program using linuxthreads and overriding malloc
would show the same problem, but I didn't bother to try hard.  A simple test
with preloading libpthread when running bash didn't provoke it.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/



More information about the Libc-alpha mailing list