diff options
author | Andreas Schwab <schwab@redhat.com> | 2011-09-08 14:57:45 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@redhat.com> | 2011-09-08 14:57:45 +0200 |
commit | ba7575a59111ec30e572b47b3e25301766cd056f (patch) | |
tree | b57df909d4234b47093a3813c8bd4e498bfd08c7 | |
parent | 6c8f01757b1539e43b30a4bcdb5f22004c4501d1 (diff) | |
parent | 69c1dfc1a7964cc15d429350905aea821803a40c (diff) | |
download | glibc-ba7575a59111ec30e572b47b3e25301766cd056f.tar.gz glibc-ba7575a59111ec30e572b47b3e25301766cd056f.tar.xz glibc-ba7575a59111ec30e572b47b3e25301766cd056f.zip |
Merge remote-tracking branch 'origin/release/2.14/master' into fedora/2.14/master
-rw-r--r-- | ChangeLog | 85 | ||||
-rw-r--r-- | elf/Makefile | 29 | ||||
-rw-r--r-- | elf/dl-deps.c | 13 | ||||
-rw-r--r-- | elf/dl-fini.c | 15 | ||||
-rw-r--r-- | elf/tst-initorder2.c | 20 | ||||
-rw-r--r-- | elf/tst-initorder2.exp | 9 | ||||
-rw-r--r-- | libio/fileops.c | 24 | ||||
-rw-r--r-- | nptl/ChangeLog | 5 | ||||
-rw-r--r-- | stdio-common/Makefile | 2 | ||||
-rw-r--r-- | stdio-common/bug24.c | 26 | ||||
-rw-r--r-- | sysdeps/i386/dl-trampoline.S | 4 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-trampoline.S | 8 | ||||
-rw-r--r-- | sysdeps/x86_64/dl-trampoline.h | 25 |
13 files changed, 201 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog index 752d26fc06..99f1f21c35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,70 @@ +2011-08-29 Jiri Olsa <jolsa@redhat.com> + + * sysdeps/i386/dl-trampoline.S (_dl_runtime_profile): Fix cfi + directive. + +2011-08-24 Andreas Schwab <schwab@redhat.com> + + * elf/Makefile: Add rules to build and run unload8 test. + * elf/unload8.c: New file. + * elf/unload8mod1.c: New file. + * elf/unload8mod1x.c: New file. + * elf/unload8mod2.c: New file. + * elf/unload8mod3.c: New file. + + * elf/dl-close.c (_dl_close_worker): Reset private search list if + it wasn't used. + +2011-08-23 Andreas Schwab <schwab@redhat.com> + + * sysdeps/i386/i686/multiarch/strspn.S (ENTRY): Add missing + backslash. + +2011-08-22 Andreas Schwab <schwab@redhat.com> + + * elf/dl-deps.c (_dl_map_object_deps): Move check for missing + dependencies back to end of function. + +2011-08-16 Andreas Schwab <schwab@redhat.com> + + [BZ #11724] + * elf/dl-deps.c (_dl_map_object_deps): Only assume cycle when + object is seen twice. + * elf/dl-fini.c (_dl_sort_fini): Likewise. + + * elf/Makefile (distribute): Add tst-initorder2.c. + (tests): Add tst-initorder2. + (modules-names): Add tst-initorder2a tst-initorder2b + tst-initorder2c tst-initorder2d. Add rules to build them. + ($(objpfx)tst-initorder2.out): New rule. + * elf/tst-initorder2.c: New file. + * elf/tst-initorder2.exp: New file. + +2011-08-20 Ulrich Drepper <drepper@gmail.com> + + [BZ #13114] + * stdio-common/Makefile (tests): Add bug24. + * stdio-common/bug24.c: New file. + +2011-08-19 Andreas Jaeger <aj@suse.de> + + [BZ #13114] + * libio/fileops.c (_IO_new_file_fopen): Fix handling of + non-existant file when using close-on-exec mode. + +2011-08-20 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Fix CFI for + the very first instruction. + +2011-08-20 Ulrich Drepper <drepper@gmail.com> + + * sysdeps/x86_64/dl-trampoline.h: If MORE_CODE is defined, restore + the CFI state in the end. + * sysdeps/x86_64/dl-trampoline.S: Define MORE_CODE before first + inclusion of dl-trampoline.h. + Based on a patch by Jiri Olsa <jolsa@redhat.com>. + 2011-08-14 Roland McGrath <roland@hack.frob.com> * locale/Makefile (locale-CPPFLAGS): Renamed CPPFLAGS-locale-programs. @@ -2167,9 +2234,6 @@ * nss/nss_files/files-XXX.c (internal_getent): Declare linebuflen as size_t. - * sysdeps/i386/i686/multiarch/strspn.S (ENTRY): Add missing - backslash. - 2010-09-24 Petr Baudis <pasky@suse.cz> * debug/stack_chk_fail_local.c: Add missing licence exception. @@ -2969,21 +3033,6 @@ * sysdeps/mach/hurd/getrlimit.c: Add libc_hidden_def. * resource/getrlimit.c: Likewise. -2010-06-28 Andreas Schwab <schwab@redhat.com> - - * allocatestack.c (setxid_mark_thread): Ensure that the exiting - thread is woken up. - - * elf/Makefile: Add rules to build and run unload8 test. - * elf/unload8.c: New file. - * elf/unload8mod1.c: New file. - * elf/unload8mod1x.c: New file. - * elf/unload8mod2.c: New file. - * elf/unload8mod3.c: New file. - - * elf/dl-close.c (_dl_close_worker): Reset private search list if - it wasn't used. - 2010-06-21 Andreas Schwab <schwab@redhat.com> * sysdeps/i386/i686/Makefile: Don't pass -mtune to assembler. diff --git a/elf/Makefile b/elf/Makefile index d36f191f7f..ef36803e32 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -121,9 +121,10 @@ distribute := rtld-Rules \ ifuncmain7pie.c ifuncmain7static.c \ tst-unique1.c tst-unique1mod1.c tst-unique1mod2.c \ tst-unique2.c tst-unique2mod1.c tst-unique2mod2.c \ - tst-initordera1.c tst-initordera2.c tst-initorderb1.c \ - tst-initorderb2.c tst-initordera3.c tst-initordera4.c \ - tst-initorder.c + tst-initordera1.c tst-initordera2.c tst-initorderb1.c \ + tst-initorderb2.c tst-initordera3.c tst-initordera4.c \ + tst-initorder.c \ + tst-initorder2.c CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables @@ -227,7 +228,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ tst-audit1 tst-audit2 \ tst-stackguard1 tst-addr1 tst-thrlock \ tst-unique1 tst-unique2 tst-unique3 tst-unique4 \ - tst-initorder + tst-initorder tst-initorder2 # reldep9 test-srcs = tst-pathopt selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) @@ -289,7 +290,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ tst-unique4lib \ tst-initordera1 tst-initorderb1 \ tst-initordera2 tst-initorderb2 \ - tst-initordera3 tst-initordera4 + tst-initordera3 tst-initordera4 \ + tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d ifeq (yes,$(have-initfini-array)) modules-names += tst-array2dep tst-array5dep endif @@ -1166,6 +1168,23 @@ $(objpfx)tst-initorder.out: $(objpfx)tst-initorder $< > $@ cmp $@ tst-initorder.exp > /dev/null +$(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2c.so +$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so +$(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so +$(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so +define o-iterator-doit +$(objpfx)tst-initorder2$o.os: tst-initorder2.c; \ +$$(compile-command.c) -DNAME=\"$o\" +endef +object-suffixes-left := a b c d +include $(o-iterator) + +$(objpfx)tst-initorder2.out: $(objpfx)tst-initorder2 + $(elf-objpfx)${rtld-installed-name} \ + --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ + $< > $@ + cmp $@ tst-initorder2.exp > /dev/null + ifeq (yes,$(config-cflags-avx)) AVX-CFLAGS=-mavx ifeq (yes,$(config-cflags-novzeroupper)) diff --git a/elf/dl-deps.c b/elf/dl-deps.c index bbb3d85235..e395fbed1b 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -623,12 +623,12 @@ Filters not supported with LD_TRACE_PRELINKING")); /* We can skip looking for the binary itself which is at the front of the search list. */ i = 1; - bool seen[nlist]; - memset (seen, false, nlist * sizeof (seen[0])); + char seen[nlist]; + memset (seen, 0, nlist * sizeof (seen[0])); while (1) { /* Keep track of which object we looked at this round. */ - seen[i] = true; + seen[i] += seen[i] < 2; struct link_map *thisp = l_initfini[i]; /* Find the last object in the list for which the current one is @@ -649,15 +649,16 @@ Filters not supported with LD_TRACE_PRELINKING")); (k - i) * sizeof (l_initfini[0])); l_initfini[k] = thisp; - if (seen[i + 1]) + if (seen[i + 1] > 1) { ++i; goto next_clear; } + char this_seen = seen[i]; memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); - seen[k] = true; + seen[k] = this_seen; goto next; } @@ -668,7 +669,7 @@ Filters not supported with LD_TRACE_PRELINKING")); if (++i == nlist) break; next_clear: - memset (&seen[i], false, (nlist - i) * sizeof (seen[0])); + memset (&seen[i], 0, (nlist - i) * sizeof (seen[0])); next:; } diff --git a/elf/dl-fini.c b/elf/dl-fini.c index 269bcece4c..22dd76d458 100644 --- a/elf/dl-fini.c +++ b/elf/dl-fini.c @@ -40,12 +40,12 @@ _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps, /* We can skip looking for the binary itself which is at the front of the search list for the main namespace. */ unsigned int i = ns == LM_ID_BASE; - bool seen[nmaps]; - memset (seen, false, nmaps * sizeof (seen[0])); + char seen[nmaps]; + memset (seen, 0, nmaps * sizeof (seen[0])); while (1) { /* Keep track of which object we looked at this round. */ - seen[i] = true; + seen[i] += seen[i] < 2; struct link_map *thisp = maps[i]; /* Do not handle ld.so in secondary namespaces and object which @@ -80,14 +80,15 @@ _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps, used[k] = here_used; } - if (seen[i + 1]) + if (seen[i + 1] > 1) { ++i; goto next_clear; } + char this_seen = seen[i]; memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0])); - seen[k] = true; + seen[k] = this_seen; goto next; } @@ -97,7 +98,7 @@ _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps, unsigned int m = maps[k]->l_reldeps->act; struct link_map **relmaps = &maps[k]->l_reldeps->list[0]; - /* Look through the relocation dependencies of the object. */ + /* Look through the relocation dependencies of the object. */ while (m-- > 0) if (__builtin_expect (relmaps[m] == thisp, 0)) goto move; @@ -110,7 +111,7 @@ _dl_sort_fini (struct link_map *l, struct link_map **maps, size_t nmaps, if (++i == nmaps) break; next_clear: - memset (&seen[i], false, (nmaps - i) * sizeof (seen[0])); + memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0])); next:; } diff --git a/elf/tst-initorder2.c b/elf/tst-initorder2.c new file mode 100644 index 0000000000..050f9568b8 --- /dev/null +++ b/elf/tst-initorder2.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +#ifndef NAME +int +main (void) +{ + puts ("main"); +} +#else +static void __attribute__ ((constructor)) +init (void) +{ + puts ("init: " NAME); +} +static void __attribute__ ((destructor)) +fini (void) +{ + puts ("fini: " NAME); +} +#endif diff --git a/elf/tst-initorder2.exp b/elf/tst-initorder2.exp new file mode 100644 index 0000000000..5169489b85 --- /dev/null +++ b/elf/tst-initorder2.exp @@ -0,0 +1,9 @@ +init: d +init: c +init: b +init: a +main +fini: a +fini: b +fini: c +fini: d diff --git a/libio/fileops.c b/libio/fileops.c index 30de460391..a6f7cbad82 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -345,23 +345,22 @@ _IO_new_file_fopen (fp, filename, mode, is32not64) result = _IO_file_open (fp, filename, omode|oflags, oprot, read_write, is32not64); -#ifndef __ASSUME_O_CLOEXEC - if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0) + if (result != NULL) { - int fd = _IO_fileno (fp); - if (__have_o_cloexec == 0) +#ifndef __ASSUME_O_CLOEXEC + if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0) { - int flags = __fcntl (fd, F_GETFD); - __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1; + int fd = _IO_fileno (fp); + if (__have_o_cloexec == 0) + { + int flags = __fcntl (fd, F_GETFD); + __have_o_cloexec = (flags & FD_CLOEXEC) == 0 ? -1 : 1; + } + if (__have_o_cloexec < 0) + __fcntl (fd, F_SETFD, FD_CLOEXEC); } - if (__have_o_cloexec < 0) - __fcntl (fd, F_SETFD, FD_CLOEXEC); - } #endif -#ifdef _LIBC - if (result != NULL) - { /* Test whether the mode string specifies the conversion. */ cs = strstr (last_recognized + 1, ",ccs="); if (cs != NULL) @@ -432,7 +431,6 @@ _IO_new_file_fopen (fp, filename, mode, is32not64) result->_mode = 1; } } -#endif /* GNU libc */ return result; } diff --git a/nptl/ChangeLog b/nptl/ChangeLog index f110af5667..63f7f90dd9 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2011-08-31 Andreas Schwab <schwab@redhat.com> + + * allocatestack.c (setxid_mark_thread): Ensure that the exiting + thread is woken up. + 2011-08-08 Andreas Schwab <schwab@redhat.com> * sysdeps/unix/sysv/linux/x86_64/cancellation.S: Maintain aligned diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 6c71f1c37f..006f546893 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -60,7 +60,7 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ - scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 + scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 test-srcs = tst-unbputc tst-printf diff --git a/stdio-common/bug24.c b/stdio-common/bug24.c new file mode 100644 index 0000000000..4e6ffcc90b --- /dev/null +++ b/stdio-common/bug24.c @@ -0,0 +1,26 @@ +#include <stdio.h> +#include <errno.h> + +static int +do_test (void) +{ + FILE *fp = fopen ("/foobar_does_no_exit", "re"); + if (fp != NULL) + { + /* A joker created this file. Ignore the test. */ + fclose (fp); + return 0; + } + + if (errno == ENOENT) + { + printf ("no bug\n"); + return 0; + } + + printf ("bug : expected ENOENT, got: %m\n"); + return 1; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/sysdeps/i386/dl-trampoline.S b/sysdeps/i386/dl-trampoline.S index 73b08ba67e..19e313e6ba 100644 --- a/sysdeps/i386/dl-trampoline.S +++ b/sysdeps/i386/dl-trampoline.S @@ -1,5 +1,5 @@ /* PLT trampolines. i386 version. - Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2004, 2005, 2007, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -99,7 +99,7 @@ _dl_runtime_profile: +4 %edx %esp free */ - cfi_adjust_cfa_offset (12) + cfi_adjust_cfa_offset (8) 1: movl %ebx, (%esp) cfi_rel_offset (ebx, 0) movl %edx, %ebx # This is the frame buffer size diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S index 45a2dc20c8..258c60945a 100644 --- a/sysdeps/x86_64/dl-trampoline.S +++ b/sysdeps/x86_64/dl-trampoline.S @@ -27,8 +27,9 @@ .align 16 cfi_startproc _dl_runtime_resolve: + cfi_adjust_cfa_offset(16) # Incorporate PLT subq $56,%rsp - cfi_adjust_cfa_offset(72) # Incorporate PLT + cfi_adjust_cfa_offset(56) movq %rax,(%rsp) # Preserve registers otherwise clobbered. movq %rcx, 8(%rsp) movq %rdx, 16(%rsp) @@ -158,14 +159,15 @@ L(have_avx): 1: js L(no_avx) # define RESTORE_AVX +# define MORE_CODE # include "dl-trampoline.h" .align 16 L(no_avx): # endif -# undef RESTORE_AVX -# include "dl-trampoline.h" +# undef RESTORE_AVX +# include "dl-trampoline.h" cfi_endproc .size _dl_runtime_profile, .-_dl_runtime_profile diff --git a/sysdeps/x86_64/dl-trampoline.h b/sysdeps/x86_64/dl-trampoline.h index 5d49ed4408..1c39579830 100644 --- a/sysdeps/x86_64/dl-trampoline.h +++ b/sysdeps/x86_64/dl-trampoline.h @@ -1,6 +1,6 @@ /* Partial PLT profile trampoline to save and restore x86-64 vector registers. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -195,14 +195,14 @@ _dl_call_pltexit. The La_x86_64_regs is being pointed by rsp now, so we just need to allocate the sizeof(La_x86_64_retval) space on the stack, since the alignment has already been taken care of. */ -# ifdef RESTORE_AVX +#ifdef RESTORE_AVX /* sizeof(La_x86_64_retval). Need extra space for 2 SSE registers to detect if xmm0/xmm1 registers are changed by audit module. */ subq $(LRV_SIZE + XMM_SIZE*2), %rsp -# else +#else subq $LRV_SIZE, %rsp # sizeof(La_x86_64_retval) -# endif +#endif movq %rsp, %rcx # La_x86_64_retval argument to %rcx. /* Fill in the La_x86_64_retval structure. */ @@ -212,7 +212,7 @@ movaps %xmm0, LRV_XMM0_OFFSET(%rcx) movaps %xmm1, LRV_XMM1_OFFSET(%rcx) -# ifdef RESTORE_AVX +#ifdef RESTORE_AVX /* This is to support AVX audit modules. */ vmovdqu %ymm0, LRV_VECTOR0_OFFSET(%rcx) vmovdqu %ymm1, LRV_VECTOR1_OFFSET(%rcx) @@ -221,14 +221,14 @@ by audit module. */ vmovdqa %xmm0, (LRV_SIZE)(%rcx) vmovdqa %xmm1, (LRV_SIZE + XMM_SIZE)(%rcx) -# endif +#endif fstpt LRV_ST0_OFFSET(%rcx) fstpt LRV_ST1_OFFSET(%rcx) movq 24(%rbx), %rdx # La_x86_64_regs argument to %rdx. movq 40(%rbx), %rsi # Copy args pushed by PLT in register. - movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index + movq 32(%rbx), %rdi # %rdi: link_map, %rsi: reloc_index call _dl_call_pltexit /* Restore return registers. */ @@ -238,7 +238,7 @@ movaps LRV_XMM0_OFFSET(%rsp), %xmm0 movaps LRV_XMM1_OFFSET(%rsp), %xmm1 -# ifdef RESTORE_AVX +#ifdef RESTORE_AVX /* Check if xmm0/xmm1 registers are changed by audit module. */ vpcmpeqq (LRV_SIZE)(%rsp), %xmm0, %xmm2 vpmovmskb %xmm2, %esi @@ -253,7 +253,7 @@ vmovdqu LRV_VECTOR1_OFFSET(%rsp), %ymm1 1: -# endif +#endif fldt LRV_ST1_OFFSET(%rsp) fldt LRV_ST0_OFFSET(%rsp) @@ -267,3 +267,10 @@ # (eats the reloc index and link_map) cfi_adjust_cfa_offset(-48) retq + +#ifdef MORE_CODE + cfi_adjust_cfa_offset(48) + cfi_rel_offset(%rbx, 0) + cfi_def_cfa_register(%rbx) +# undef MORE_CODE +#endif |