From 70b4fbad4865f5b92da7f03cad5711508663dfca3f3e976a343c67d2661e3ff8 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Sat, 3 Sep 2011 21:06:08 +0000 Subject: [PATCH 1/7] Updating link to change in openSUSE:Factory/glibc revision 84.0 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=9c033b407855e41c56d0e710171f65ac --- glibc.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glibc.spec b/glibc.spec index dbceb5f..4c6cfe7 100644 --- a/glibc.spec +++ b/glibc.spec @@ -79,7 +79,7 @@ Obsoletes: glibc-32bit %endif AutoReqProv: on Version: 2.14 -Release: 9 +Release: 11 Url: http://www.gnu.org/software/libc/libc.html BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: glibc-%{version}-4eddf93f5cc2.tar.bz2 From 804db197ba87778e1db85b2eafc37538acbc3b0e91dbc2260cc147520628095d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 5 Sep 2011 12:34:49 +0000 Subject: [PATCH 2/7] Accepting request 80935 from home:a_jaeger:branches:openSUSE:Factory - Do not not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. [bnc#681398] - Readd vdso support. - Add patch to relocate objects in dependency order, this fixes the OBS-URL: https://build.opensuse.org/request/show/80935 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=102 --- glibc-2.15-vsyscall.patch | 585 ++++++++++++++++++++++++++++++++++++++ glibc.changes | 15 +- glibc.spec | 6 + x86-cpuid-level2.patch | 27 ++ 4 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 glibc-2.15-vsyscall.patch create mode 100644 x86-cpuid-level2.patch diff --git a/glibc-2.15-vsyscall.patch b/glibc-2.15-vsyscall.patch new file mode 100644 index 0000000..c2e52b2 --- /dev/null +++ b/glibc-2.15-vsyscall.patch @@ -0,0 +1,585 @@ +commit 91b392a4bab0c2dc90e7e3ff914dec20b97adca8 +Author: Ulrich Drepper +Date: Sun Aug 21 13:52:28 2011 -0400 + + Use ifuncs for time and gettimeofday on x86-64 + +2011-08-21 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.S: Removed. + * sysdeps/unix/sysv/linux/x86_64/time.S: Removed. + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: New file. + * sysdeps/unix/sysv/linux/x86_64/time.c: New file. + * sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h: Remove declaration + of __vdso_gettimeofday. + * sysdeps/unix/sysv/linux/x86_64/init-first.c: Remove definition of + __vdso_gettimeofday and __vdso_time. Define __vdso_getcpu with + attribute_hidden. + (_libc_vdso_platform_setup): Remove initialization of + __vdso_gettimeofday and __vdso_time. + +diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h +index d7123c9..f9bf84e 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h ++++ b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h +@@ -1,5 +1,5 @@ + /* Resolve function pointers to VDSO functions. +- Copyright (C) 2005, 2007 Free Software Foundation, Inc. ++ Copyright (C) 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 +@@ -25,9 +25,6 @@ + + #ifdef SHARED + +-extern long int (*__vdso_gettimeofday) (struct timeval *, void *) +- attribute_hidden; +- + extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *); + + #endif +diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S +deleted file mode 100644 +index f618e73..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.S ++++ /dev/null +@@ -1,49 +0,0 @@ +-/* Copyright (C) 2002, 2003, 2007 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 +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#include +-#define _ERRNO_H 1 +-#include +- +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- +- +-ENTRY (__gettimeofday) +- /* Align stack. */ +- sub $0x8, %rsp +- cfi_adjust_cfa_offset(8) +-#ifdef SHARED +- movq __vdso_gettimeofday(%rip), %rax +- PTR_DEMANGLE (%rax) +-#else +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +-#endif +- callq *%rax +- /* Check error return. */ +- cmpl $-4095, %eax +- jae SYSCALL_ERROR_LABEL +- +-L(pseudo_end): +- add $0x8, %rsp +- cfi_adjust_cfa_offset(-8) +- ret +-PSEUDO_END(__gettimeofday) +- +-strong_alias (__gettimeofday, __gettimeofday_internal) +-weak_alias (__gettimeofday, gettimeofday) +diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +new file mode 100644 +index 0000000..1a773d6 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +@@ -0,0 +1,49 @@ ++/* Copyright (C) 2002, 2003, 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 ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++ ++ ++#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul ++ ++ ++#ifdef SHARED ++void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday"); ++ ++void * ++gettimeofday_ifunc (void) ++{ ++ PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); ++ ++ /* If the vDSO is not available we fall back on the old vsyscall. */ ++ return (_dl_vdso_vsym ("gettimeofday", &linux26) ++ ?: (void *) VSYSCALL_ADDR_vgettimeofday); ++} ++__asm (".type __gettimeofday, %gnu_indirect_function"); ++#else ++# include ++ ++int ++__gettimeofday (struct timeval *tv, struct timezone *tz) ++{ ++ return ((int (*) (struct timeval *, struct timezone *)) VSYSCALL_ADDR_vgettimeofday) (tv, tz); ++} ++#endif ++ ++weak_alias (__gettimeofday, gettimeofday) ++strong_alias (__gettimeofday, __gettimeofday_internal) +diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c +index e676f62..25cf08b 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c ++++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c +@@ -20,15 +20,11 @@ + # include + # include + +-long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden; +- + long int (*__vdso_clock_gettime) (clockid_t, struct timespec *) + __attribute__ ((nocommon)); + strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) + +-long int (*__vdso_getcpu) (unsigned *, unsigned *, void *); +- +-long int (*__vdso_time) (time_t *) attribute_hidden; ++long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden; + + + static inline void +@@ -36,15 +32,7 @@ _libc_vdso_platform_setup (void) + { + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); + +- void *p = _dl_vdso_vsym ("gettimeofday", &linux26); +- /* If the vDSO is not available we fall back on the old vsyscall. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul +- if (p == NULL) +- p = (void *) VSYSCALL_ADDR_vgettimeofday; +- PTR_MANGLE (p); +- __vdso_gettimeofday = p; +- +- p = _dl_vdso_vsym ("clock_gettime", &linux26); ++ void *p = _dl_vdso_vsym ("clock_gettime", &linux26); + PTR_MANGLE (p); + __GI___vdso_clock_gettime = p; + +@@ -55,14 +43,6 @@ _libc_vdso_platform_setup (void) + p = (void *) VSYSCALL_ADDR_vgetcpu; + PTR_MANGLE (p); + __vdso_getcpu = p; +- +- p = _dl_vdso_vsym ("time", &linux26); +- /* If the vDSO is not available we fall back on the old vsyscall. */ +-#define VSYSCALL_ADDR_vtime 0xffffffffff600400 +- if (p == NULL) +- p = (void *) VSYSCALL_ADDR_vtime; +- PTR_MANGLE (p); +- __vdso_time = p; + } + + # define VDSO_SETUP _libc_vdso_platform_setup +diff --git a/sysdeps/unix/sysv/linux/x86_64/time.S b/sysdeps/unix/sysv/linux/x86_64/time.S +deleted file mode 100644 +index 66d7498..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/time.S ++++ /dev/null +@@ -1,47 +0,0 @@ +-/* Copyright (C) 2001,02, 2003, 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 +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2.1 of the License, or (at your option) any later version. +- +- The GNU C Library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with the GNU C Library; if not, write to the Free +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +- 02111-1307 USA. */ +- +-#include +-#define _ERRNO_H 1 +-#include +- +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vtime 0xffffffffff600400 +- +- +-/* Return the current time as a `time_t' and also put it in *T if T is +- not NULL. Time is represented as seconds from Jan 1 00:00:00 1970. */ +- +-ENTRY (time) +- /* Align stack. */ +- sub $0x8, %rsp +- cfi_adjust_cfa_offset(8) +- +-#ifdef SHARED +- movq __vdso_time(%rip), %rax +- PTR_DEMANGLE (%rax) +-#else +- movq $VSYSCALL_ADDR_vtime, %rax +-#endif +- callq *%rax +- +- add $0x8, %rsp +- cfi_adjust_cfa_offset(-8) +- ret +-PSEUDO_END_NOERRNO(time) +-libc_hidden_def (time) +diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c +new file mode 100644 +index 0000000..698d561 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/x86_64/time.c +@@ -0,0 +1,47 @@ ++/* Copyright (C) 2001,02, 2003, 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 ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++ ++ ++#define VSYSCALL_ADDR_vtime 0xffffffffff600400 ++ ++ ++#ifdef SHARED ++void *time_ifunc (void) __asm__ ("time"); ++ ++void * ++time_ifunc (void) ++{ ++ PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); ++ ++ /* If the vDSO is not available we fall back on the old vsyscall. */ ++ return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime; ++} ++__asm (".type time, %gnu_indirect_function"); ++#else ++# include ++ ++time_t ++time (time_t *t) ++{ ++ return ((time_t (*) (time_t *)) VSYSCALL_ADDR_vtime) (t); ++} ++#endif ++ ++strong_alias (time, __GI_time) + +commit 2bc174332ba6ddbd1b855dced33889bef56e8ba3 +Author: Andreas Schwab +Date: Tue Aug 30 15:37:54 2011 +0200 + + Relocate objects in dependency order + +2011-08-30 Andreas Schwab + + * elf/rtld.c (dl_main): Relocate objects in dependency order. + +diff --git a/elf/rtld.c b/elf/rtld.c +index 87bb5f0..4f6bbfd 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -2255,13 +2255,12 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + /* If we are profiling we also must do lazy reloaction. */ + GLRO(dl_lazy) |= consider_profiling; + +- struct link_map *l = main_map; +- while (l->l_next) +- l = l->l_next; +- + HP_TIMING_NOW (start); +- do ++ unsigned i = main_map->l_searchlist.r_nlist; ++ while (i-- > 0) + { ++ struct link_map *l = main_map->l_initfini[i]; ++ + /* While we are at it, help the memory handling a bit. We have to + mark some data structures as allocated with the fake malloc() + implementation in ld.so. */ +@@ -2280,10 +2279,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", + /* Add object to slot information data if necessasy. */ + if (l->l_tls_blocksize != 0 && tls_init_tp_called) + _dl_add_to_slotinfo (l); +- +- l = l->l_prev; + } +- while (l); + HP_TIMING_NOW (stop); + + HP_TIMING_DIFF (relocate_time, start, stop); + +commit e888bcbe4fb8ad538ec640bfb18b687d51e001e7 +Author: Andreas Schwab +Date: Mon Aug 22 16:08:16 2011 -0400 + + Correct cycle detection during dependency sorting + +2011-08-16 Andreas Schwab + + [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-21 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.S: Removed. +diff --git a/elf/Makefile b/elf/Makefile +index 709b61d..aeb6393 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -120,9 +120,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) +@@ -288,7 +289,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 +@@ -1157,6 +1159,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 0b03b90..cc0023d 100644 +--- a/elf/dl-deps.c ++++ b/elf/dl-deps.c +@@ -626,12 +626,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 +@@ -652,15 +652,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; + } +@@ -671,7 +672,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 0a138e9..bafc83a 100644 +--- a/elf/dl-fini.c ++++ b/elf/dl-fini.c +@@ -39,12 +39,12 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) + /* 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 +@@ -79,14 +79,15 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) + 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; + } +@@ -96,7 +97,7 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) + 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; +@@ -109,7 +110,7 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) + 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 0000000..050f956 +--- /dev/null ++++ b/elf/tst-initorder2.c +@@ -0,0 +1,20 @@ ++#include ++ ++#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 0000000..5169489 +--- /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/glibc.changes b/glibc.changes index af435c5..48ccd27 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,7 +1,20 @@ +------------------------------------------------------------------- +Mon Sep 5 10:06:23 UTC 2011 - aj@suse.de + +- Do not not trigger an abort when an i586 Intel CPU is running the + i686 library, as valgrind does. [bnc#681398] + +------------------------------------------------------------------- +Mon Sep 5 08:26:24 UTC 2011 - aj@suse.de + +- Readd vdso support. +- Add patch to relocate objects in dependency order, this fixes the + vdso support. + ------------------------------------------------------------------- Sat Sep 3 19:39:03 UTC 2011 - aj@suse.de -- Revert last change, it caused some breakage. +- Revert last change, it caused some breakage. [bnc#715854] ------------------------------------------------------------------- Thu Sep 1 20:49:16 UTC 2011 - aj@suse.de diff --git a/glibc.spec b/glibc.spec index 4c6cfe7..8f991f8 100644 --- a/glibc.spec +++ b/glibc.spec @@ -200,6 +200,10 @@ Patch67: glibc-revert-fseek-on-fclose.diff Patch68: glibc-fix-lookup-crash.patch # PATCH-FIX-UPSTREAM Fix fopen("non-existing-file", "re") errno bnc#713146 aj@suse.de Patch69: fopen-close-exec.patch +# PATCH-FIX-UPSTREAM Add vdso support to support Linux 3.1, fix order of relocations aj@suse.de +Patch70: glibc-2.15-vsyscall.patch +# PATCH-FIX-OPENSUSE Do not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. bnc#681398 aj@suse.de +Patch71: x86-cpuid-level2.patch # PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de Patch80: crypt_blowfish-1.2-sha.diff # PATCH-FEATURE-OPENSUSE -- use separate symbol version for Owl extensions - lnussel@suse.de @@ -435,6 +439,8 @@ rm nscd/s-stamp %patch67 -p1 %patch68 -p1 %patch69 -p1 +%patch70 -p1 +%patch71 -p1 # # Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! diff --git a/x86-cpuid-level2.patch b/x86-cpuid-level2.patch new file mode 100644 index 0000000..a6d9c10 --- /dev/null +++ b/x86-cpuid-level2.patch @@ -0,0 +1,27 @@ +openSUSE bug report: +https://bugzilla.novell.com/show_bug.cgi?id=681398 + +Patch from Debian, see +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=584748 + +--- + sysdeps/x86_64/cacheinfo.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/sysdeps/x86_64/cacheinfo.c ++++ b/sysdeps/x86_64/cacheinfo.c +@@ -254,7 +254,13 @@ + static long int __attribute__ ((noinline)) + handle_intel (int name, unsigned int maxidx) + { +- assert (maxidx >= 2); ++ if (maxidx <= 2) ++ { ++ /* This should never happen as all Intel i686 CPU support a CPUID ++ level of 2 minimum. However valgrind sometimes load the i686 ++ library with a P55C CPUID. Return 0 in that case. */ ++ return 0; ++ } + + /* OK, we can use the CPUID instruction to get all info about the + caches. */ From 0c4a2d62403788e5345911e8592f0ed099595b68feae490f8d7e032c566ce60d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 6 Sep 2011 09:34:37 +0000 Subject: [PATCH 3/7] Accepting request 81073 from home:a_jaeger:branches:openSUSE:Factory Prefer real syscalls instead of vsyscalls on x86-64 outside libc.so. OBS-URL: https://build.opensuse.org/request/show/81073 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=103 --- glibc-2.15-vsyscall.patch | 125 ++++++++++++++++++++++++++++++++++++++ glibc.changes | 6 ++ 2 files changed, 131 insertions(+) diff --git a/glibc-2.15-vsyscall.patch b/glibc-2.15-vsyscall.patch index c2e52b2..0dd08a8 100644 --- a/glibc-2.15-vsyscall.patch +++ b/glibc-2.15-vsyscall.patch @@ -583,3 +583,128 @@ index 0000000..5169489 +fini: b +fini: c +fini: d + +commit ef60624956e93df1da329a48570776ed963b1916 +Author: Ulrich Drepper +Date: Tue Sep 6 00:12:18 2011 -0400 + + Prefer real syscalls instead of vsyscalls on x86-64 outside libc.so + +2011-09-06 Ulrich Drepper + + * sysdeps/unix/sysv/linux/kernel-features.h: Add entry for getcpu + syscall on x86-64. + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c [!SHARED]: Use real + syscall. + * sysdeps/unix/sysv/linux/x86_64/time.c: Likewise. + * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S [!SHARED]: Use real + syscall if possible. + + +diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h +index d91f581..58f833e 100644 +--- a/sysdeps/unix/sysv/linux/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/kernel-features.h +@@ -546,3 +546,8 @@ + #if __LINUX_KERNEL_VERSION >= 0x020627 + # define __ASSUME_SENDMMSG 1 + #endif ++ ++/* getcpu is a syscall for x86-64 since 3.1. */ ++#if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100 ++# define __ASSUME_GETCPU_SYSCALL 1 ++#endif +diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +index 1a773d6..56171bc 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c ++++ b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +@@ -37,11 +37,12 @@ gettimeofday_ifunc (void) + __asm (".type __gettimeofday, %gnu_indirect_function"); + #else + # include ++# include + + int + __gettimeofday (struct timeval *tv, struct timezone *tz) + { +- return ((int (*) (struct timeval *, struct timezone *)) VSYSCALL_ADDR_vgettimeofday) (tv, tz); ++ return INLINE_SYSCALL (gettimeofday, 2, tv, tz); + } + #endif + +diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S +index 8ec7d3f..246c955 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S ++++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S +@@ -20,6 +20,7 @@ + #include + #define _ERRNO_H 1 + #include ++#include + + /* For the calculation see asm/vsyscall.h. */ + #define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800 +@@ -38,10 +39,26 @@ ENTRY (sched_getcpu) + #ifdef SHARED + movq __vdso_getcpu(%rip), %rax + PTR_DEMANGLE (%rax) ++ callq *%rax + #else ++# ifdef __NR_getcpu ++ movl $__NR_getcpu, %eax ++ syscall ++# ifndef __ASSUME_GETCPU_SYSCALL ++ cmpq $-ENOSYS, %rax ++ jne 1f ++# endif ++# endif ++# ifndef __ASSUME_GETCPU_SYSCALL + movq $VSYSCALL_ADDR_vgetcpu, %rax +-#endif + callq *%rax ++1: ++# else ++# ifndef __NR_getcpu ++# error "cannot happen" ++# endif ++# endif ++#endif + + cmpq $-4095, %rax + jae SYSCALL_ERROR_LABEL +diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c +index 698d561..c1c1a75 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/time.c ++++ b/sysdeps/unix/sysv/linux/x86_64/time.c +@@ -36,11 +36,13 @@ time_ifunc (void) + __asm (".type time, %gnu_indirect_function"); + #else + # include ++# include + + time_t + time (time_t *t) + { +- return ((time_t (*) (time_t *)) VSYSCALL_ADDR_vtime) (t); ++ INTERNAL_SYSCALL_DECL (err); ++ return INTERNAL_SYSCALL (time, err, 1, t); + } + #endif + +2011-09-06 Andreas Jaeger + + * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: Include + to fix build. + +Index: glibc-2.14/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +=================================================================== +--- glibc-2.14.orig/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c ++++ glibc-2.14/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c +@@ -36,6 +36,7 @@ gettimeofday_ifunc (void) + } + __asm (".type __gettimeofday, %gnu_indirect_function"); + #else ++# include + # include + # include + diff --git a/glibc.changes b/glibc.changes index 48ccd27..df974ac 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Sep 6 09:53:24 CEST 2011 - aj@suse.de + +- Prefer real syscalls instead of vsyscalls on x86-64 outside + libc.so + ------------------------------------------------------------------- Mon Sep 5 10:06:23 UTC 2011 - aj@suse.de From 5b71ae72e08793bdedcc8c7c181359b7635e86ac66762ac65bccc8c8820b1d0f Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 7 Sep 2011 12:26:28 +0000 Subject: [PATCH 4/7] Accepting request 81298 from home:a_jaeger:branches:openSUSE:Factory Avoid usage of vsyscalls inside glibc. OBS-URL: https://build.opensuse.org/request/show/81298 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=104 --- glibc-2.15-avoid-vsyscall.patch | 569 ++++++++++++++++++++++++++++++++ glibc.changes | 5 + glibc.spec | 3 + 3 files changed, 577 insertions(+) create mode 100644 glibc-2.15-avoid-vsyscall.patch diff --git a/glibc-2.15-avoid-vsyscall.patch b/glibc-2.15-avoid-vsyscall.patch new file mode 100644 index 0000000..5fb7382 --- /dev/null +++ b/glibc-2.15-avoid-vsyscall.patch @@ -0,0 +1,569 @@ +commit d53a73acdbf6ac6eb99cd06f5dd695da58d9e8f5 +Author: Ulrich Drepper +Date: Tue Sep 6 20:22:37 2011 -0400 + + Avoid gettimeofday vsyscall + +2011-09-06 Ulrich Drepper + + * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Don't use + gettimeofday vsyscall, just use time. + +diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c +index b9bae3d..7feb7a1 100644 +--- a/sysdeps/unix/sysv/linux/getsysstats.c ++++ b/sysdeps/unix/sysv/linux/getsysstats.c +@@ -37,15 +37,6 @@ + #include + #include + +-#ifndef HAVE_CLOCK_GETTIME_VSYSCALL +-# undef INTERNAL_VSYSCALL +-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL +-# undef INLINE_VSYSCALL +-# define INLINE_VSYSCALL INLINE_SYSCALL +-#else +-# include +-#endif +- + + /* How we can determine the number of available processors depends on + the configuration. There is currently (as of version 2.0.21) no +@@ -141,17 +132,10 @@ __get_nprocs () + static int cached_result; + static time_t timestamp; + +-#ifdef __ASSUME_POSIX_TIMERS +- struct timespec ts; +- INTERNAL_SYSCALL_DECL (err); +- INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts); +-#else +- struct timeval ts; +- __gettimeofday (&ts, NULL); +-#endif ++ time_t now = time (NULL); + time_t prev = timestamp; + atomic_read_barrier (); +- if (ts.tv_sec == prev) ++ if (now == prev) + return cached_result; + + /* XXX Here will come a test for the new system call. */ +@@ -243,7 +227,7 @@ __get_nprocs () + out: + cached_result = result; + atomic_write_barrier (); +- timestamp = ts.tv_sec; ++ timestamp = now; + + return result; + } + +commit a77d3c17dc6517636c1cf6ab9c6bb8c257772354 +Author: Ulrich Drepper +Date: Tue Sep 6 21:34:11 2011 -0400 + + Don't unconditionally use clock_gettime vsyscall on x86-64 + +2011-09-06 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/clock_gettime.c: New file. + * sysdeps/unix/sysv/linux/clock_gettime.c (SYSCALL_GETTIME): Allow + already be defined. Change to take two parameters and don't assign + result to variable. Adjust all users. + Define INTERNAL_GETTIME if not already defined. + Use INTERNAL_GETTIME instead of INTERNAL_VSYSCALL got clock_gettime + call. + * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Don't define + HAVE_CLOCK_GETTIME_VSYSCALL. + * sysdeps/unix/clock_gettime.c: Adjust use of SYSDEP_GETTIME_CPU. + + +diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c +index fbaaf30..d467f2b 100644 +--- a/sysdeps/unix/clock_gettime.c ++++ b/sysdeps/unix/clock_gettime.c +@@ -1,5 +1,5 @@ + /* clock_gettime -- Get the current time from a POSIX clockid_t. Unix version. +- Copyright (C) 1999-2004, 2005, 2007 Free Software Foundation, Inc. ++ Copyright (C) 1999-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 +@@ -113,7 +113,7 @@ clock_gettime (clockid_t clock_id, struct timespec *tp) + + default: + #ifdef SYSDEP_GETTIME_CPU +- SYSDEP_GETTIME_CPU; ++ retval = SYSDEP_GETTIME_CPU (clock_id, tp); + #endif + #if HP_TIMING_AVAIL + if ((clock_id & ((1 << CLOCK_IDFIELD_SIZE) - 1)) +diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c +index dd3755c..0ae45de 100644 +--- a/sysdeps/unix/sysv/linux/clock_gettime.c ++++ b/sysdeps/unix/sysv/linux/clock_gettime.c +@@ -1,5 +1,5 @@ + /* clock_gettime -- Get current time from a POSIX clockid_t. Linux version. +- Copyright (C) 2003,2004,2005,2006,2007,2010 Free Software Foundation, Inc. ++ Copyright (C) 2003,2004,2005,2006,2007,2010,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 +@@ -32,9 +32,14 @@ + # include + #endif + +-#define SYSCALL_GETTIME \ +- retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \ +- break ++#ifndef SYSCALL_GETTIME ++# define SYSCALL_GETTIME(id, tp) \ ++ INLINE_VSYSCALL (clock_gettime, 2, id, tp) ++#endif ++#ifndef INTERNAL_GETTIME ++# define INTERNAL_GETTIME(id, tp) \ ++ INTERNAL_VSYSCALL (clock_gettime, err, 2, id, tp) ++#endif + + #ifdef __ASSUME_POSIX_TIMERS + +@@ -44,7 +49,8 @@ + SYSDEP_GETTIME_CPUTIME \ + case CLOCK_REALTIME: \ + case CLOCK_MONOTONIC: \ +- SYSCALL_GETTIME ++ retval = SYSCALL_GETTIME (clock_id, tp); \ ++ break + + # define __libc_missing_posix_timers 0 + #elif defined __NR_clock_gettime +@@ -59,7 +65,7 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp) + if (!__libc_missing_posix_timers) + { + INTERNAL_SYSCALL_DECL (err); +- int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp); ++ int r = INTERNAL_GETTIME (clock_id, tp); + if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + return 0; + +@@ -89,7 +95,7 @@ maybe_syscall_gettime (clockid_t clock_id, struct timespec *tp) + /* Fallback code. */ \ + if (retval == EINVAL && clock_id == CLOCK_REALTIME) \ + retval = realtime_gettime (tp); \ +- else \ ++ else \ + { \ + __set_errno (retval); \ + retval = -1; \ +@@ -119,7 +125,7 @@ maybe_syscall_gettime_cpu (clockid_t clock_id, struct timespec *tp) + if (!__libc_missing_posix_cpu_timers) + { + INTERNAL_SYSCALL_DECL (err); +- int r = INTERNAL_VSYSCALL (clock_gettime, err, 2, clock_id, tp); ++ int r = INTERNAL_GETTIME (clock_id, tp); + if (!INTERNAL_SYSCALL_ERROR_P (r, err)) + return 0; + +diff --git a/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c +new file mode 100644 +index 0000000..9d6cd23 +--- /dev/null ++++ b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c +@@ -0,0 +1,10 @@ ++#include "bits/libc-vdso.h" ++ ++#ifdef SHARED ++# define SYSCALL_GETTIME(id, tp) \ ++ (*__vdso_clock_gettime) (id, tp) ++# define INTERNAL_GETTIME(id, tp) \ ++ (*__vdso_clock_gettime) (id, tp) ++#endif ++ ++#include "../clock_gettime.c" +diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h +index 2b9ea85..a9821dc 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h ++++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001-2005, 2007 Free Software Foundation, Inc. ++/* Copyright (C) 2001-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 +@@ -279,8 +279,8 @@ + if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + { \ + iserr: \ +- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ +- sc_ret = -1L; \ ++ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ ++ sc_ret = -1L; \ + } \ + out: \ + sc_ret; \ +@@ -304,9 +304,6 @@ + v_ret; \ + }) + +-/* List of system calls which are supported as vsyscalls. */ +-# define HAVE_CLOCK_GETTIME_VSYSCALL 1 +- + # else + # define INLINE_VSYSCALL(name, nr, args...) \ + INLINE_SYSCALL (name, nr, ##args) + +commit a0e1f41bd487d2202b6c1e0802c0e6c91630fbea +Author: Ulrich Drepper +Date: Tue Sep 6 23:17:53 2011 -0400 + + Don't call gettimeofday vsyscall in x86-64 sem_timedwait + +2011-09-06 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S (sem_timedwait): Don't + use gettimeofday vsyscall, just call gettimeofday. + +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +index ca49cb8..2926b36 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sem_timedwait.S +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002,2003,2005,2007,2009,2010 Free Software Foundation, Inc. ++/* Copyright (C) 2002,2003,2005,2007,2009,2010,2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + +@@ -24,10 +24,6 @@ + #include + #include + +- +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- + .text + + .globl sem_timedwait +@@ -212,9 +208,10 @@ sem_timedwait: + addq $1, NWAITERS(%r12) + + 7: xorl %esi, %esi +- movq %rsp, %rdi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ movq %rsp,%rdi ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax + +commit fc8bffcccf5821bca179486abef83a7f82526715 +Author: Ulrich Drepper +Date: Tue Sep 6 23:50:04 2011 -0400 + + Fix handling of __vdso_clock_gettime + +2011-09-06 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/clock_gettime.c (INTERNAL_GETTIME): + Forgot to demangle the pointer. + +diff --git a/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c +index 9d6cd23..7802701 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c ++++ b/sysdeps/unix/sysv/linux/x86_64/clock_gettime.c +@@ -2,9 +2,13 @@ + + #ifdef SHARED + # define SYSCALL_GETTIME(id, tp) \ +- (*__vdso_clock_gettime) (id, tp) ++ ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \ ++ PTR_DEMANGLE (f); \ ++ f (id, tp); }) + # define INTERNAL_GETTIME(id, tp) \ +- (*__vdso_clock_gettime) (id, tp) ++ ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \ ++ PTR_DEMANGLE (f); \ ++ f (id, tp); }) + #endif + + #include "../clock_gettime.c" + +commit 9e5c9dcd57e80cd56c47fd2bf11de8d167176a0e +Author: Ulrich Drepper +Date: Wed Sep 7 00:14:06 2011 -0400 + + Remove gettimeofday vsyscall use from x86-86 libpthread + + * sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S: + Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S: + Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise. + Simplify __vdso_clock_gettime use. + +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +index 3195db2..018da0c 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002-2006, 2007, 2009, 2010 Free Software Foundation, Inc. ++/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + +@@ -68,10 +68,6 @@ + #endif + + +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- +- + .globl __lll_lock_wait_private + .type __lll_lock_wait_private,@function + .hidden __lll_lock_wait_private +@@ -250,10 +246,9 @@ __lll_timedlock_wait: + /* Get current time. */ + movq %rsp, %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- /* This is a regular function call, all caller-save registers +- might be clobbered. */ +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax +@@ -402,8 +397,9 @@ __lll_timedwait_tid: + /* Get current time. */ + 2: movq %rsp, %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +index 5218a4f..b7b8b34 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002=2007, 2009, 2010 Free Software Foundation, Inc. ++/* Copyright (C) 2002, 2011=2007, 2009, 2010 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + +@@ -50,9 +50,6 @@ + orl $FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME, reg + #endif + +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- + + .globl __lll_robust_lock_wait + .type __lll_robust_lock_wait,@function +@@ -219,10 +216,9 @@ __lll_robust_timedlock_wait: + /* Get current time. */ + movq %rsp, %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- /* This is a regular function call, all caller-save registers +- might be clobbered. */ +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +index 48ea8b9..d11b297 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +@@ -26,9 +26,6 @@ + + #include + +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- + + .text + +@@ -453,13 +450,11 @@ __pthread_cond_timedwait: + movq __vdso_clock_gettime@GOTPCREL(%rip), %rax + movq (%rax), %rax + PTR_DEMANGLE (%rax) +- jz 26f + call *%rax +- jmp 27f +-# endif +-26: movl $__NR_clock_gettime, %eax ++# else ++ movl $__NR_clock_gettime, %eax + syscall +-27: ++# endif + # ifndef __ASSUME_POSIX_TIMERS + cmpq $-ENOSYS, %rax + je 19f +@@ -473,8 +468,9 @@ __pthread_cond_timedwait: + # else + leaq 24(%rsp), %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 40(%rsp), %rax +@@ -611,8 +607,9 @@ __pthread_cond_timedwait: + /* clock_gettime not available. */ + 19: leaq 32(%rsp), %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 40(%rsp), %rax +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S +index f5d055c..0e6a6ee 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002-2005, 2007, 2009, 2010 Free Software Foundation, Inc. ++/* Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + +@@ -23,10 +23,6 @@ + #include + #include + +- +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- + .text + + .globl pthread_rwlock_timedrdlock +@@ -123,8 +119,9 @@ pthread_rwlock_timedrdlock: + /* Get current time. */ + movq %rsp, %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax +diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +index 6ed8b49..16bf920 100644 +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S +@@ -1,4 +1,5 @@ +-/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. ++/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2010, 2011 ++ Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2002. + +@@ -23,10 +24,6 @@ + #include + #include + +- +-/* For the calculation see asm/vsyscall.h. */ +-#define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000 +- + .text + + .globl pthread_rwlock_timedwrlock +@@ -120,8 +117,9 @@ pthread_rwlock_timedwrlock: + /* Get current time. */ + movq %rsp, %rdi + xorl %esi, %esi +- movq $VSYSCALL_ADDR_vgettimeofday, %rax +- callq *%rax ++ /* This call works because we directly jump to a system call entry ++ which preserves all the registers. */ ++ call JUMPTARGET(__gettimeofday) + + /* Compute relative timeout. */ + movq 8(%rsp), %rax +commit e38ba7ab6a56d53bde4fcff250f6928fb473bc3c +Author: Ulrich Drepper +Date: Wed Sep 7 00:07:08 2011 -0400 + + Make sure __vdso_clock_gettime always contains a valid pointer + +2011-09-07 Ulrich Drepper + + * sysdeps/unix/sysv/linux/x86_64/init-first.c + (_libc_vdso_platform_setup): If vDSO is not present store pointer to + syscall wrapper around clock_gettime in __vdso_clock_gettime. + * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Add entry for + clock_gettime. + +diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c +index 25cf08b..cb39aca 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c ++++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c +@@ -17,6 +17,8 @@ + 02111-1307 USA. */ + + #ifdef SHARED ++# include ++# include + # include + # include + +@@ -27,12 +29,17 @@ strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden) + long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden; + + ++extern long int __syscall_clock_gettime (clockid_t, struct timespec *); ++ ++ + static inline void + _libc_vdso_platform_setup (void) + { + PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); + + void *p = _dl_vdso_vsym ("clock_gettime", &linux26); ++ if (p == NULL) ++ p = __syscall_clock_gettime; + PTR_MANGLE (p); + __GI___vdso_clock_gettime = p; + +diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list +index 3e231a0..ccddb84 100644 +--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list ++++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list +@@ -14,6 +14,7 @@ semop - semop i:ipi __semop semop + semtimedop - semtimedop i:ipip semtimedop + semget - semget i:iii __semget semget + semctl - semctl i:iiii __semctl semctl ++syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime + + + # proper socket implementations: diff --git a/glibc.changes b/glibc.changes index df974ac..1b68c9c 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Sep 7 07:17:16 UTC 2011 - aj@suse.de + +- Avoid usage of vsyscalls inside glibc. + ------------------------------------------------------------------- Tue Sep 6 09:53:24 CEST 2011 - aj@suse.de diff --git a/glibc.spec b/glibc.spec index 8f991f8..73dd7ae 100644 --- a/glibc.spec +++ b/glibc.spec @@ -204,6 +204,8 @@ Patch69: fopen-close-exec.patch Patch70: glibc-2.15-vsyscall.patch # PATCH-FIX-OPENSUSE Do not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. bnc#681398 aj@suse.de Patch71: x86-cpuid-level2.patch +# PATCH-FIX-UPSTREAM Avoid use of vsyscall aj@suse.de +Patch72: glibc-2.15-avoid-vsyscall.patch # PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de Patch80: crypt_blowfish-1.2-sha.diff # PATCH-FEATURE-OPENSUSE -- use separate symbol version for Owl extensions - lnussel@suse.de @@ -441,6 +443,7 @@ rm nscd/s-stamp %patch69 -p1 %patch70 -p1 %patch71 -p1 +%patch72 -p1 # # Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! From 89c17cfdd5a122ac8f8b2d22e67c85695bedeea3f7cf077fb6c650729ab3f0a5 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 19 Sep 2011 08:08:15 +0000 Subject: [PATCH 5/7] Accepting request 82412 from home:michal-m:branches:Base:System - Fix assertion error in res_query.c, triggered by Firefox (bso#13013). OBS-URL: https://build.opensuse.org/request/show/82412 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=105 --- glibc-resolv-assert.diff | 59 ++++++++++++++++++++++++++++++++++++++++ glibc.changes | 6 ++++ glibc.spec | 4 ++- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 glibc-resolv-assert.diff diff --git a/glibc-resolv-assert.diff b/glibc-resolv-assert.diff new file mode 100644 index 0000000..fcb478e --- /dev/null +++ b/glibc-resolv-assert.diff @@ -0,0 +1,59 @@ +2011-07-21 Aurelien Jarno + + * resolv/res_query.c(__libc_res_nquery): Assign hp and hp2 + depending n and resplen2 to catch cases where answer + equals answerp2. + +diff --git a/resolv/res_query.c b/resolv/res_query.c +index 2f7cfaa..405fa68 100644 +--- a/resolv/res_query.c ++++ b/resolv/res_query.c +@@ -122,6 +122,7 @@ __libc_res_nquery(res_state statp, + int *resplen2) + { + HEADER *hp = (HEADER *) answer; ++ HEADER *hp2; + int n, use_malloc = 0; + u_int oflags = statp->_flags; + +@@ -239,26 +240,25 @@ __libc_res_nquery(res_state statp, + /* __libc_res_nsend might have reallocated the buffer. */ + hp = (HEADER *) *answerp; + +- /* We simplify the following tests by assigning HP to HP2. It +- is easy to verify that this is the same as ignoring all +- tests of HP2. */ +- HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp; +- +- if (n < (int) sizeof (HEADER) && answerp2 != NULL +- && *resplen2 > (int) sizeof (HEADER)) ++ /* We simplify the following tests by assigning HP to HP2 or ++ vice versa. It is easy to verify that this is the same as ++ ignoring all tests of HP or HP2. */ ++ if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER)) + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp = hp2; ++ hp2 = hp; + } +- else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER) +- && n > (int) sizeof (HEADER)) ++ else + { +- /* Special case of partial answer. */ +- assert (hp != hp2); +- hp2 = hp; ++ hp2 = (HEADER *) *answerp2; ++ if (n < (int) sizeof (HEADER)) ++ { ++ hp = hp2; ++ } + } + ++ /* Make sure both hp and hp2 are defined */ ++ assert((hp != NULL) && (hp2 != NULL)); ++ + if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0) + && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) { + #ifdef DEBUG diff --git a/glibc.changes b/glibc.changes index 1b68c9c..a8a66ed 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 16 11:20:29 UTC 2011 - mmarek@suse.cz + +- Fix assertion error in res_query.c, triggered by Firefox + (bso#13013). + ------------------------------------------------------------------- Wed Sep 7 07:17:16 UTC 2011 - aj@suse.de diff --git a/glibc.spec b/glibc.spec index 73dd7ae..17cb7bd 100644 --- a/glibc.spec +++ b/glibc.spec @@ -206,6 +206,8 @@ Patch70: glibc-2.15-vsyscall.patch Patch71: x86-cpuid-level2.patch # PATCH-FIX-UPSTREAM Avoid use of vsyscall aj@suse.de Patch72: glibc-2.15-avoid-vsyscall.patch +# PATCH-FIX-UPSTREAM Fix assertion error in res_query.c (bso#13013) +Patch73: glibc-resolv-assert.diff # PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de Patch80: crypt_blowfish-1.2-sha.diff # PATCH-FEATURE-OPENSUSE -- use separate symbol version for Owl extensions - lnussel@suse.de @@ -323,7 +325,6 @@ library. %package devel-static - Summary: C library static libraries for -static linking Group: Development/Libraries/C and C++ Requires: %{name}-devel = %{version} @@ -444,6 +445,7 @@ rm nscd/s-stamp %patch70 -p1 %patch71 -p1 %patch72 -p1 +%patch73 -p1 # # Inconsistency detected by ld.so: dl-close.c: 719: _dl_close: Assertion `map->l_init_called' failed! From b95761bac7952c75c47dc42ac514059bdbe580a39081f86d15bd0d0dc32bfcd0 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 19 Sep 2011 09:16:07 +0000 Subject: [PATCH 6/7] Accepting request 83462 from home:a_jaeger:branches:openSUSE:Factory incorporate some fixes. OBS-URL: https://build.opensuse.org/request/show/83462 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=106 --- fopen-close-exec.patch | 14 -- glibc-2.14-4eddf93f5cc2.tar.bz2 | 3 - glibc-2.14-69c1dfc1a796.tar.bz2 | 3 + glibc-2.15-vsyscall.patch | 231 -------------------------------- glibc.changes | 19 +++ glibc.spec | 10 +- usr.sbin.nscd | 45 ------- 7 files changed, 23 insertions(+), 302 deletions(-) delete mode 100644 fopen-close-exec.patch delete mode 100644 glibc-2.14-4eddf93f5cc2.tar.bz2 create mode 100644 glibc-2.14-69c1dfc1a796.tar.bz2 delete mode 100644 usr.sbin.nscd diff --git a/fopen-close-exec.patch b/fopen-close-exec.patch deleted file mode 100644 index 160221d..0000000 --- a/fopen-close-exec.patch +++ /dev/null @@ -1,14 +0,0 @@ -Index: glibc-2.14/libio/fileops.c -=================================================================== ---- glibc-2.14.orig/libio/fileops.c -+++ glibc-2.14/libio/fileops.c -@@ -338,7 +338,8 @@ _IO_new_file_fopen (fp, filename, mode, - is32not64); - - #ifndef __ASSUME_O_CLOEXEC -- if ((fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0) -+ if ((result != NULL) -+ && (fp->_flags2 & _IO_FLAGS2_CLOEXEC) != 0 && __have_o_cloexec <= 0) - { - int fd = _IO_fileno (fp); - if (__have_o_cloexec == 0) diff --git a/glibc-2.14-4eddf93f5cc2.tar.bz2 b/glibc-2.14-4eddf93f5cc2.tar.bz2 deleted file mode 100644 index b4e0165..0000000 --- a/glibc-2.14-4eddf93f5cc2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:497c07f228208e8a0660ae5ee8919e4a6b5b59bb867891c7c02de8995310960e -size 15640100 diff --git a/glibc-2.14-69c1dfc1a796.tar.bz2 b/glibc-2.14-69c1dfc1a796.tar.bz2 new file mode 100644 index 0000000..db951fc --- /dev/null +++ b/glibc-2.14-69c1dfc1a796.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2455ca82dd99d898d8000fc0b6130d4ab80a5394fe3c1dfa6b5e9c894a73384 +size 15640243 diff --git a/glibc-2.15-vsyscall.patch b/glibc-2.15-vsyscall.patch index 0dd08a8..9ff4943 100644 --- a/glibc-2.15-vsyscall.patch +++ b/glibc-2.15-vsyscall.patch @@ -353,237 +353,6 @@ index 87bb5f0..4f6bbfd 100644 HP_TIMING_DIFF (relocate_time, start, stop); -commit e888bcbe4fb8ad538ec640bfb18b687d51e001e7 -Author: Andreas Schwab -Date: Mon Aug 22 16:08:16 2011 -0400 - - Correct cycle detection during dependency sorting - -2011-08-16 Andreas Schwab - - [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-21 Ulrich Drepper - - * sysdeps/unix/sysv/linux/x86_64/gettimeofday.S: Removed. -diff --git a/elf/Makefile b/elf/Makefile -index 709b61d..aeb6393 100644 ---- a/elf/Makefile -+++ b/elf/Makefile -@@ -120,9 +120,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) -@@ -288,7 +289,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 -@@ -1157,6 +1159,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 0b03b90..cc0023d 100644 ---- a/elf/dl-deps.c -+++ b/elf/dl-deps.c -@@ -626,12 +626,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 -@@ -652,15 +652,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; - } -@@ -671,7 +672,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 0a138e9..bafc83a 100644 ---- a/elf/dl-fini.c -+++ b/elf/dl-fini.c -@@ -39,12 +39,12 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) - /* 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 -@@ -79,14 +79,15 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) - 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; - } -@@ -96,7 +97,7 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) - 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; -@@ -109,7 +110,7 @@ _dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns) - 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 0000000..050f956 ---- /dev/null -+++ b/elf/tst-initorder2.c -@@ -0,0 +1,20 @@ -+#include -+ -+#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 0000000..5169489 ---- /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 - commit ef60624956e93df1da329a48570776ed963b1916 Author: Ulrich Drepper Date: Tue Sep 6 00:12:18 2011 -0400 diff --git a/glibc.changes b/glibc.changes index a8a66ed..7ac51c1 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Mon Sep 19 08:09:40 UTC 2011 - opensuse@cboltz.de + +- move usr.sbin.nscd apparmor profile back to apparmor-profiles package + (bnc#647718) + +------------------------------------------------------------------- +Mon Sep 19 07:45:36 UTC 2011 - aj@suse.de + +- Update to 2.14 git version 69c1dfc1a796, it contains backports from + glibc trunk: + + Fix setxid race handling exiting threads + + Fix cfi directives in x86-64 and i386 code + + Fix scope handling during dl_close + + Fix spurious nop at start of __strspn_ia32 + + Correct cycle detection during dependency sorting + + Fix fopen (non-existing-file, "re") errno (Obsoletes patch + fopen-close-exec.patch) + ------------------------------------------------------------------- Fri Sep 16 11:20:29 UTC 2011 - mmarek@suse.cz diff --git a/glibc.spec b/glibc.spec index 17cb7bd..e670be1 100644 --- a/glibc.spec +++ b/glibc.spec @@ -82,11 +82,10 @@ Version: 2.14 Release: 11 Url: http://www.gnu.org/software/libc/libc.html BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source: glibc-%{version}-4eddf93f5cc2.tar.bz2 +Source: glibc-%{version}-69c1dfc1a796.tar.bz2 Source2: http://ftp.gnu.org/gnu/glibc/glibc-ports-2.14.tar.bz2 Source3: noversion.tar.bz2 Source4: manpages.tar.bz2 -Source5: usr.sbin.nscd Source8: nsswitch.conf Source9: nscd.init Source10: bindresvport.blacklist @@ -198,8 +197,6 @@ Patch66: glibc2.14-revert-sunrpc-removal.patch Patch67: glibc-revert-fseek-on-fclose.diff # PATCH-FIX-OPENSUSE Fix crash (access-after-free) in dl_lookup_x bnc#703140 matz@suse.de Patch68: glibc-fix-lookup-crash.patch -# PATCH-FIX-UPSTREAM Fix fopen("non-existing-file", "re") errno bnc#713146 aj@suse.de -Patch69: fopen-close-exec.patch # PATCH-FIX-UPSTREAM Add vdso support to support Linux 3.1, fix order of relocations aj@suse.de Patch70: glibc-2.15-vsyscall.patch # PATCH-FIX-OPENSUSE Do not trigger an abort when an i586 Intel CPU is running the i686 library, as valgrind does. bnc#681398 aj@suse.de @@ -441,7 +438,6 @@ rm nscd/s-stamp %patch66 -p1 %patch67 -p1 %patch68 -p1 -%patch69 -p1 %patch70 -p1 %patch71 -p1 %patch72 -p1 @@ -792,8 +788,6 @@ popd # nscd tools: cp nscd/nscd.conf %{buildroot}/etc -mkdir -p %{buildroot}/etc/apparmor.d -cp $RPM_SOURCE_DIR/usr.sbin.nscd %{buildroot}/etc/apparmor.d mkdir -p %{buildroot}/etc/init.d install -m 755 $RPM_SOURCE_DIR/nscd.init %{buildroot}/etc/init.d/nscd ln -sf /etc/init.d/nscd %{buildroot}/usr/sbin/rcnscd @@ -1099,8 +1093,6 @@ exit 0 %files -n nscd %defattr(-,root,root) %config(noreplace) /etc/nscd.conf -%dir /etc/apparmor.d -%config /etc/apparmor.d/usr.sbin.nscd %config /etc/init.d/nscd %{_sbindir}/nscd %{_sbindir}/rcnscd diff --git a/usr.sbin.nscd b/usr.sbin.nscd deleted file mode 100644 index 4241743..0000000 --- a/usr.sbin.nscd +++ /dev/null @@ -1,45 +0,0 @@ -# ------------------------------------------------------------------ -# -# Copyright (C) 2002-2005 Novell/SUSE -# Copyright (C) 2009-2010 Canonical Ltd. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of version 2 of the GNU General Public -# License published by the Free Software Foundation. -# -# ------------------------------------------------------------------ - -#include -/usr/sbin/nscd { - #include - #include - #include - #include - - capability net_bind_service, - - network inet dgram, - network inet stream, - - /etc/netgroup r, - /etc/nscd.conf r, - /tmp/.winbindd/pipe rw, - /usr/sbin/nscd rmix, - /var/lib/samba/winbindd_privileged/pipe rw, - /{,var/}run/.nscd_socket wl, - /{,var/}run/avahi-daemon/socket w, - /{,var/}run/nscd/ rw, - /{,var/}run/nscd/db* wl, - /{,var/}run/nscd/socket wl, - /var/{cache,run}/nscd/{passwd,group,services,hosts} rw, - /{,var/}run/{nscd/,}nscd.pid rwl, - /var/log/nscd.log rw, - @{PROC}/[0-9]*/fd/ r, - @{PROC}/[0-9]*/fd/* r, - @{PROC}/[0-9]*/maps r, - @{PROC}/[0-9]*/mounts r, - @{PROC}/filesystems r, - - # Site-specific additions and overrides. See local/README for details. - #include -} From 71a49f5879a8895f034676eb5f04a24c811b4dce127ac67227a47d763d331686 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 23 Sep 2011 07:45:45 +0000 Subject: [PATCH 7/7] Accepting request 84531 from Base:build:arm - fix ports build - add armv8l architecture - don't enforce armv5tel for all arm architectures anymore OBS-URL: https://build.opensuse.org/request/show/84531 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=107 --- glibc.changes | 11 +++++++++++ glibc.spec | 14 ++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/glibc.changes b/glibc.changes index 7ac51c1..13f21b3 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Sep 22 21:07:43 CEST 2011 - dmueller@suse.de + +- fix ports build + +------------------------------------------------------------------- +Thu Sep 22 13:10:02 UTC 2011 - adrian@suse.de + +- add armv8l architecture +- don't enforce armv5tel for all arm architectures anymore + ------------------------------------------------------------------- Mon Sep 19 08:09:40 UTC 2011 - opensuse@cboltz.de diff --git a/glibc.spec b/glibc.spec index e670be1..f2d4280 100644 --- a/glibc.spec +++ b/glibc.spec @@ -365,10 +365,8 @@ versions of your software. %endif %prep -%ifarch %arm armv5tel armv7l +%ifarch %arm armv5tel armv7l armv8l # add glibc-ports for arm -# this is CURRENTLY BROKEN (as of 2009-11-13); ARM-interested -# contributors need to provide new tested glibc-ports source %setup -n glibc-%{version} -q -a 2 -a 3 -a 4 %else # any other leave out ports @@ -534,9 +532,9 @@ PARALLEL="%{?_smp_mflags}" %ifarch %ix86 add_ons=$add_ons,noversion %endif -%ifarch %arm armv5tel armv7l - add_ons=$add_ons,ports - BuildFlags="-march=armv5te -O2 -Wall" +%ifarch %arm armv5tel armv7l armv8l + add_ons=$add_ons,glibc-ports-%{version} + BuildFlags="$BuildFlags -fasynchronous-unwind-tables" # fails to build otherwise - need to recheck and fix %define enable_stackguard_randomization 0 %endif @@ -555,7 +553,7 @@ configure_and_build_glibc() { %if %{enable_stackguard_randomization} --enable-stackguard-randomization \ %endif -%ifarch %arm armv5tel armv7l +%ifarch %arm armv5tel armv7l armv8l --build=%{_target_cpu}-suse-linux-gnueabi \ %else --build=%{_target_cpu}-suse-linux \ @@ -925,7 +923,7 @@ exit 0 %ifarch x86_64 /%{_lib}/ld-linux-x86-64.so.2 %else - %ifarch %arm armv5tel armv7l + %ifarch %arm armv5tel armv7l armv8l /%{_lib}/ld-linux.so.3 %else /%{_lib}/ld-linux.so.2