This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: malloc patch for 2.2.4
On Tue, Aug 21, 2001 at 09:51:02AM -0700, Daniel Jacobowitz wrote:
> On Tue, Aug 21, 2001 at 03:55:19PM -0000, Wolfram Gloger wrote:
> > Hi,
> >
> > Argh, if the following is the cause for the strange SMP crashes
> > (haven't yet checked), well, I'll just hide somewhere..
> >
> > Regards,
> > Wolfram.
> >
> > 2001-08-21 Wolfram Gloger <wg@malloc.de>
> >
> > * malloc/malloc.c: Make access to ..._hook pointers thread-safe.
>
> Would you mind explaining how this improves thread safety? It's not as
> if you're trying to keep the hook value consistent across some other
> event; each hook is called once. And in fact, I can see it still being
> thread-unsafe if copying a function pointer is non-atomic. Isn't that
> the case on, say, ia64?
Copying a function pointer on ia64 is certainly atomic, fnptr is a 64bit
variable (the ia64 specific thing is what it points to).
But this patch certainly increases thread-safety - at least it looks like
those hooks can be non-NULL and become NULL in other thread, in which case
if you checked whether it is non-NULL first, then read it from memory again,
it could be NULL already.
Jakub