[PATCH] ld.so: Fix dlclose() removing required local scope elements of NODELETE linkmaps
Andreas Jaeger
aj@suse.com
Fri Apr 13 18:39:00 GMT 2012
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
Andreas
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126
More information about the Libc-alpha
mailing list