This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix dlclose() removing required local scope elementsof NODELETE linkmaps

On 04/13/2012 06:42 PM, Petr Baudis wrote:
(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 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):

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/ --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 `'
  size = 64
  dlpi_adds = 7 dlpi_subs = 0
loading `'
  size = 64
  dlpi_adds = 8 dlpi_subs = 0
unloading `'
  size = 64
  dlpi_adds = 8 dlpi_subs = 0

 Andreas Jaeger aj@{,} 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]