This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! This is a small variation on unload3, which proves that the 1.109 -> 1.110 change was not even sufficient to fix the problem of unrecorded relocation dependencies between libraries loaded by the same loader while they still have l_opencount == 0. It has dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW); added before the dlclose calls, which results in unload3mod4.so not being unloaded (it must not be unloaded, since it is still in use by the app), but unload3mod3.so which unload3mod4.so has (unrecorded) relocation dependency to, is happily unloaded as unused. 2005-03-08 Jakub Jelinek <jakub@redhat.com> * elf/Makefile: Add rules to build and run unload5 test. * elf/unload5.c: New test. --- libc/elf/Makefile.jj 2005-03-08 14:06:22.000000000 +0100 +++ libc/elf/Makefile 2005-03-08 22:09:39.030712720 +0100 @@ -161,7 +161,7 @@ tests += loadtest restest1 preloadtest l tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \ tst-align2 $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \ tst-dlopenrpath tst-deep1 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \ - unload3 unload4 tst-audit1 tst-global1 + unload3 unload4 unload5 tst-audit1 tst-global1 # reldep9 test-srcs = tst-pathopt tests-vis-yes = vismain @@ -699,6 +699,10 @@ $(objpfx)unload3.out: $(objpfx)unload3mo $(objpfx)unload4: $(libdl) $(objpfx)unload4.out: $(objpfx)unload4mod1.so $(objpfx)unload4mod3.so +$(objpfx)unload5: $(libdl) +$(objpfx)unload5.out: $(objpfx)unload3mod1.so $(objpfx)unload3mod2.so \ + $(objpfx)unload3mod3.so $(objpfx)unload3mod4.so + ifdef libdl $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so --- libc/elf/unload5.c.jj 2005-03-08 22:03:48.349149102 +0100 +++ libc/elf/unload5.c 2005-03-08 22:07:56.241013942 +0100 @@ -0,0 +1,42 @@ +#include <dlfcn.h> +#include <stdio.h> + +int +main (void) +{ + void *g = dlopen ("unload3mod1.so", RTLD_GLOBAL | RTLD_NOW); + void *h = dlopen ("unload3mod2.so", RTLD_GLOBAL | RTLD_NOW); + if (g == NULL || h == NULL) + { + printf ("dlopen unload3mod{1,2}.so failed: %p %p\n", g, h); + return 1; + } + dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW); + dlclose (h); + dlclose (g); + + g = dlopen ("unload3mod3.so", RTLD_GLOBAL | RTLD_NOW); + h = dlopen ("unload3mod4.so", RTLD_GLOBAL | RTLD_NOW); + if (g == NULL || h == NULL) + { + printf ("dlopen unload3mod{3,4}.so failed: %p %p\n", g, h); + return 1; + } + + int (*fn) (int); + fn = dlsym (h, "bar"); + if (fn == NULL) + { + puts ("dlsym failed"); + return 1; + } + + int val = fn (16); + if (val != 24) + { + printf ("bar returned %d != 24\n", val); + return 1; + } + + return 0; +} Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |