On Thu, Feb 28, 2013 at 11:59 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Feb 28, 2013 at 11:57:48AM -0800, Cary Coutant wrote: >> Similarly, couldn't dlopen drop the loader lock while calling malloc? > > It can't, but perhaps it could call some alternative malloc instead > (the simpler malloc version in ld.so or similar).
ld-linux starts calling the simpler malloc in dl-minimal.c, then switches to "real" libc.so.6 malloc later on. This behavior causes a lot of pain to anyone who tries to interpose malloc and use dlsym(RTLD_NEXT,...) or similar from the interposer. Roland explained to me ~15 years ago why it is that way (it had something to do with Hurd); an explanation I can't find at the moment. -- Paul Pluzhnikov