]>
Commit | Line | Data |
---|---|---|
0cd3962f AM |
1 | diff --git a/ChangeLog b/ChangeLog |
2 | index cb9124e..ee071b9 100644 | |
3 | --- a/ChangeLog | |
4 | +++ b/ChangeLog | |
5 | @@ -1,3 +1,47 @@ | |
6 | +2015-08-10 Maxim Ostapenko <m.ostapenko@partner.samsung.com> | |
7 | + | |
8 | + [BZ #18778] | |
9 | + * elf/Makefile (tests): Add Add tst-nodelete2. | |
10 | + (modules-names): Add tst-nodelete2mod. | |
11 | + (tst-nodelete2mod.so-no-z-defs): New. | |
12 | + ($(objpfx)tst-nodelete2): Likewise. | |
13 | + ($(objpfx)tst-nodelete2.out): Likewise. | |
14 | + (LDFLAGS-tst-nodelete2): Likewise. | |
15 | + * elf/dl-close.c (_dl_close_worker): Move DF_1_NODELETE clearing | |
16 | + out of loop through all loaded libraries. | |
17 | + * elf/tst-nodelete2.c: New file. | |
18 | + * elf/tst-nodelete2mod.c: Likewise. | |
19 | + | |
20 | +2015-08-10 Andreas Schwab <schwab@suse.de> | |
21 | + | |
22 | + [BZ #18781] | |
23 | + * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add | |
24 | + MORE_OFLAGS to oflag. | |
25 | + * io/test-lfs.c (do_test): Test openat64. | |
26 | + | |
27 | +2015-08-08 John David Anglin <danglin@gcc.gnu.org> | |
28 | + | |
29 | + [BZ #18787] | |
30 | + * sysdeps/unix/sysv/linux/hppa/bits/atomic.h (_LWS_CLOBBER): Revise | |
31 | + clobber registers. | |
32 | + (atomic_compare_and_exchange_val_acq): Use register asms to assign | |
33 | + operand registers. Use register %r20 for EAGAIN and EDEADLOCK checks. | |
34 | + Cast return to __typeof (oldval). | |
35 | + | |
36 | +2015-08-08 Mike Frysinger <vapier@gentoo.org> | |
37 | + | |
38 | + * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Wrap the whole file | |
39 | + in _LINUX_MICROBLAZE_SYSDEP_H defines. Include sysdeps/unix/sysdep.h | |
40 | + and delete sys/syscall.h include. | |
41 | + | |
42 | +2015-08-07 Mike Frysinger <vapier@gentoo.org> | |
43 | + | |
44 | + * sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Add rtld_hidden_def. | |
45 | + | |
46 | +2015-08-05 Zack Weinberg <zackw@panix.com> | |
47 | + | |
48 | + * misc/regexp.h: Update comments. | |
49 | + | |
50 | 2015-08-05 Carlos O'Donell <carlos@systemhalted.org> | |
51 | ||
52 | * version.h (RELEASE): Set to "stable". | |
53 | diff --git a/NEWS b/NEWS | |
54 | index 4c31de7..d89d8e9 100644 | |
55 | --- a/NEWS | |
56 | +++ b/NEWS | |
57 | @@ -5,6 +5,12 @@ See the end for copying conditions. | |
58 | Please send GNU C library bug reports via <http://sourceware.org/bugzilla/> | |
59 | using `glibc' in the "product" field. | |
60 | \f | |
61 | +Version 2.22.1 | |
62 | + | |
63 | +* The following bugs are resolved with this release: | |
64 | + | |
65 | + 18778, 18781, 18787. | |
66 | +\f | |
67 | Version 2.22 | |
68 | ||
69 | * The following bugs are resolved with this release: | |
70 | @@ -84,7 +90,7 @@ Version 2.22 | |
71 | release. Use of this header will trigger a deprecation warning. | |
72 | Application developers should update their code to use <regex.h> instead. | |
73 | ||
74 | - This header was formerly part of SUSv2, but was deprecated in 1997 and | |
75 | + This header was formerly part of SUS, but was deprecated in 1994 and | |
76 | removed from the standard in 2001. Also, the glibc implementation | |
77 | leaks memory. See BZ#18681 for more details. | |
78 | \f | |
79 | diff --git a/elf/Makefile b/elf/Makefile | |
80 | index 4ceeaf8..71a18a1 100644 | |
81 | --- a/elf/Makefile | |
82 | +++ b/elf/Makefile | |
83 | @@ -148,7 +148,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ | |
84 | tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \ | |
85 | tst-nodelete) \ | |
86 | tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \ | |
87 | - tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened | |
88 | + tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ | |
89 | + tst-nodelete2 | |
90 | # reldep9 | |
91 | ifeq ($(build-hardcoded-path-in-tests),yes) | |
92 | tests += tst-dlopen-aout | |
93 | @@ -218,7 +219,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ | |
94 | tst-initorder2d \ | |
95 | tst-relsort1mod1 tst-relsort1mod2 tst-array2dep \ | |
96 | tst-array5dep tst-null-argv-lib \ | |
97 | - tst-tlsalign-lib tst-nodelete-opened-lib | |
98 | + tst-tlsalign-lib tst-nodelete-opened-lib tst-nodelete2mod | |
99 | ifeq (yes,$(have-protected-data)) | |
100 | modules-names += tst-protected1moda tst-protected1modb | |
101 | tests += tst-protected1a tst-protected1b | |
102 | @@ -594,6 +595,7 @@ tst-auditmod9b.so-no-z-defs = yes | |
103 | tst-nodelete-uniquemod.so-no-z-defs = yes | |
104 | tst-nodelete-rtldmod.so-no-z-defs = yes | |
105 | tst-nodelete-zmod.so-no-z-defs = yes | |
106 | +tst-nodelete2mod.so-no-z-defs = yes | |
107 | ||
108 | ifeq ($(build-shared),yes) | |
109 | # Build all the modules even when not actually running test programs. | |
110 | @@ -1164,6 +1166,11 @@ $(objpfx)tst-nodelete.out: $(objpfx)tst-nodelete-uniquemod.so \ | |
111 | LDFLAGS-tst-nodelete = -rdynamic | |
112 | LDFLAGS-tst-nodelete-zmod.so = -Wl,--enable-new-dtags,-z,nodelete | |
113 | ||
114 | +$(objpfx)tst-nodelete2: $(libdl) | |
115 | +$(objpfx)tst-nodelete2.out: $(objpfx)tst-nodelete2mod.so | |
116 | + | |
117 | +LDFLAGS-tst-nodelete2 = -rdynamic | |
118 | + | |
119 | $(objpfx)tst-initorder-cmp.out: tst-initorder.exp $(objpfx)tst-initorder.out | |
120 | cmp $^ > $@; \ | |
121 | $(evaluate-test) | |
122 | diff --git a/elf/dl-close.c b/elf/dl-close.c | |
123 | index 9105277..c897247 100644 | |
124 | --- a/elf/dl-close.c | |
125 | +++ b/elf/dl-close.c | |
126 | @@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map, bool force) | |
127 | char done[nloaded]; | |
128 | struct link_map *maps[nloaded]; | |
129 | ||
130 | + /* Clear DF_1_NODELETE to force object deletion. We don't need to touch | |
131 | + l_tls_dtor_count because forced object deletion only happens when an | |
132 | + error occurs during object load. Destructor registration for TLS | |
133 | + non-POD objects should not have happened till then for this | |
134 | + object. */ | |
135 | + if (force) | |
136 | + map->l_flags_1 &= ~DF_1_NODELETE; | |
137 | + | |
138 | /* Run over the list and assign indexes to the link maps and enter | |
139 | them into the MAPS array. */ | |
140 | int idx = 0; | |
141 | @@ -153,13 +161,6 @@ _dl_close_worker (struct link_map *map, bool force) | |
142 | maps[idx] = l; | |
143 | ++idx; | |
144 | ||
145 | - /* Clear DF_1_NODELETE to force object deletion. We don't need to touch | |
146 | - l_tls_dtor_count because forced object deletion only happens when an | |
147 | - error occurs during object load. Destructor registration for TLS | |
148 | - non-POD objects should not have happened till then for this | |
149 | - object. */ | |
150 | - if (force) | |
151 | - l->l_flags_1 &= ~DF_1_NODELETE; | |
152 | } | |
153 | assert (idx == nloaded); | |
154 | ||
155 | diff --git a/elf/tst-nodelete2.c b/elf/tst-nodelete2.c | |
156 | new file mode 100644 | |
157 | index 0000000..388e8af | |
158 | --- /dev/null | |
159 | +++ b/elf/tst-nodelete2.c | |
160 | @@ -0,0 +1,37 @@ | |
161 | +#include "../dlfcn/dlfcn.h" | |
162 | +#include <stdio.h> | |
163 | +#include <stdlib.h> | |
164 | +#include <gnu/lib-names.h> | |
165 | + | |
166 | +static int | |
167 | +do_test (void) | |
168 | +{ | |
169 | + int result = 0; | |
170 | + | |
171 | + printf ("\nOpening pthread library.\n"); | |
172 | + void *pthread = dlopen (LIBPTHREAD_SO, RTLD_LAZY); | |
173 | + | |
174 | + /* This is a test for correct DF_1_NODELETE clearing when dlopen failure | |
175 | + happens. We should clear DF_1_NODELETE for failed library only, because | |
176 | + doing this for others (e.g. libpthread) might cause them to be unloaded, | |
177 | + that may lead to some global references (e.g. __rtld_lock_unlock) to be | |
178 | + broken. The dlopen should fail because of undefined symbols in shared | |
179 | + library, that cause DF_1_NODELETE to be cleared. For libpthread, this | |
180 | + flag should be set, because if not, SIGSEGV will happen in dlclose. */ | |
181 | + if (dlopen ("tst-nodelete2mod.so", RTLD_NOW) != NULL) | |
182 | + { | |
183 | + printf ("Unique symbols test failed\n"); | |
184 | + result = 1; | |
185 | + } | |
186 | + | |
187 | + if (pthread) | |
188 | + dlclose (pthread); | |
189 | + | |
190 | + if (result == 0) | |
191 | + printf ("SUCCESS\n"); | |
192 | + | |
193 | + return result; | |
194 | +} | |
195 | + | |
196 | +#define TEST_FUNCTION do_test () | |
197 | +#include "../test-skeleton.c" | |
198 | diff --git a/elf/tst-nodelete2mod.c b/elf/tst-nodelete2mod.c | |
199 | new file mode 100644 | |
200 | index 0000000..e88c756 | |
201 | --- /dev/null | |
202 | +++ b/elf/tst-nodelete2mod.c | |
203 | @@ -0,0 +1,7 @@ | |
204 | +/* Undefined symbol. */ | |
205 | +extern int not_exist (void); | |
206 | + | |
207 | +int foo (void) | |
208 | +{ | |
209 | + return not_exist (); | |
210 | +} | |
211 | diff --git a/elf/tst-znodelete-zlib.cc b/elf/tst-znodelete-zlib.cc | |
212 | deleted file mode 100644 | |
213 | index 1e8f368..0000000 | |
214 | --- a/elf/tst-znodelete-zlib.cc | |
215 | +++ /dev/null | |
216 | @@ -1,6 +0,0 @@ | |
217 | -extern int not_exist (void); | |
218 | - | |
219 | -int foo (void) | |
220 | -{ | |
221 | - return not_exist (); | |
222 | -} | |
223 | diff --git a/io/test-lfs.c b/io/test-lfs.c | |
224 | index 539c2a2..b6ebae4 100644 | |
225 | --- a/io/test-lfs.c | |
226 | +++ b/io/test-lfs.c | |
227 | @@ -144,7 +144,7 @@ test_ftello (void) | |
228 | int | |
229 | do_test (int argc, char *argv[]) | |
230 | { | |
231 | - int ret; | |
232 | + int ret, fd2; | |
233 | struct stat64 statbuf; | |
234 | ||
235 | ret = lseek64 (fd, TWO_GB+100, SEEK_SET); | |
236 | @@ -195,6 +195,25 @@ do_test (int argc, char *argv[]) | |
237 | error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.", | |
238 | (long long int) statbuf.st_size, (TWO_GB + 100 + 5)); | |
239 | ||
240 | + fd2 = openat64 (AT_FDCWD, name, O_RDWR); | |
241 | + if (fd2 == -1) | |
242 | + { | |
243 | + if (errno == ENOSYS) | |
244 | + { | |
245 | + /* Silently ignore this test. */ | |
246 | + error (0, 0, "openat64 is not supported"); | |
247 | + } | |
248 | + else | |
249 | + error (EXIT_FAILURE, errno, "openat64 failed to open big file"); | |
250 | + } | |
251 | + else | |
252 | + { | |
253 | + ret = close (fd2); | |
254 | + | |
255 | + if (ret == -1) | |
256 | + error (EXIT_FAILURE, errno, "error closing file"); | |
257 | + } | |
258 | + | |
259 | test_ftello (); | |
260 | ||
261 | return 0; | |
262 | diff --git a/misc/regexp.h b/misc/regexp.h | |
263 | index 3460989..42394f7 100644 | |
264 | --- a/misc/regexp.h | |
265 | +++ b/misc/regexp.h | |
266 | @@ -19,10 +19,11 @@ | |
267 | #ifndef _REGEXP_H | |
268 | #define _REGEXP_H 1 | |
269 | ||
270 | -/* The contents of this header file were standardized in the | |
271 | - Single Unix Specification, Version 2 (1997) but marked as | |
272 | - LEGACY; new applications were already being encouraged to | |
273 | - use <regex.h> instead. POSIX.1-2001 removed this header. | |
274 | +/* The contents of this header file were originally standardized in | |
275 | + the Single Unix Specification, Issue 3 (1992). In Issue 4 (1994) | |
276 | + the header was marked as TO BE WITHDRAWN, and new applications | |
277 | + were encouraged to use <regex.h> instead. It was officially | |
278 | + withdrawn from the standard in Issue 6 (aka POSIX.1-2001). | |
279 | ||
280 | This header is provided only for backward compatibility. | |
281 | It will be removed in the next release of the GNU C Library. | |
282 | diff --git a/sysdeps/hppa/dl-symaddr.c b/sysdeps/hppa/dl-symaddr.c | |
283 | index b707c19..89d8baf 100644 | |
284 | --- a/sysdeps/hppa/dl-symaddr.c | |
285 | +++ b/sysdeps/hppa/dl-symaddr.c | |
286 | @@ -33,3 +33,4 @@ _dl_symbol_address (struct link_map *map, const ElfW(Sym) *ref) | |
287 | else | |
288 | return (void *) value; | |
289 | } | |
290 | +rtld_hidden_def (_dl_symbol_address) | |
291 | diff --git a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h | |
292 | index abde83e..6e73504 100644 | |
293 | --- a/sysdeps/unix/sysv/linux/hppa/bits/atomic.h | |
294 | +++ b/sysdeps/unix/sysv/linux/hppa/bits/atomic.h | |
295 | @@ -56,42 +56,41 @@ typedef uintmax_t uatomic_max_t; | |
296 | #define _LWS "0xb0" | |
297 | #define _LWS_CAS "0" | |
298 | /* Note r31 is the link register. */ | |
299 | -#define _LWS_CLOBBER "r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory" | |
300 | +#define _LWS_CLOBBER "r1", "r23", "r22", "r20", "r31", "memory" | |
301 | /* String constant for -EAGAIN. */ | |
302 | #define _ASM_EAGAIN "-11" | |
303 | /* String constant for -EDEADLOCK. */ | |
304 | #define _ASM_EDEADLOCK "-45" | |
305 | ||
306 | #if __ASSUME_LWS_CAS | |
307 | -/* The only basic operation needed is compare and exchange. */ | |
308 | +/* The only basic operation needed is compare and exchange. The mem | |
309 | + pointer must be word aligned. */ | |
310 | # define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ | |
311 | ({ \ | |
312 | - volatile int lws_errno; \ | |
313 | - __typeof__ (*mem) lws_ret; \ | |
314 | - asm volatile( \ | |
315 | + register long lws_errno asm("r21"); \ | |
316 | + register unsigned long lws_ret asm("r28"); \ | |
317 | + register unsigned long lws_mem asm("r26") = (unsigned long)(mem); \ | |
318 | + register unsigned long lws_old asm("r25") = (unsigned long)(oldval);\ | |
319 | + register unsigned long lws_new asm("r24") = (unsigned long)(newval);\ | |
320 | + __asm__ __volatile__( \ | |
321 | "0: \n\t" \ | |
322 | - "copy %2, %%r26 \n\t" \ | |
323 | - "copy %3, %%r25 \n\t" \ | |
324 | - "copy %4, %%r24 \n\t" \ | |
325 | "ble " _LWS "(%%sr2, %%r0) \n\t" \ | |
326 | "ldi " _LWS_CAS ", %%r20 \n\t" \ | |
327 | - "ldi " _ASM_EAGAIN ", %%r24 \n\t" \ | |
328 | - "cmpb,=,n %%r24, %%r21, 0b \n\t" \ | |
329 | + "ldi " _ASM_EAGAIN ", %%r20 \n\t" \ | |
330 | + "cmpb,=,n %%r20, %%r21, 0b \n\t" \ | |
331 | "nop \n\t" \ | |
332 | - "ldi " _ASM_EDEADLOCK ", %%r25 \n\t" \ | |
333 | - "cmpb,=,n %%r25, %%r21, 0b \n\t" \ | |
334 | + "ldi " _ASM_EDEADLOCK ", %%r20 \n\t" \ | |
335 | + "cmpb,=,n %%r20, %%r21, 0b \n\t" \ | |
336 | "nop \n\t" \ | |
337 | - "stw %%r28, %0 \n\t" \ | |
338 | - "stw %%r21, %1 \n\t" \ | |
339 | - : "=m" (lws_ret), "=m" (lws_errno) \ | |
340 | - : "r" (mem), "r" (oldval), "r" (newval) \ | |
341 | + : "=r" (lws_ret), "=r" (lws_errno) \ | |
342 | + : "r" (lws_mem), "r" (lws_old), "r" (lws_new) \ | |
343 | : _LWS_CLOBBER \ | |
344 | ); \ | |
345 | \ | |
346 | - if(lws_errno == -EFAULT || lws_errno == -ENOSYS) \ | |
347 | + if (lws_errno == -EFAULT || lws_errno == -ENOSYS) \ | |
348 | ABORT_INSTRUCTION; \ | |
349 | \ | |
350 | - lws_ret; \ | |
351 | + (__typeof (oldval)) lws_ret; \ | |
352 | }) | |
353 | ||
354 | # define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \ | |
355 | diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h | |
356 | index 83c0340..9d5c542 100644 | |
357 | --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h | |
358 | +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h | |
359 | @@ -16,8 +16,11 @@ | |
360 | License along with the GNU C Library; if not, see | |
361 | <http://www.gnu.org/licenses/>. */ | |
362 | ||
363 | +#ifndef _LINUX_MICROBLAZE_SYSDEP_H | |
364 | +#define _LINUX_MICROBLAZE_SYSDEP_H 1 | |
365 | + | |
366 | +#include <sysdeps/unix/sysdep.h> | |
367 | #include <sysdeps/microblaze/sysdep.h> | |
368 | -#include <sys/syscall.h> | |
369 | ||
370 | /* Defines RTLD_PRIVATE_ERRNO. */ | |
371 | #include <dl-sysdep.h> | |
372 | @@ -305,3 +308,5 @@ SYSCALL_ERROR_LABEL_DCL: \ | |
373 | # define PTR_DEMANGLE(var) (void) (var) | |
374 | ||
375 | #endif /* not __ASSEMBLER__ */ | |
376 | + | |
377 | +#endif /* _LINUX_MICROBLAZE_SYSDEP_H */ | |
378 | diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c | |
379 | index 6777123..ad8e31d 100644 | |
380 | --- a/sysdeps/unix/sysv/linux/openat.c | |
381 | +++ b/sysdeps/unix/sysv/linux/openat.c | |
382 | @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...) | |
383 | va_end (arg); | |
384 | } | |
385 | ||
386 | + /* We have to add the O_LARGEFILE flag for openat64. */ | |
387 | +#ifdef MORE_OFLAGS | |
388 | + oflag |= MORE_OFLAGS; | |
389 | +#endif | |
390 | + | |
391 | return SYSCALL_CANCEL (openat, fd, file, oflag, mode); | |
392 | } | |
393 | libc_hidden_def (__OPENAT) |