]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh593686.patch
Merge branch 'strongswan-5' into thirteen
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh593686.patch
1 2010-05-26 Andreas Schwab <schwab@redhat.com>
2
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.
9
10 * elf/dl-close.c (_dl_close_worker): Reset private search list if
11 it wasn't used.
12
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)
49
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
55
56 +$(objpfx)unload8: $(libdl)
57 +$(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so
58 +
59 ifdef libdl
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)
67
68 imap->l_scope_max = new_size;
69 }
70 + else if (new_list != NULL)
71 + {
72 + /* We didn't change the scope array, so reset the search
73 + list. */
74 + imap->l_searchlist.r_list = NULL;
75 + imap->l_searchlist.r_nlist = 0;
76 + }
77
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 ===================================================================
82 --- /dev/null
83 +++ glibc-2.12-2-gc4ccff1/elf/unload8.c
84 @@ -0,0 +1,33 @@
85 +#include <dlfcn.h>
86 +#include <stdio.h>
87 +
88 +int
89 +main (void)
90 +{
91 + void *h = dlopen ("$ORIGIN/unload8mod1.so", RTLD_LAZY);
92 + if (h == NULL)
93 + {
94 + puts ("dlopen unload8mod1.so failed");
95 + return 1;
96 + }
97 +
98 + void *h2 = dlopen ("$ORIGIN/unload8mod1x.so", RTLD_LAZY);
99 + if (h2 == NULL)
100 + {
101 + puts ("dlopen unload8mod1x.so failed");
102 + return 1;
103 + }
104 + dlclose (h2);
105 +
106 + int (*mod1) (void) = dlsym (h, "mod1");
107 + if (mod1 == NULL)
108 + {
109 + puts ("dlsym failed");
110 + return 1;
111 + }
112 +
113 + mod1 ();
114 + dlclose (h);
115 +
116 + return 0;
117 +}
118 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
119 ===================================================================
120 --- /dev/null
121 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod1.c
122 @@ -0,0 +1,7 @@
123 +extern void mod2 (void);
124 +
125 +void
126 +mod1 (void)
127 +{
128 + mod2 ();
129 +}
130 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
131 ===================================================================
132 --- /dev/null
133 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod1x.c
134 @@ -0,0 +1 @@
135 +int mod1x;
136 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
137 ===================================================================
138 --- /dev/null
139 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod2.c
140 @@ -0,0 +1,7 @@
141 +extern void mod3 (void);
142 +
143 +void
144 +mod2 (void)
145 +{
146 + mod3 ();
147 +}
148 Index: glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
149 ===================================================================
150 --- /dev/null
151 +++ glibc-2.12-2-gc4ccff1/elf/unload8mod3.c
152 @@ -0,0 +1,27 @@
153 +#include <dlfcn.h>
154 +#include <stdio.h>
155 +#include <stdlib.h>
156 +
157 +void
158 +mod3_fini2 (void)
159 +{
160 +}
161 +
162 +void
163 +mod3_fini (void)
164 +{
165 + mod3_fini2 ();
166 +}
167 +
168 +void
169 +mod3 (void)
170 +{
171 + void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY);
172 + if (h == NULL)
173 + {
174 + puts ("dlopen unload8mod2.so failed");
175 + exit (1);
176 + }
177 +
178 + atexit (mod3_fini);
179 +}