1 2010-05-26 Andreas Schwab <schwab@redhat.com>
3 * elf/Makefile: Add rules to build and run unload8 test.
4 * elf/unload8.c: New file.
5 * elf/unload8mod1.c: New file.
6 * elf/unload8mod1x.c: New file.
7 * elf/unload8mod2.c: New file.
8 * elf/unload8mod3.c: New file.
10 * elf/dl-close.c (_dl_close_worker): Reset private search list if
13 Index: glibc-2.12-2-gc4ccff1/elf/Makefile
14 ===================================================================
15 --- glibc-2.12-2-gc4ccff1.orig/elf/Makefile
16 +++ glibc-2.12-2-gc4ccff1/elf/Makefile
17 @@ -89,6 +89,7 @@ distribute := rtld-Rules \
18 unload4mod1.c unload4mod2.c unload4mod3.c unload4mod4.c \
19 unload6mod1.c unload6mod2.c unload6mod3.c \
20 unload7mod1.c unload7mod2.c \
21 + unload8mod1.c unload8mod1x.c unload8mod2.c unload8mod3.c \
22 tst-audit1.c tst-audit2.c tst-audit3.c tst-audit4.c \
23 tst-auditmod1.c tst-auditmod3a.c tst-auditmod3b.c \
24 tst-auditmod4a.c tst-auditmod4b.c \
25 @@ -196,7 +197,7 @@ tests += loadtest restest1 preloadtest l
26 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
27 tst-dlmodcount tst-dlopenrpath tst-deep1 \
28 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
29 - unload3 unload4 unload5 unload6 unload7 tst-global1 order2 \
30 + unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
31 tst-audit1 tst-audit2 \
32 tst-stackguard1 tst-addr1 tst-thrlock \
33 tst-unique1 tst-unique2
34 @@ -247,6 +248,7 @@ modules-names = testobj1 testobj2 testob
35 unload4mod1 unload4mod2 unload4mod3 unload4mod4 \
36 unload6mod1 unload6mod2 unload6mod3 \
37 unload7mod1 unload7mod2 \
38 + unload8mod1 unload8mod1x unload8mod2 unload8mod3 \
39 order2mod1 order2mod2 order2mod3 order2mod4 \
40 tst-unique1mod1 tst-unique1mod2 \
41 tst-unique2mod1 tst-unique2mod2
42 @@ -522,6 +524,9 @@ $(objpfx)unload6mod2.so: $(libdl)
43 $(objpfx)unload6mod3.so: $(libdl)
44 $(objpfx)unload7mod1.so: $(libdl)
45 $(objpfx)unload7mod2.so: $(objpfx)unload7mod1.so
46 +$(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
47 +$(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
48 +$(objpfx)unload8mod3.so: $(libdl)
50 LDFLAGS-tst-tlsmod5.so = -nostdlib
51 LDFLAGS-tst-tlsmod6.so = -nostdlib
52 @@ -823,6 +828,9 @@ $(objpfx)unload7: $(libdl)
53 $(objpfx)unload7.out: $(objpfx)unload7mod1.so $(objpfx)unload7mod2.so
54 unload7-ENV = MALLOC_PERTURB_=85
56 +$(objpfx)unload8: $(libdl)
57 +$(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
60 $(objpfx)tst-tls9-static: $(common-objpfx)dlfcn/libdl.a
61 $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so
62 Index: glibc-2.12-2-gc4ccff1/elf/dl-close.c
63 ===================================================================
64 --- glibc-2.12-2-gc4ccff1.orig/elf/dl-close.c
65 +++ glibc-2.12-2-gc4ccff1/elf/dl-close.c
66 @@ -421,6 +421,13 @@ _dl_close_worker (struct link_map *map)
68 imap->l_scope_max = new_size;
70 + else if (new_list != NULL)
72 + /* We didn't change the scope array, so reset the search
74 + imap->l_searchlist.r_list = NULL;
75 + imap->l_searchlist.r_nlist = 0;
78 /* The loader is gone, so mark the object as not having one.
79 Note: l_idx != IDX_STILL_USED -> object will be removed. */
80 Index: glibc-2.12-2-gc4ccff1/elf/unload8.c
81 ===================================================================
83 +++ glibc-2.12-2-gc4ccff1/elf/unload8.c
91 + void *h = dlopen ("$ORIGIN/unload8mod1.so", RTLD_LAZY);
94 + puts ("dlopen unload8mod1.so failed");
98 + void *h2 = dlopen ("$ORIGIN/unload8mod1x.so", RTLD_LAZY);
101 + puts ("dlopen unload8mod1x.so failed");
106 + int (*mod1) (void) = dlsym (h, "mod1");
109 + puts ("dlsym failed");
118 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
119 ===================================================================
121 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
123 +extern void mod2 (void);
130 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
131 ===================================================================
133 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
136 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
137 ===================================================================
139 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
141 +extern void mod3 (void);
148 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
149 ===================================================================
151 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
171 + void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY);
174 + puts ("dlopen unload8mod2.so failed");
178 + atexit (mod3_fini);