[PATCH] ld.so: Fix dlclose() removing required local scope elements of NODELETE linkmaps

Dmitry V. Levin ldv@altlinux.org
Wed Sep 19 21:21:00 GMT 2012


Hi,

On Fri, Apr 13, 2012 at 08:38:23PM +0200, Andreas Jaeger wrote:
> On 04/13/2012 06:42 PM, Petr Baudis wrote:
> >http://sourceware.org/bugzilla/show_bug.cgi?id=12561
> >(Waiting for review for around a year now.)
> >
> >In case a library is opened with RTLD_LOCAL, dlclose()ing that library
> >will remove the local scope from all subsequently loaded libraries
> >unconditionally, even though such a library is marked as RTLD_NODELETE.
> >This causes subsequent lookups within that library to fail if the
> >library depends on other libraries than those already loaded within
> >the global scope.
> >
> >This has been exposed in a real-world case where libproxy opens
> >a KDE4 plugin with RTLD_LOCAL, the plugin depends on libkde4_core
> >and libkde4_core is marked as NODELETE due to having a STB_GNU_UNIQ
> >symbol; the plugin is dlclose()d later but ld.so raises a fatal
> >error when libkde4_core global destructor is called (it depends
> >on libqt4, but libqt4 has been in the plugin's local scope only
> >and is gone now).
> 
> Yeah, a quite nasty bug and we need a fix for this. Thanks for looking 
> again into this.
> 
> >Testcase (by Michael Matz):
> >
> >	http://sourceware.org/bugzilla/attachment.cgi?id=5749
> >
> >Ok to commit?
> 
> Did this pass the testsuite for you?
> 
> I just applied the patch and run the testsuite and got a failure on both 
> x86 and x86-64 for elf/tst-dlmodcount:
> 
> GCONV_PATH=/build/glibc/x86/iconvdata LC_ALL=C 
> /build/glibc/x86/elf/ld-linux.so.2 --library-path 
> /build/glibc/x86:/build/glibc/x86/math:/build/glibc/x86/elf:/build/glibc/x86/dlfcn:/build/glibc/x86/nss:/build/glibc/x86/nis:/build/glibc/x86/rt:/build/glibc/x86/resolv:/build/glibc/x86/crypt:/build/glibc/x86/nptl 
> /build/glibc/x86/elf/tst-dlmodcount  > 
> /build/glibc/x86/elf/tst-dlmodcount.out
> dlpi_subs failed to get incremented!
> make[2]: *** [/build/glibc/x86/elf/tst-dlmodcount.out] Error 4
> 
> cat elf/tst-dlmodcount.out
>   size = 64
>   dlpi_adds = 5 dlpi_subs = 0
> loading `firstobj.so'
>   size = 64
>   dlpi_adds = 7 dlpi_subs = 0
> loading `globalmod1.so'
>   size = 64
>   dlpi_adds = 8 dlpi_subs = 0
> unloading `firstobj.so'
>   size = 64
>   dlpi_adds = 8 dlpi_subs = 0

Was there any follow-up to this?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120919/9c2e61a4/attachment.sig>


More information about the Libc-alpha mailing list