Accepting request 321589 from Base:System

- dont-remove-nodelete-flag.patch: Don't remove DF_1_NODELETE flag from
  all loaded objects on failed dlopen
- openat64-readd-o-largefile.patch: Readd O_LARGEFILE flag for openat64 (forwarded request 321588 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/321589
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=193
This commit is contained in:
Dominique Leuenberger 2015-08-21 05:37:51 +00:00 committed by Git OBS Bridge
parent ff0db58793
commit f34435dcec
26 changed files with 452 additions and 2692 deletions

View File

@ -1,62 +0,0 @@
[BZ #16850]
* sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h: New file.
Index: glibc-2.21/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
===================================================================
--- /dev/null
+++ glibc-2.21/sysdeps/unix/sysv/linux/aarch64/bits/sigstack.h
@@ -0,0 +1,54 @@
+/* sigstack, sigaltstack definitions.
+ Copyright (C) 2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SIGNAL_H
+# error "Never include this file directly. Use <signal.h> instead"
+#endif
+
+
+/* Structure describing a signal stack (obsolete). */
+struct sigstack
+ {
+ void *ss_sp; /* Signal stack pointer. */
+ int ss_onstack; /* Nonzero if executing on this stack. */
+ };
+
+
+/* Possible values for `ss_flags.'. */
+enum
+{
+ SS_ONSTACK = 1,
+#define SS_ONSTACK SS_ONSTACK
+ SS_DISABLE
+#define SS_DISABLE SS_DISABLE
+};
+
+/* Minimum stack size for a signal handler. */
+#define MINSIGSTKSZ 5120
+
+/* System default stack size. */
+#define SIGSTKSZ 16384
+
+
+/* Alternate, preferred interface. */
+typedef struct sigaltstack
+ {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+ } stack_t;

View File

@ -0,0 +1,34 @@
Index: glibc-2.22/elf/dl-close.c
===================================================================
--- glibc-2.22.orig/elf/dl-close.c
+++ glibc-2.22/elf/dl-close.c
@@ -144,6 +144,14 @@ _dl_close_worker (struct link_map *map,
char done[nloaded];
struct link_map *maps[nloaded];
+ /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
+ l_tls_dtor_count because forced object deletion only happens when an
+ error occurs during object load. Destructor registration for TLS
+ non-POD objects should not have happened till then for this
+ object. */
+ if (force)
+ map->l_flags_1 &= ~DF_1_NODELETE;
+
/* Run over the list and assign indexes to the link maps and enter
them into the MAPS array. */
int idx = 0;
@@ -152,14 +160,6 @@ _dl_close_worker (struct link_map *map,
l->l_idx = idx;
maps[idx] = l;
++idx;
-
- /* Clear DF_1_NODELETE to force object deletion. We don't need to touch
- l_tls_dtor_count because forced object deletion only happens when an
- error occurs during object load. Destructor registration for TLS
- non-POD objects should not have happened till then for this
- object. */
- if (force)
- l->l_flags_1 &= ~DF_1_NODELETE;
}
assert (idx == nloaded);

View File

@ -5,7 +5,7 @@ Always do locking when accessing streams
(_IO_flush_all_all_lockp): Delete.
(_IO_flush_all): Replace with body of _IO_flush_all_all_lockp.
Always do locking.
(_IO_unbuffer_write): Always do locking.
(_IO_unbuffer_all): Always do locking.
(_IO_cleanup): Call _IO_flush_all instead of _IO_flush_all_lockp.
* libio/libioP.h (_IO_flush_all_all_lockp): Remove declaration.
@ -155,7 +155,7 @@ index e0ce8cc..9def1d4 100644
#ifdef _IO_MTSAFE_IO
@@ -947,6 +902,12 @@ static void
_IO_unbuffer_write (void)
_IO_unbuffer_all (void)
{
struct _IO_FILE *fp;
+

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aeeb362437965a5d3f40b151094ca79def04a115bd363fdd4a9a0c69482923b8
size 12322092

3
glibc-2.22.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb731406903befef1d8f878a46be75ef862b9056ab0cde1626d08a7a05328948
size 12969072

11
glibc-2.22.tar.xz.sig Normal file
View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJVwbd/AAoJECXvCkNsKkr/51cIAKdzgyrQSN6EKFIIhj/SrxPz
RyxACKUITXw5F5BldwIx3pYqpF3V7eslWdkPcZ7Ztcc/9irgvoW+qARAxivciOn1
N33GA8hLG+Nj4kYCI9DjdJTB01UsR1iEd02ISRB23rqnUvVOgioPubJKb6GJM9Ob
NyAn/rIR+hVXAb5SDci2lkiA604MWg2VdjPxt+dDc8lBCcBfkGHh1Sz+nVxyXWGR
v45+US9jwefFCgBLJvfUmqlgUYxmB6RxMcxrlNx4mTtobdsQM+rBOy84T12s3HMK
k1IPVd6YD7k4lOYjSpzzc/sj7Ib33/hfbGvwDFpjr85RgoGUgsyqnSxEL1U8Azw=
=C5JY
-----END PGP SIGNATURE-----

View File

@ -1,7 +1,7 @@
Index: glibc-2.20.90/nscd/nscd_stat.c
Index: glibc-2.21/nscd/nscd_stat.c
===================================================================
--- glibc-2.20.90.orig/nscd/nscd_stat.c
+++ glibc-2.20.90/nscd/nscd_stat.c
--- glibc-2.21.orig/nscd/nscd_stat.c
+++ glibc-2.21/nscd/nscd_stat.c
@@ -36,8 +36,13 @@
#endif /* HAVE_SELINUX */
@ -30,3 +30,18 @@ Index: glibc-2.20.90/nscd/nscd_stat.c
data.debug_level = debug_level;
data.runtime = time (NULL) - start_time;
data.client_queued = client_queued;
@@ -196,7 +206,13 @@ receive_print_stats (void)
/* Read as much data as we expect. */
if (TEMP_FAILURE_RETRY (read (fd, &data, sizeof (data))) != sizeof (data)
- || (memcmp (data.version, compilation, sizeof (compilation)) != 0
+ || (
+#ifdef __TIMESTAMP__
+ /* Skip day of the week. */
+ memcmp (data.version, __TIMESTAMP__ + 4, sizeof (compilation)) != 0
+#else
+ memcmp (data.version, compilation, sizeof (compilation)) != 0
+#endif
/* Yes, this is an assignment! */
&& (errno = EINVAL)))
{

View File

@ -1,3 +1,57 @@
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de
- dont-remove-nodelete-flag.patch: Don't remove DF_1_NODELETE flag from
all loaded objects on failed dlopen
- openat64-readd-o-largefile.patch: Readd O_LARGEFILE flag for openat64
-------------------------------------------------------------------
Wed Aug 5 09:35:41 UTC 2015 - schwab@suse.de
- Update to glibc 2.22 release.
* Cache information can be queried via sysconf() function on s390
* A buffer overflow in gethostbyname_r and related functions performing DNS
requests has been fixed.
* The time zone file parser has been made more robust against crafted time
zone files
* A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors
for LD and GD on x86 and x86-64, has been implemented.
* Character encoding and ctype tables were updated to Unicode 7.0.0
* Added vector math library named libmvec
* A new fmemopen implementation has been added with the goal of POSIX
compliance.
* The header <regexp.h> is deprecated, and will be removed in a future
release.
- Patches from upstream removed
* htm-tabort.patch
* o-tmpfile.patch
* memcpy-chk-non-SSE2.patch
* pthread-mutexattr-gettype-kind.patch
* powerpc-software-sqrt.patch
* static-tls-dtv-limit.patch
* threaded-trim-threshold.patch
* resolv-nameserver-handling.patch
* nss-separate-state-getXXent.patch
* aarch64-sigstksz.patch
* heap-top-corruption.patch
* pthread-join-deadlock.patch
-------------------------------------------------------------------
Mon Jul 27 09:08:21 UTC 2015 - schwab@suse.de
- pthread-join-deadlock.patch: Use IE model for static variables in
libc.so, libpthread.so and rtld (bsc#930015, BZ #18457)
-------------------------------------------------------------------
Wed Jul 22 09:13:48 UTC 2015 - schwab@suse.de
- glibc-nodate.patch: fix verification of timestamp
-------------------------------------------------------------------
Tue Jul 21 07:50:22 UTC 2015 - meissner@suse.com
- also filter out -fstack-protector-strong
-------------------------------------------------------------------
Mon Jun 22 07:22:22 UTC 2015 - schwab@suse.de

View File

@ -100,13 +100,15 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.21
Version: 2.22
Release: 0
%define git_id 4e42b5b8f89f
%define git_id bbab82c25da9
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz
Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig
Source2: glibc.keyring
Source3: noversion.tar.bz2
Source4: manpages.tar.bz2
Source5: nsswitch.conf
@ -214,7 +216,6 @@ Patch102: glibc-2.4.90-no_NO.diff
Patch103: glibc-2.4-china.diff
### Broken patches in glibc that we revert for now:
# None
### Network related patches
# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change
@ -229,26 +230,6 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM powerpc: Fix TABORT encoding for little endian
Patch1000: htm-tabort.patch
# PATCH-FIX-UPSTREAM Fix value of O_TMPFILE for architectures with non-default O_DIRECTORY (BZ #17912)
Patch1001: o-tmpfile.patch
# PATCH-FIX-UPSTREAM Fix __memcpy_chk on non-SSE2 CPUs (BZ #17949)
Patch1002: memcpy-chk-non-SSE2.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch1003: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix powerpc software sqrt (BZ #17964, BZ #17967)
Patch1004: powerpc-software-sqrt.patch
# PATCH-FIX-UPSTREAM Fix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbage (bsc#919678, BZ #17090, BZ #17620, BZ #17621, BZ #17628)
Patch1005: static-tls-dtv-limit.patch
# PATCH-FIX-UPSTREAM Fix regression in threaded application malloc performance (bsc#915955, BZ #17195)
Patch1006: threaded-trim-threshold.patch
# PATCH-FIX-UPSTREAM Simplify handling of nameserver configuration in resolver
Patch1007: resolv-nameserver-handling.patch
# PATCH-FIX-UPSTREAM Separate internal state between getXXent and getXXbyYY NSS calls (bsc#918187, BZ #18007)
Patch1008: nss-separate-state-getXXent.patch
# PATCH-FIX-UPSTREAM aarch64: Increase MINSIGSTKSZ and SIGSTKSZ (BZ #16850)
Patch1009: aarch64-sigstksz.patch
###
# Patches awaiting upstream approval
@ -263,10 +244,10 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Don't require rtld lock to store static TLS offset in the DTV (BZ #18457)
Patch2007: pthread-join-deadlock.patch
# PATCH-FIX-UPSTREAM malloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE (BZ #18502)
Patch2008: heap-top-corruption.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -466,17 +447,6 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
@ -541,7 +511,7 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=libidn
@ -1144,6 +1114,10 @@ exit 0
/%{_lib}/libdl.so.2*
/%{_lib}/libm-%{version}.so
/%{_lib}/libm.so.6*
%ifarch x86_64
/%{_lib}/libmvec-%{version}.so
/%{_lib}/libmvec.so.1
%endif
/%{_lib}/libnsl-%{version}.so
/%{_lib}/libnsl.so.1
/%{_lib}/libnss_compat-%{version}.so
@ -1265,6 +1239,9 @@ exit 0
%{_libdir}/libowcrypt.a
%{_libdir}/libdl.a
%{_libdir}/libm.a
%ifarch x86_64
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
@ -1313,6 +1290,9 @@ exit 0
%{_libdir}/libBrokenLocale_p.a
%{_libdir}/libanl_p.a
%{_libdir}/libm_p.a
%ifarch x86_64
%{_libdir}/libmvec_p.a
%endif
%{_libdir}/libcrypt_p.a
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a

View File

@ -1,3 +1,57 @@
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de
- dont-remove-nodelete-flag.patch: Don't remove DF_1_NODELETE flag from
all loaded objects on failed dlopen
- openat64-readd-o-largefile.patch: Readd O_LARGEFILE flag for openat64
-------------------------------------------------------------------
Wed Aug 5 09:35:41 UTC 2015 - schwab@suse.de
- Update to glibc 2.22 release.
* Cache information can be queried via sysconf() function on s390
* A buffer overflow in gethostbyname_r and related functions performing DNS
requests has been fixed.
* The time zone file parser has been made more robust against crafted time
zone files
* A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors
for LD and GD on x86 and x86-64, has been implemented.
* Character encoding and ctype tables were updated to Unicode 7.0.0
* Added vector math library named libmvec
* A new fmemopen implementation has been added with the goal of POSIX
compliance.
* The header <regexp.h> is deprecated, and will be removed in a future
release.
- Patches from upstream removed
* htm-tabort.patch
* o-tmpfile.patch
* memcpy-chk-non-SSE2.patch
* pthread-mutexattr-gettype-kind.patch
* powerpc-software-sqrt.patch
* static-tls-dtv-limit.patch
* threaded-trim-threshold.patch
* resolv-nameserver-handling.patch
* nss-separate-state-getXXent.patch
* aarch64-sigstksz.patch
* heap-top-corruption.patch
* pthread-join-deadlock.patch
-------------------------------------------------------------------
Mon Jul 27 09:08:21 UTC 2015 - schwab@suse.de
- pthread-join-deadlock.patch: Use IE model for static variables in
libc.so, libpthread.so and rtld (bsc#930015, BZ #18457)
-------------------------------------------------------------------
Wed Jul 22 09:13:48 UTC 2015 - schwab@suse.de
- glibc-nodate.patch: fix verification of timestamp
-------------------------------------------------------------------
Tue Jul 21 07:50:22 UTC 2015 - meissner@suse.com
- also filter out -fstack-protector-strong
-------------------------------------------------------------------
Mon Jun 22 07:22:22 UTC 2015 - schwab@suse.de

View File

@ -99,13 +99,15 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.21
Version: 2.22
Release: 0
%define git_id 4e42b5b8f89f
%define git_id bbab82c25da9
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz
Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig
Source2: glibc.keyring
Source3: noversion.tar.bz2
Source4: manpages.tar.bz2
Source5: nsswitch.conf
@ -213,7 +215,6 @@ Patch102: glibc-2.4.90-no_NO.diff
Patch103: glibc-2.4-china.diff
### Broken patches in glibc that we revert for now:
# None
### Network related patches
# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change
@ -228,26 +229,6 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM powerpc: Fix TABORT encoding for little endian
Patch1000: htm-tabort.patch
# PATCH-FIX-UPSTREAM Fix value of O_TMPFILE for architectures with non-default O_DIRECTORY (BZ #17912)
Patch1001: o-tmpfile.patch
# PATCH-FIX-UPSTREAM Fix __memcpy_chk on non-SSE2 CPUs (BZ #17949)
Patch1002: memcpy-chk-non-SSE2.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch1003: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix powerpc software sqrt (BZ #17964, BZ #17967)
Patch1004: powerpc-software-sqrt.patch
# PATCH-FIX-UPSTREAM Fix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbage (bsc#919678, BZ #17090, BZ #17620, BZ #17621, BZ #17628)
Patch1005: static-tls-dtv-limit.patch
# PATCH-FIX-UPSTREAM Fix regression in threaded application malloc performance (bsc#915955, BZ #17195)
Patch1006: threaded-trim-threshold.patch
# PATCH-FIX-UPSTREAM Simplify handling of nameserver configuration in resolver
Patch1007: resolv-nameserver-handling.patch
# PATCH-FIX-UPSTREAM Separate internal state between getXXent and getXXbyYY NSS calls (bsc#918187, BZ #18007)
Patch1008: nss-separate-state-getXXent.patch
# PATCH-FIX-UPSTREAM aarch64: Increase MINSIGSTKSZ and SIGSTKSZ (BZ #16850)
Patch1009: aarch64-sigstksz.patch
###
# Patches awaiting upstream approval
@ -262,10 +243,10 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Don't require rtld lock to store static TLS offset in the DTV (BZ #18457)
Patch2007: pthread-join-deadlock.patch
# PATCH-FIX-UPSTREAM malloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE (BZ #18502)
Patch2008: heap-top-corruption.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -466,17 +447,6 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
@ -541,7 +511,7 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=libidn
@ -1144,6 +1114,10 @@ exit 0
/%{_lib}/libdl.so.2*
/%{_lib}/libm-%{version}.so
/%{_lib}/libm.so.6*
%ifarch x86_64
/%{_lib}/libmvec-%{version}.so
/%{_lib}/libmvec.so.1
%endif
/%{_lib}/libnsl-%{version}.so
/%{_lib}/libnsl.so.1
/%{_lib}/libnss_compat-%{version}.so
@ -1265,6 +1239,9 @@ exit 0
%{_libdir}/libowcrypt.a
%{_libdir}/libdl.a
%{_libdir}/libm.a
%ifarch x86_64
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
@ -1313,6 +1290,9 @@ exit 0
%{_libdir}/libBrokenLocale_p.a
%{_libdir}/libanl_p.a
%{_libdir}/libm_p.a
%ifarch x86_64
%{_libdir}/libmvec_p.a
%endif
%{_libdir}/libcrypt_p.a
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a

View File

@ -1,3 +1,57 @@
-------------------------------------------------------------------
Mon Aug 10 09:23:57 UTC 2015 - schwab@suse.de
- dont-remove-nodelete-flag.patch: Don't remove DF_1_NODELETE flag from
all loaded objects on failed dlopen
- openat64-readd-o-largefile.patch: Readd O_LARGEFILE flag for openat64
-------------------------------------------------------------------
Wed Aug 5 09:35:41 UTC 2015 - schwab@suse.de
- Update to glibc 2.22 release.
* Cache information can be queried via sysconf() function on s390
* A buffer overflow in gethostbyname_r and related functions performing DNS
requests has been fixed.
* The time zone file parser has been made more robust against crafted time
zone files
* A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors
for LD and GD on x86 and x86-64, has been implemented.
* Character encoding and ctype tables were updated to Unicode 7.0.0
* Added vector math library named libmvec
* A new fmemopen implementation has been added with the goal of POSIX
compliance.
* The header <regexp.h> is deprecated, and will be removed in a future
release.
- Patches from upstream removed
* htm-tabort.patch
* o-tmpfile.patch
* memcpy-chk-non-SSE2.patch
* pthread-mutexattr-gettype-kind.patch
* powerpc-software-sqrt.patch
* static-tls-dtv-limit.patch
* threaded-trim-threshold.patch
* resolv-nameserver-handling.patch
* nss-separate-state-getXXent.patch
* aarch64-sigstksz.patch
* heap-top-corruption.patch
* pthread-join-deadlock.patch
-------------------------------------------------------------------
Mon Jul 27 09:08:21 UTC 2015 - schwab@suse.de
- pthread-join-deadlock.patch: Use IE model for static variables in
libc.so, libpthread.so and rtld (bsc#930015, BZ #18457)
-------------------------------------------------------------------
Wed Jul 22 09:13:48 UTC 2015 - schwab@suse.de
- glibc-nodate.patch: fix verification of timestamp
-------------------------------------------------------------------
Tue Jul 21 07:50:22 UTC 2015 - meissner@suse.com
- also filter out -fstack-protector-strong
-------------------------------------------------------------------
Mon Jun 22 07:22:22 UTC 2015 - schwab@suse.de

149
glibc.keyring Normal file
View File

@ -0,0 +1,149 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQENBE4dpFUBCADZZ08fnFCfXs6Olh8rZ3Q++Y7/rTM+6ZPGvCNAKw7A6+H9r8bD
pjEA2VNHlD1Gxtdx8zVMSgAxhp+Z2LaI2NUX+o0gz4Gh+PpRSw+7gyXU5LUPGxVe
clAt+ygHklB556Iqoc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kivvUN3nyRJcgULzuPJYozi3m/esO4/JEYQSSg
1VgnSsvmcf+3VwdtDC9IfbiibVURvBtUinnd4wNif+ZZV+r/fTz9A2Foc7q4Rn8z
nyKL9i6OPJDmn/44z+Poz+6fa6LzkXdxF4+NQvxfIUMmhFIbZpLzyVey5hr+jDFa
QoEoZi32SqCVBwFHmSrUNVuw5WeHLtG6wjfrK9R8iQEVAwUQPOXmBKGqoWHCJjRF
AQH9xAgArM2dOSL+1oBX/DWb24VrNuaYuXDc4FGS5xhZ2z8+w/o8JPVgaKERGQGM
XHHBkoWqRJ/3pNiRQZPsDW7dSLdw+jeSDEwe62vz429NSkBhgyt5k5g2HsVbz4Jf
7yb/DZxNXlTnkCNSlolUDnpUozTUzDCIWJQ6m6Q1cJP/Fxki5AmLi9juMn3YPoo0
kVAE0lu7MZ5uPq93CoCLJ5CgtDKGmPlLrA8+21DmpCqO8MjZPU6Ae14rixUrLG1V
5KN2sLsB3yWLV37qc+Fx0+U1iSVRY5MQDvgo2CPWGQsFgc8GbhvDzXasFKayDwBS
5YGy0WPvg8z+Jq17TMKt8qd7CArYdg==
=n8pX
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -100,13 +100,15 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.21
Version: 2.22
Release: 0
%define git_id 4e42b5b8f89f
%define git_id bbab82c25da9
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
Source: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz
Source1: http://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig
Source2: glibc.keyring
Source3: noversion.tar.bz2
Source4: manpages.tar.bz2
Source5: nsswitch.conf
@ -214,7 +216,6 @@ Patch102: glibc-2.4.90-no_NO.diff
Patch103: glibc-2.4-china.diff
### Broken patches in glibc that we revert for now:
# None
### Network related patches
# PATCH-FIX-OPENSUSE reload /etc/resolv.conf on change
@ -229,26 +230,6 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM powerpc: Fix TABORT encoding for little endian
Patch1000: htm-tabort.patch
# PATCH-FIX-UPSTREAM Fix value of O_TMPFILE for architectures with non-default O_DIRECTORY (BZ #17912)
Patch1001: o-tmpfile.patch
# PATCH-FIX-UPSTREAM Fix __memcpy_chk on non-SSE2 CPUs (BZ #17949)
Patch1002: memcpy-chk-non-SSE2.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch1003: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix powerpc software sqrt (BZ #17964, BZ #17967)
Patch1004: powerpc-software-sqrt.patch
# PATCH-FIX-UPSTREAM Fix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbage (bsc#919678, BZ #17090, BZ #17620, BZ #17621, BZ #17628)
Patch1005: static-tls-dtv-limit.patch
# PATCH-FIX-UPSTREAM Fix regression in threaded application malloc performance (bsc#915955, BZ #17195)
Patch1006: threaded-trim-threshold.patch
# PATCH-FIX-UPSTREAM Simplify handling of nameserver configuration in resolver
Patch1007: resolv-nameserver-handling.patch
# PATCH-FIX-UPSTREAM Separate internal state between getXXent and getXXbyYY NSS calls (bsc#918187, BZ #18007)
Patch1008: nss-separate-state-getXXent.patch
# PATCH-FIX-UPSTREAM aarch64: Increase MINSIGSTKSZ and SIGSTKSZ (BZ #16850)
Patch1009: aarch64-sigstksz.patch
###
# Patches awaiting upstream approval
@ -263,10 +244,10 @@ Patch2003: abort-no-flush.patch
Patch2005: glibc-memset-nontemporal.diff
# PATCH-FIX-UPSTREAM Avoid redundant shift character in iconv output at block boundary (BZ #17197)
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Don't require rtld lock to store static TLS offset in the DTV (BZ #18457)
Patch2007: pthread-join-deadlock.patch
# PATCH-FIX-UPSTREAM malloc: Do not corrupt the top of a threaded heap if top chunk is MINSIZE (BZ #18502)
Patch2008: heap-top-corruption.patch
# BZ #18778
Patch2007: dont-remove-nodelete-flag.patch
# BZ #18781
Patch2008: openat64-readd-o-largefile.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -466,17 +447,6 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch2000 -p1
%patch2002 -p1
%patch2003 -p1
@ -541,7 +511,7 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=libidn
@ -1144,6 +1114,10 @@ exit 0
/%{_lib}/libdl.so.2*
/%{_lib}/libm-%{version}.so
/%{_lib}/libm.so.6*
%ifarch x86_64
/%{_lib}/libmvec-%{version}.so
/%{_lib}/libmvec.so.1
%endif
/%{_lib}/libnsl-%{version}.so
/%{_lib}/libnsl.so.1
/%{_lib}/libnss_compat-%{version}.so
@ -1265,6 +1239,9 @@ exit 0
%{_libdir}/libowcrypt.a
%{_libdir}/libdl.a
%{_libdir}/libm.a
%ifarch x86_64
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
@ -1313,6 +1290,9 @@ exit 0
%{_libdir}/libBrokenLocale_p.a
%{_libdir}/libanl_p.a
%{_libdir}/libm_p.a
%ifarch x86_64
%{_libdir}/libmvec_p.a
%endif
%{_libdir}/libcrypt_p.a
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a

View File

@ -1,51 +0,0 @@
From: Mel Gorman <mgorman@suse.de>
Subject: [PATCH] [v3] malloc: Do not corrupt the top of a threaded heap if
top chunk is MINSIZE [BZ #18502]
Date: Mon, 8 Jun 2015 13:36:13 +0100
mksquashfs was reported in openSUSE to be causing segmentation faults when
creating installation images. Testing showed that mksquashfs sometimes
failed and could be reproduced within 10 attempts. The core dump looked
like the heap top was corrupted and was pointing to an unmapped area. In
other cases, this has been due to an application corrupting glibc structures
but mksquashfs appears to be fine in this regard.
The problem is that heap_trim is "growing" the top into unmapped space.
If the top chunk == MINSIZE then top_area is -1 and this check does not
behave as expected due to a signed/unsigned comparison
if (top_area <= pad)
return 0;
The next calculation extra = ALIGN_DOWN(top_area - pad, pagesz) calculates
extra as a negative number which also is unnoticed due to a signed/unsigned
comparison. We then call shrink_heap(heap, negative_number) which crashes
later. This patch adds a simple check against MINSIZE to make sure extra
does not become negative. It adds a cast to hint to the reader that this
is a signed vs unsigned issue.
Without the patch, mksquash fails within 10 attempts. With it applied, it
completed 1000 times without error. The standard test suite "make check"
showed no changes in the summary of test results.
2015-06-08 Mel Gorman <mgorman@suse.de>
[BZ #18502]
* malloc/arena.c: Avoid corruption of the top of heaps for threads
---
malloc/arena.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: glibc-2.21/malloc/arena.c
===================================================================
--- glibc-2.21.orig/malloc/arena.c
+++ glibc-2.21/malloc/arena.c
@@ -699,7 +699,7 @@ heap_trim (heap_info *heap, size_t pad)
by preserving the top pad and at least a page. */
top_size = chunksize (top_chunk);
top_area = top_size - MINSIZE - 1;
- if (top_area <= pad)
+ if (top_area < 0 || (size_t) top_area <= pad)
return 0;
extra = ALIGN_DOWN(top_area - pad, pagesz);

View File

@ -1,18 +0,0 @@
2015-02-12 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/htm.h [TABORT]: Fix encoding for
little endian.
Index: glibc-2.21/sysdeps/unix/sysv/linux/powerpc/htm.h
===================================================================
--- glibc-2.21.orig/sysdeps/unix/sysv/linux/powerpc/htm.h
+++ glibc-2.21/sysdeps/unix/sysv/linux/powerpc/htm.h
@@ -60,7 +60,7 @@
#define TBEGIN ".long 0x7c00051d"
#define TEND ".long 0x7c00055d"
#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define TABORT ".byte 0x1d,0x07,%1,0x1d"
+# define TABORT ".byte 0x1d,0x07,%1,0x7c"
#else
# define TABORT ".byte 0x7c,%1,0x07,0x1d"
#endif

View File

@ -1,21 +0,0 @@
2015-02-10 Evangelos Foutras <evangelos@foutrelis.com>
[BZ #17949]
* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Fix position of
jump label.
Index: glibc-2.21/sysdeps/i386/i686/multiarch/mempcpy_chk.S
===================================================================
--- glibc-2.21.orig/sysdeps/i386/i686/multiarch/mempcpy_chk.S
+++ glibc-2.21/sysdeps/i386/i686/multiarch/mempcpy_chk.S
@@ -36,8 +36,8 @@ ENTRY(__mempcpy_chk)
cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
jne 1f
call __init_cpu_features
- leal __mempcpy_chk_ia32@GOTOFF(%ebx), %eax
-1: testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+1: leal __mempcpy_chk_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
jz 2f
leal __mempcpy_chk_sse2_unaligned@GOTOFF(%ebx), %eax
testl $bit_Fast_Unaligned_Load, FEATURE_OFFSET+index_Fast_Unaligned_Load+__cpu_features@GOTOFF(%ebx)

View File

@ -1,715 +0,0 @@
[BZ #18007]
* nis/nss_compat/compat-grp.c (internal_endgrent): Add parameter
needent, call nss_endgrent only if non-zero.
(_nss_compat_endgrent): Pass non-zero.
(_nss_compat_getgrnam_r, _nss_compat_getgrgid_r): Pass zero.
* nis/nss_compat/compat-pwd.c (internal_endpwent): Add parameter
needent, call nss_endpwent only if non-zero.
(_nss_compat_endpwent): Pass non-zero.
(_nss_compat_getpwnam_r, _nss_compat_getpwuid_r): Pass zero.
* nis/nss_compat/compat-spwd.c (internal_setspent): Add parameter
needent, call nss_setspent only if non-zero.
(_nss_compat_setspent): Pass non-zero.
(internal_endspent): Add parameter needent, call nss_endspent only
if non-zero.
(_nss_compat_endspent, _nss_compat_getspent_r): Pass non-zero.
(_nss_compat_getspnam_r): Pass zero.
* nss/nss_files/files-XXX.c (position, last_use, keep_stream):
Remove. All uses removed.
(internal_setent): Remove parameter stayopen, add parameter
stream. Use it instead of global variable.
(CONCAT(_nss_files_set,ENTNAME)): Pass global stream.
(internal_endent, internal_getent): Add parameter stream. Use it
instead of global variable.
(CONCAT(_nss_files_end,ENTNAME))
(CONCAT(_nss_files_get,ENTNAME_r)): Pass global stream.
(_nss_files_get##name##_r): Pass local stream. Remove locking.
* nss/nss_files/files-alias.c (position, last_use): Remove. All
uses removed.
(internal_setent, internal_endent): Add parameter stream. Use it
instead of global variable.
(_nss_files_setaliasent, _nss_files_endaliasent): Pass global
stream.
(get_next_alias): Add parameter stream.
(_nss_files_getaliasent_r): Pass global stream.
(_nss_files_getaliasbyname_r): Pass local stream. Remove locking.
* nss/nss_files/files-hosts.c (_nss_files_gethostbyname3_r)
(_nss_files_gethostbyname4_r): Pass local stream to
internal_setent, internal_getent and internal_endent. Remove
locking.
Index: glibc-2.21/nis/nss_compat/compat-grp.c
===================================================================
--- glibc-2.21.orig/nis/nss_compat/compat-grp.c
+++ glibc-2.21/nis/nss_compat/compat-grp.c
@@ -192,9 +192,9 @@ _nss_compat_setgrent (int stayopen)
static enum nss_status
-internal_endgrent (ent_t *ent)
+internal_endgrent (ent_t *ent, int needent)
{
- if (nss_endgrent)
+ if (needent && nss_endgrent)
nss_endgrent ();
if (ent->stream != NULL)
@@ -222,7 +222,7 @@ _nss_compat_endgrent (void)
__libc_lock_lock (lock);
- result = internal_endgrent (&ext_ent);
+ result = internal_endgrent (&ext_ent, 1);
__libc_lock_unlock (lock);
@@ -532,7 +532,7 @@ _nss_compat_getgrnam_r (const char *name
if (result == NSS_STATUS_SUCCESS)
result = internal_getgrnam_r (name, grp, &ent, buffer, buflen, errnop);
- internal_endgrent (&ent);
+ internal_endgrent (&ent, 0);
return result;
}
@@ -661,7 +661,7 @@ _nss_compat_getgrgid_r (gid_t gid, struc
if (result == NSS_STATUS_SUCCESS)
result = internal_getgrgid_r (gid, grp, &ent, buffer, buflen, errnop);
- internal_endgrent (&ent);
+ internal_endgrent (&ent, 0);
return result;
}
Index: glibc-2.21/nis/nss_compat/compat-pwd.c
===================================================================
--- glibc-2.21.orig/nis/nss_compat/compat-pwd.c
+++ glibc-2.21/nis/nss_compat/compat-pwd.c
@@ -309,9 +309,9 @@ _nss_compat_setpwent (int stayopen)
static enum nss_status
-internal_endpwent (ent_t *ent)
+internal_endpwent (ent_t *ent, int needent)
{
- if (nss_endpwent)
+ if (needent && nss_endpwent)
nss_endpwent ();
if (ent->stream != NULL)
@@ -346,7 +346,7 @@ _nss_compat_endpwent (void)
__libc_lock_lock (lock);
- result = internal_endpwent (&ext_ent);
+ result = internal_endpwent (&ext_ent, 1);
__libc_lock_unlock (lock);
@@ -871,7 +871,7 @@ _nss_compat_getpwnam_r (const char *name
if (result == NSS_STATUS_SUCCESS)
result = internal_getpwnam_r (name, pwd, &ent, buffer, buflen, errnop);
- internal_endpwent (&ent);
+ internal_endpwent (&ent, 0);
return result;
}
@@ -1110,7 +1110,7 @@ _nss_compat_getpwuid_r (uid_t uid, struc
if (result == NSS_STATUS_SUCCESS)
result = internal_getpwuid_r (uid, pwd, &ent, buffer, buflen, errnop);
- internal_endpwent (&ent);
+ internal_endpwent (&ent, 0);
return result;
}
Index: glibc-2.21/nis/nss_compat/compat-spwd.c
===================================================================
--- glibc-2.21.orig/nis/nss_compat/compat-spwd.c
+++ glibc-2.21/nis/nss_compat/compat-spwd.c
@@ -169,7 +169,7 @@ copy_spwd_changes (struct spwd *dest, st
}
static enum nss_status
-internal_setspent (ent_t *ent, int stayopen)
+internal_setspent (ent_t *ent, int stayopen, int needent)
{
enum nss_status status = NSS_STATUS_SUCCESS;
@@ -239,7 +239,7 @@ internal_setspent (ent_t *ent, int stayo
give_spwd_free (&ent->pwd);
- if (status == NSS_STATUS_SUCCESS && nss_setspent)
+ if (needent && status == NSS_STATUS_SUCCESS && nss_setspent)
ent->setent_status = nss_setspent (stayopen);
return status;
@@ -256,7 +256,7 @@ _nss_compat_setspent (int stayopen)
if (ni == NULL)
init_nss_interface ();
- result = internal_setspent (&ext_ent, stayopen);
+ result = internal_setspent (&ext_ent, stayopen, 1);
__libc_lock_unlock (lock);
@@ -265,9 +265,9 @@ _nss_compat_setspent (int stayopen)
static enum nss_status
-internal_endspent (ent_t *ent)
+internal_endspent (ent_t *ent, int needent)
{
- if (nss_endspent)
+ if (needent && nss_endspent)
nss_endspent ();
if (ent->stream != NULL)
@@ -303,7 +303,7 @@ _nss_compat_endspent (void)
__libc_lock_lock (lock);
- result = internal_endspent (&ext_ent);
+ result = internal_endspent (&ext_ent, 1);
__libc_lock_unlock (lock);
@@ -658,7 +658,7 @@ _nss_compat_getspent_r (struct spwd *pwd
init_nss_interface ();
if (ext_ent.stream == NULL)
- result = internal_setspent (&ext_ent, 1);
+ result = internal_setspent (&ext_ent, 1, 1);
if (result == NSS_STATUS_SUCCESS)
result = internal_getspent_r (pwd, &ext_ent, buffer, buflen, errnop);
@@ -830,12 +830,12 @@ _nss_compat_getspnam_r (const char *name
__libc_lock_unlock (lock);
- result = internal_setspent (&ent, 0);
+ result = internal_setspent (&ent, 0, 0);
if (result == NSS_STATUS_SUCCESS)
result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
- internal_endspent (&ent);
+ internal_endspent (&ent, 0);
return result;
}
Index: glibc-2.21/nss/nss_files/files-XXX.c
===================================================================
--- glibc-2.21.orig/nss/nss_files/files-XXX.c
+++ glibc-2.21/nss/nss_files/files-XXX.c
@@ -63,21 +63,18 @@ __libc_lock_define_initialized (static,
/* Maintenance of the shared stream open on the database file. */
static FILE *stream;
-static fpos_t position;
-static enum { nouse, getent, getby } last_use;
-static int keep_stream;
/* Open database file if not already opened. */
static enum nss_status
-internal_setent (int stayopen)
+internal_setent (FILE **stream)
{
enum nss_status status = NSS_STATUS_SUCCESS;
- if (stream == NULL)
+ if (*stream == NULL)
{
- stream = fopen (DATAFILE, "rce");
+ *stream = fopen (DATAFILE, "rce");
- if (stream == NULL)
+ if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
@@ -90,7 +87,7 @@ internal_setent (int stayopen)
int result;
int flags;
- result = flags = fcntl (fileno (stream), F_GETFD, 0);
+ result = flags = fcntl (fileno (*stream), F_GETFD, 0);
if (result >= 0)
{
# ifdef O_CLOEXEC
@@ -100,15 +97,15 @@ internal_setent (int stayopen)
# endif
{
flags |= FD_CLOEXEC;
- result = fcntl (fileno (stream), F_SETFD, flags);
+ result = fcntl (fileno (*stream), F_SETFD, flags);
}
}
if (result < 0)
{
/* Something went wrong. Close the stream and return a
failure. */
- fclose (stream);
- stream = NULL;
+ fclose (*stream);
+ *stream = NULL;
status = NSS_STATUS_UNAVAIL;
}
}
@@ -116,11 +113,7 @@ internal_setent (int stayopen)
}
}
else
- rewind (stream);
-
- /* Remember STAYOPEN flag. */
- if (stream != NULL)
- keep_stream |= stayopen;
+ rewind (*stream);
return status;
}
@@ -134,16 +127,7 @@ CONCAT(_nss_files_set,ENTNAME) (int stay
__libc_lock_lock (lock);
- status = internal_setent (stayopen);
-
- if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
- {
- fclose (stream);
- stream = NULL;
- status = NSS_STATUS_UNAVAIL;
- }
-
- last_use = getent;
+ status = internal_setent (&stream);
__libc_lock_unlock (lock);
@@ -153,12 +137,12 @@ CONCAT(_nss_files_set,ENTNAME) (int stay
/* Close the database file. */
static void
-internal_endent (void)
+internal_endent (FILE **stream)
{
- if (stream != NULL)
+ if (*stream != NULL)
{
- fclose (stream);
- stream = NULL;
+ fclose (*stream);
+ *stream = NULL;
}
}
@@ -169,10 +153,7 @@ CONCAT(_nss_files_end,ENTNAME) (void)
{
__libc_lock_lock (lock);
- internal_endent ();
-
- /* Reset STAYOPEN flag. */
- keep_stream = 0;
+ internal_endent (&stream);
__libc_lock_unlock (lock);
@@ -227,7 +208,7 @@ get_contents (char *linebuf, size_t len,
/* Parsing the database file into `struct STRUCTURE' data structures. */
static enum nss_status
-internal_getent (struct STRUCTURE *result,
+internal_getent (FILE *stream, struct STRUCTURE *result,
char *buffer, size_t buflen, int *errnop H_ERRNO_PROTO
EXTRA_ARGS_DECL)
{
@@ -300,45 +281,14 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct
{
int save_errno = errno;
- status = internal_setent (0);
+ status = internal_setent (&stream);
__set_errno (save_errno);
-
- if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
- {
- fclose (stream);
- stream = NULL;
- status = NSS_STATUS_UNAVAIL;
- }
}
if (status == NSS_STATUS_SUCCESS)
- {
- /* If the last use was not by the getent function we need the
- position the stream. */
- if (last_use != getent)
- {
- if (fsetpos (stream, &position) < 0)
- status = NSS_STATUS_UNAVAIL;
- else
- last_use = getent;
- }
-
- if (status == NSS_STATUS_SUCCESS)
- {
- status = internal_getent (result, buffer, buflen, errnop
- H_ERRNO_ARG EXTRA_ARGS_VALUE);
-
- /* Remember this position if we were successful. If the
- operation failed we give the user a chance to repeat the
- operation (perhaps the buffer was too small). */
- if (status == NSS_STATUS_SUCCESS)
- fgetpos (stream, &position);
- else
- /* We must make sure we reposition the stream the next call. */
- last_use = nouse;
- }
- }
+ status = internal_getent (stream, result, buffer, buflen, errnop
+ H_ERRNO_ARG EXTRA_ARGS_VALUE);
__libc_lock_unlock (lock);
@@ -364,27 +314,20 @@ _nss_files_get##name##_r (proto,
size_t buflen, int *errnop H_ERRNO_PROTO) \
{ \
enum nss_status status; \
+ FILE *stream = NULL; \
\
- __libc_lock_lock (lock); \
- \
- /* Reset file pointer to beginning or open file. */ \
- status = internal_setent (keep_stream); \
+ /* Open file. */ \
+ status = internal_setent (&stream); \
\
if (status == NSS_STATUS_SUCCESS) \
{ \
- /* Tell getent function that we have repositioned the file pointer. */ \
- last_use = getby; \
- \
- while ((status = internal_getent (result, buffer, buflen, errnop \
+ while ((status = internal_getent (stream, result, buffer, buflen, errnop \
H_ERRNO_ARG EXTRA_ARGS_VALUE)) \
== NSS_STATUS_SUCCESS) \
{ break_if_match } \
\
- if (! keep_stream) \
- internal_endent (); \
+ internal_endent (&stream); \
} \
\
- __libc_lock_unlock (lock); \
- \
return status; \
}
Index: glibc-2.21/nss/nss_files/files-alias.c
===================================================================
--- glibc-2.21.orig/nss/nss_files/files-alias.c
+++ glibc-2.21/nss/nss_files/files-alias.c
@@ -36,20 +36,18 @@ __libc_lock_define_initialized (static,
/* Maintenance of the shared stream open on the database file. */
static FILE *stream;
-static fpos_t position;
-static enum { nouse, getent, getby } last_use;
static enum nss_status
-internal_setent (void)
+internal_setent (FILE **stream)
{
enum nss_status status = NSS_STATUS_SUCCESS;
- if (stream == NULL)
+ if (*stream == NULL)
{
- stream = fopen ("/etc/aliases", "rce");
+ *stream = fopen ("/etc/aliases", "rce");
- if (stream == NULL)
+ if (*stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
@@ -62,7 +60,7 @@ internal_setent (void)
int result;
int flags;
- result = flags = fcntl (fileno (stream), F_GETFD, 0);
+ result = flags = fcntl (fileno (*stream), F_GETFD, 0);
if (result >= 0)
{
# ifdef O_CLOEXEC
@@ -72,14 +70,14 @@ internal_setent (void)
# endif
{
flags |= FD_CLOEXEC;
- result = fcntl (fileno (stream), F_SETFD, flags);
+ result = fcntl (fileno (*stream), F_SETFD, flags);
}
}
if (result < 0)
{
/* Something went wrong. Close the stream and return a
failure. */
- fclose (stream);
+ fclose (*stream);
stream = NULL;
status = NSS_STATUS_UNAVAIL;
}
@@ -88,7 +86,7 @@ internal_setent (void)
}
}
else
- rewind (stream);
+ rewind (*stream);
return status;
}
@@ -102,16 +100,7 @@ _nss_files_setaliasent (void)
__libc_lock_lock (lock);
- status = internal_setent ();
-
- if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
- {
- fclose (stream);
- stream = NULL;
- status = NSS_STATUS_UNAVAIL;
- }
-
- last_use = getent;
+ status = internal_setent (&stream);
__libc_lock_unlock (lock);
@@ -121,12 +110,12 @@ _nss_files_setaliasent (void)
/* Close the database file. */
static void
-internal_endent (void)
+internal_endent (FILE **stream)
{
- if (stream != NULL)
+ if (*stream != NULL)
{
- fclose (stream);
- stream = NULL;
+ fclose (*stream);
+ *stream = NULL;
}
}
@@ -137,7 +126,7 @@ _nss_files_endaliasent (void)
{
__libc_lock_lock (lock);
- internal_endent ();
+ internal_endent (&stream);
__libc_lock_unlock (lock);
@@ -146,7 +135,7 @@ _nss_files_endaliasent (void)
/* Parsing the database file into `struct aliasent' data structures. */
static enum nss_status
-get_next_alias (const char *match, struct aliasent *result,
+get_next_alias (FILE *stream, const char *match, struct aliasent *result,
char *buffer, size_t buflen, int *errnop)
{
enum nss_status status = NSS_STATUS_NOTFOUND;
@@ -397,35 +386,16 @@ _nss_files_getaliasent_r (struct aliasen
/* Be prepared that the set*ent function was not called before. */
if (stream == NULL)
- status = internal_setent ();
+ status = internal_setent (&stream);
if (status == NSS_STATUS_SUCCESS)
{
- /* If the last use was not by the getent function we need the
- position the stream. */
- if (last_use != getent)
- {
- if (fsetpos (stream, &position) < 0)
- status = NSS_STATUS_UNAVAIL;
- else
- last_use = getent;
- }
-
- if (status == NSS_STATUS_SUCCESS)
- {
- result->alias_local = 1;
+ result->alias_local = 1;
- /* Read lines until we get a definite result. */
- do
- status = get_next_alias (NULL, result, buffer, buflen, errnop);
- while (status == NSS_STATUS_RETURN);
-
- /* If we successfully read an entry remember this position. */
- if (status == NSS_STATUS_SUCCESS)
- fgetpos (stream, &position);
- else
- last_use = nouse;
- }
+ /* Read lines until we get a definite result. */
+ do
+ status = get_next_alias (stream, NULL, result, buffer, buflen, errnop);
+ while (status == NSS_STATUS_RETURN);
}
__libc_lock_unlock (lock);
@@ -440,6 +410,7 @@ _nss_files_getaliasbyname_r (const char
{
/* Return next entry in host file. */
enum nss_status status = NSS_STATUS_SUCCESS;
+ FILE *stream = NULL;
if (name == NULL)
{
@@ -447,11 +418,8 @@ _nss_files_getaliasbyname_r (const char
return NSS_STATUS_UNAVAIL;
}
- __libc_lock_lock (lock);
-
- /* Open the stream or rest it. */
- status = internal_setent ();
- last_use = getby;
+ /* Open the stream. */
+ status = internal_setent (&stream);
if (status == NSS_STATUS_SUCCESS)
{
@@ -459,13 +427,11 @@ _nss_files_getaliasbyname_r (const char
/* Read lines until we get a definite result. */
do
- status = get_next_alias (name, result, buffer, buflen, errnop);
+ status = get_next_alias (stream, name, result, buffer, buflen, errnop);
while (status == NSS_STATUS_RETURN);
}
- internal_endent ();
-
- __libc_lock_unlock (lock);
+ internal_endent (&stream);
return status;
}
Index: glibc-2.21/nss/nss_files/files-hosts.c
===================================================================
--- glibc-2.21.orig/nss/nss_files/files-hosts.c
+++ glibc-2.21/nss/nss_files/files-hosts.c
@@ -115,14 +115,13 @@ _nss_files_gethostbyname3_r (const char
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp, char **canonp)
{
+ FILE *stream = NULL;
uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data);
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- __libc_lock_lock (lock);
-
- /* Reset file pointer to beginning or open file. */
- enum nss_status status = internal_setent (keep_stream);
+ /* Open file. */
+ enum nss_status status = internal_setent (&stream);
if (status == NSS_STATUS_SUCCESS)
{
@@ -130,10 +129,7 @@ _nss_files_gethostbyname3_r (const char
addresses to IPv6 addresses really the right thing to do? */
int flags = ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0);
- /* Tell getent function that we have repositioned the file pointer. */
- last_use = getby;
-
- while ((status = internal_getent (result, buffer, buflen, errnop,
+ while ((status = internal_getent (stream, result, buffer, buflen, errnop,
herrnop, af, flags))
== NSS_STATUS_SUCCESS)
{
@@ -160,7 +156,7 @@ _nss_files_gethostbyname3_r (const char
bufferend = (char *) &result->h_aliases[naliases + 1];
again:
- while ((status = internal_getent (&tmp_result_buf, tmp_buffer,
+ while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer,
tmp_buflen, errnop, herrnop, af,
flags))
== NSS_STATUS_SUCCESS)
@@ -336,15 +332,12 @@ _nss_files_gethostbyname3_r (const char
free (tmp_buffer);
}
- if (! keep_stream)
- internal_endent ();
+ internal_endent (&stream);
}
if (canonp && status == NSS_STATUS_SUCCESS)
*canonp = result->h_name;
- __libc_lock_unlock (lock);
-
return status;
}
@@ -373,16 +366,13 @@ _nss_files_gethostbyname4_r (const char
char *buffer, size_t buflen, int *errnop,
int *herrnop, int32_t *ttlp)
{
- __libc_lock_lock (lock);
+ FILE *stream = NULL;
- /* Reset file pointer to beginning or open file. */
- enum nss_status status = internal_setent (keep_stream);
+ /* Open file. */
+ enum nss_status status = internal_setent (&stream);
if (status == NSS_STATUS_SUCCESS)
{
- /* Tell getent function that we have repositioned the file pointer. */
- last_use = getby;
-
bool any = false;
bool got_canon = false;
while (1)
@@ -394,7 +384,7 @@ _nss_files_gethostbyname4_r (const char
buflen = buflen > pad ? buflen - pad : 0;
struct hostent result;
- status = internal_getent (&result, buffer, buflen, errnop,
+ status = internal_getent (stream, &result, buffer, buflen, errnop,
herrnop, AF_UNSPEC, 0);
if (status != NSS_STATUS_SUCCESS)
break;
@@ -470,8 +460,7 @@ _nss_files_gethostbyname4_r (const char
status = NSS_STATUS_SUCCESS;
}
- if (! keep_stream)
- internal_endent ();
+ internal_endent (&stream);
}
else if (status == NSS_STATUS_TRYAGAIN)
{
@@ -484,7 +473,5 @@ _nss_files_gethostbyname4_r (const char
*herrnop = NO_DATA;
}
- __libc_lock_unlock (lock);
-
return status;
}

View File

@ -1,29 +0,0 @@
From 127ffc81a8565bebd134c0f43afba5ae7997bf97 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Sun, 1 Feb 2015 14:04:15 +0100
Subject: [PATCH] Fix value of O_TMPFILE for architectures with non-default
O_DIRECTORY
[BZ #17912]
* sysdeps/unix/sysv/linux/bits/fcntl-linux.h (__O_TMPFILE): Define
in terms of __O_DIRECTORY.
---
sysdeps/unix/sysv/linux/bits/fcntl-linux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
index 3d28c84..d2baeb3 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h
@@ -97,7 +97,7 @@
# define __O_DSYNC 010000
#endif
#ifndef __O_TMPFILE
-# define __O_TMPFILE 020200000
+# define __O_TMPFILE (020000000 | __O_DIRECTORY)
#endif
#ifndef F_GETLK
--
2.2.2

View File

@ -0,0 +1,16 @@
Index: glibc-2.22/sysdeps/unix/sysv/linux/openat.c
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/openat.c
+++ glibc-2.22/sysdeps/unix/sysv/linux/openat.c
@@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int
va_end (arg);
}
+ /* We have to add the O_LARGEFILE flag for openat64. */
+#ifdef MORE_OFLAGS
+ oflag |= MORE_OFLAGS;
+#endif
+
return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
}
libc_hidden_def (__OPENAT)

View File

@ -1,117 +0,0 @@
2015-02-13 Joseph Myers <joseph@codesourcery.com>
[BZ #17967]
* sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Use
__builtin_fmaf instead of relying on contraction of a * b + c.
2015-02-12 Joseph Myers <joseph@codesourcery.com>
[BZ #17964]
* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Use
__builtin_fma instead of relying on contraction of a * b + c.
Index: glibc-2.21/sysdeps/powerpc/fpu/e_sqrt.c
===================================================================
--- glibc-2.21.orig/sysdeps/powerpc/fpu/e_sqrt.c
+++ glibc-2.21/sysdeps/powerpc/fpu/e_sqrt.c
@@ -99,38 +99,41 @@ __slow_ieee754_sqrt (double x)
/* Here we have three Newton-Raphson iterations each of a
division and a square root and the remainder of the
argument reduction, all interleaved. */
- sd = -(sg * sg - sx);
+ sd = -__builtin_fma (sg, sg, -sx);
fsgi = (xi0 + 0x40000000) >> 1 & 0x7ff00000;
sy2 = sy + sy;
- sg = sy * sd + sg; /* 16-bit approximation to sqrt(sx). */
+ sg = __builtin_fma (sy, sd, sg); /* 16-bit approximation to
+ sqrt(sx). */
/* schedule the INSERT_WORDS (fsg, fsgi, 0) to get separation
between the store and the load. */
INSERT_WORDS (fsg, fsgi, 0);
iw_u.parts.msw = fsgi;
iw_u.parts.lsw = (0);
- e = -(sy * sg - almost_half);
- sd = -(sg * sg - sx);
+ e = -__builtin_fma (sy, sg, -almost_half);
+ sd = -__builtin_fma (sg, sg, -sx);
if ((xi0 & 0x7ff00000) == 0)
goto denorm;
- sy = sy + e * sy2;
- sg = sg + sy * sd; /* 32-bit approximation to sqrt(sx). */
+ sy = __builtin_fma (e, sy2, sy);
+ sg = __builtin_fma (sy, sd, sg); /* 32-bit approximation to
+ sqrt(sx). */
sy2 = sy + sy;
/* complete the INSERT_WORDS (fsg, fsgi, 0) operation. */
fsg = iw_u.value;
- e = -(sy * sg - almost_half);
- sd = -(sg * sg - sx);
- sy = sy + e * sy2;
+ e = -__builtin_fma (sy, sg, -almost_half);
+ sd = -__builtin_fma (sg, sg, -sx);
+ sy = __builtin_fma (e, sy2, sy);
shx = sx * fsg;
- sg = sg + sy * sd; /* 64-bit approximation to sqrt(sx),
- but perhaps rounded incorrectly. */
+ sg = __builtin_fma (sy, sd, sg); /* 64-bit approximation to
+ sqrt(sx), but perhaps
+ rounded incorrectly. */
sy2 = sy + sy;
g = sg * fsg;
- e = -(sy * sg - almost_half);
- d = -(g * sg - shx);
- sy = sy + e * sy2;
+ e = -__builtin_fma (sy, sg, -almost_half);
+ d = -__builtin_fma (g, sg, -shx);
+ sy = __builtin_fma (e, sy2, sy);
fesetenv_register (fe);
- return g + sy * d;
+ return __builtin_fma (sy, d, g);
denorm:
/* For denormalised numbers, we normalise, calculate the
square root, and return an adjusted result. */
Index: glibc-2.21/sysdeps/powerpc/fpu/e_sqrtf.c
===================================================================
--- glibc-2.21.orig/sysdeps/powerpc/fpu/e_sqrtf.c
+++ glibc-2.21/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -87,26 +87,28 @@ __slow_ieee754_sqrtf (float x)
/* Here we have three Newton-Raphson iterations each of a
division and a square root and the remainder of the
argument reduction, all interleaved. */
- sd = -(sg * sg - sx);
+ sd = -__builtin_fmaf (sg, sg, -sx);
fsgi = (xi + 0x40000000) >> 1 & 0x7f800000;
sy2 = sy + sy;
- sg = sy * sd + sg; /* 16-bit approximation to sqrt(sx). */
- e = -(sy * sg - almost_half);
+ sg = __builtin_fmaf (sy, sd, sg); /* 16-bit approximation to
+ sqrt(sx). */
+ e = -__builtin_fmaf (sy, sg, -almost_half);
SET_FLOAT_WORD (fsg, fsgi);
- sd = -(sg * sg - sx);
- sy = sy + e * sy2;
+ sd = -__builtin_fmaf (sg, sg, -sx);
+ sy = __builtin_fmaf (e, sy2, sy);
if ((xi & 0x7f800000) == 0)
goto denorm;
shx = sx * fsg;
- sg = sg + sy * sd; /* 32-bit approximation to sqrt(sx),
- but perhaps rounded incorrectly. */
+ sg = __builtin_fmaf (sy, sd, sg); /* 32-bit approximation to
+ sqrt(sx), but perhaps
+ rounded incorrectly. */
sy2 = sy + sy;
g = sg * fsg;
- e = -(sy * sg - almost_half);
- d = -(g * sg - shx);
- sy = sy + e * sy2;
+ e = -__builtin_fmaf (sy, sg, -almost_half);
+ d = -__builtin_fmaf (g, sg, -shx);
+ sy = __builtin_fmaf (e, sy2, sy);
fesetenv_register (fe);
- return g + sy * d;
+ return __builtin_fmaf (sy, d, g);
denorm:
/* For denormalised numbers, we normalise, calculate the
square root, and return an adjusted result. */

View File

@ -1,152 +0,0 @@
[PR dynamic-link/18457]
* elf/dl-tls.c (tls_get_addr_tail): Don't take the rtld lock
if we already have a final static TLS offset.
* nptl/tst-join7.c, nptl/tst-join7mod.c: New.
Index: glibc-2.21/elf/dl-tls.c
===================================================================
--- glibc-2.21.orig/elf/dl-tls.c
+++ glibc-2.21/elf/dl-tls.c
@@ -755,30 +755,44 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t
the_map = listp->slotinfo[idx].map;
}
- /* Make sure that, if a dlopen running in parallel forces the
- variable into static storage, we'll wait until the address in the
- static TLS block is set up, and use that. If we're undecided
- yet, make sure we make the decision holding the lock as well. */
- if (__glibc_unlikely (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET))
+ /* If the TLS block for the map is already assigned to dynamic or to
+ static TLS, avoid the lock. Be careful to use the same value for
+ both tests; if we reloaded it, the second test might mistake
+ forced dynamic for an offset. Now, if the decision hasn't been
+ made, take the rtld lock, so that an ongoing dlopen gets a chance
+ to complete, and then retest; if the decision is still pending,
+ force the module to dynamic TLS. */
+ ptrdiff_t offset = atomic_load_relaxed (&the_map->l_tls_offset);
+ if (__glibc_unlikely (offset != FORCED_DYNAMIC_TLS_OFFSET))
{
+ if (__glibc_unlikely (offset != NO_TLS_OFFSET))
+ goto static_tls;
__rtld_lock_lock_recursive (GL(dl_load_lock));
- if (__glibc_likely (the_map->l_tls_offset == NO_TLS_OFFSET))
+ offset = the_map->l_tls_offset;
+ if (__glibc_likely (offset == NO_TLS_OFFSET))
{
the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
- else if (__glibc_likely (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET))
+ else if (__glibc_likely (offset != FORCED_DYNAMIC_TLS_OFFSET))
{
+ /* The decision is made, and it is final. We use the value
+ we've already loaded, but we could even load the offset
+ after releasing the lock, since it won't change. Should
+ the module be released while another thread references
+ one of its TLS variables, that's undefined behavior. */
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
+
+ static_tls:
+ ;
+
#if TLS_TCB_AT_TP
- void *p = (char *) THREAD_SELF - the_map->l_tls_offset;
+ void *p = (char *) THREAD_SELF - offset;
#elif TLS_DTV_AT_TP
- void *p = (char *) THREAD_SELF + the_map->l_tls_offset + TLS_PRE_TCB_SIZE;
+ void *p = (char *) THREAD_SELF + offset + TLS_PRE_TCB_SIZE;
#else
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
- __rtld_lock_unlock_recursive (GL(dl_load_lock));
dtv[GET_ADDR_MODULE].pointer.is_static = true;
dtv[GET_ADDR_MODULE].pointer.val = p;
Index: glibc-2.21/nptl/Makefile
===================================================================
--- glibc-2.21.orig/nptl/Makefile
+++ glibc-2.21/nptl/Makefile
@@ -234,7 +234,7 @@ tests = tst-typesizes \
tst-basic7 \
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
tst-raise1 \
- tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 \
+ tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 tst-join6 tst-join7 \
tst-detach1 \
tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 tst-tsd6 \
@@ -312,7 +312,8 @@ endif
modules-names = tst-atfork2mod tst-tls3mod tst-tls4moda tst-tls4modb \
tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \
tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \
- tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod
+ tst-_res1mod1 tst-_res1mod2 tst-execstack-mod tst-fini1mod \
+ tst-join7mod
extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) tst-cleanup4aux.o
test-extras += $(modules-names) tst-cleanup4aux
test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(modules-names)))
@@ -517,6 +518,11 @@ $(objpfx)tst-tls6.out: tst-tls6.sh $(obj
$(evaluate-test)
endif
+$(objpfx)tst-join7: $(libdl) $(shared-thread-library)
+$(objpfx)tst-join7.out: $(objpfx)tst-join7mod.so
+$(objpfx)tst-join7mod.so: $(shared-thread-library)
+LDFLAGS-tst-join7mod.so = -Wl,-soname,tst-join7mod.so
+
$(objpfx)tst-dlsym1: $(libdl) $(shared-thread-library)
$(objpfx)tst-fini1: $(shared-thread-library) $(objpfx)tst-fini1mod.so
Index: glibc-2.21/nptl/tst-join7.c
===================================================================
--- /dev/null
+++ glibc-2.21/nptl/tst-join7.c
@@ -0,0 +1,12 @@
+#include <dlfcn.h>
+
+int
+do_test (void)
+{
+ void *f = dlopen ("tst-join7mod.so", RTLD_NOW | RTLD_GLOBAL);
+ if (f) dlclose (f); else return 1;
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Index: glibc-2.21/nptl/tst-join7mod.c
===================================================================
--- /dev/null
+++ glibc-2.21/nptl/tst-join7mod.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <pthread.h>
+
+static pthread_t th;
+static int running = 1;
+
+static void *
+test_run (void *p)
+{
+ while (running)
+ fprintf (stderr, "XXX test_run\n");
+ fprintf (stderr, "XXX test_run FINISHED\n");
+ return NULL;
+}
+
+static void __attribute__ ((constructor))
+do_init (void)
+{
+ pthread_create (&th, NULL, test_run, NULL);
+}
+
+static void __attribute__ ((destructor))
+do_end (void)
+{
+ running = 0;
+ fprintf (stderr, "thread_join...\n");
+ pthread_join (th, NULL);
+ fprintf (stderr, "thread_join DONE\n");
+}

View File

@ -1,111 +0,0 @@
From 867dbf6ba31c0a0f5c0366f9ed71b0afc3727a23 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Mon, 11 Aug 2014 11:18:26 +0200
Subject: [PATCH] Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in
pthread_mutexattr_gettype (BZ #15790)
[BZ #15790]
* nptl/pthread_mutexattr_gettype.c (pthread_mutexattr_gettype):
Filter out PTHREAD_MUTEX_NO_ELISION_NP from value returned in
kind.
* nptl/Makefile (tests): Add tst-pthread-mutexattr.
* nptl/tst-pthread-mutexattr.c: New file.
---
nptl/Makefile | 2 +-
nptl/pthread_mutexattr_gettype.c | 3 +-
nptl/tst-pthread-mutexattr.c | 60 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 nptl/tst-pthread-mutexattr.c
Index: glibc-2.19/nptl/Makefile
===================================================================
--- glibc-2.19.orig/nptl/Makefile
+++ glibc-2.19/nptl/Makefile
@@ -253,7 +253,7 @@ tests = tst-typesizes \
tst-exit1 tst-exit2 tst-exit3 \
tst-stdio1 tst-stdio2 \
tst-stack1 tst-stack2 tst-stack3 tst-stack4 tst-pthread-getattr \
- tst-pthread-attr-affinity \
+ tst-pthread-attr-affinity tst-pthread-mutexattr \
tst-unload \
tst-dlsym1 \
tst-sysconf \
Index: glibc-2.19/nptl/pthread_mutexattr_gettype.c
===================================================================
--- glibc-2.19.orig/nptl/pthread_mutexattr_gettype.c
+++ glibc-2.19/nptl/pthread_mutexattr_gettype.c
@@ -28,7 +28,8 @@ pthread_mutexattr_gettype (attr, kind)
iattr = (const struct pthread_mutexattr *) attr;
- *kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
+ *kind = (iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS
+ & ~PTHREAD_MUTEX_NO_ELISION_NP);
return 0;
}
Index: glibc-2.19/nptl/tst-pthread-mutexattr.c
===================================================================
--- /dev/null
+++ glibc-2.19/nptl/tst-pthread-mutexattr.c
@@ -0,0 +1,60 @@
+/* Make sure that pthread_mutexattr_gettype returns a valid kind.
+
+ Copyright (C) 2014 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+
+static int
+do_test (void)
+{
+ pthread_mutexattr_t attr;
+ int kind;
+ int error;
+
+ error = pthread_mutexattr_init (&attr);
+ if (error)
+ {
+ printf ("pthread_mutexattr_init: %s\n", strerror (error));
+ return 1;
+ }
+ error = pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_DEFAULT);
+ if (error)
+ {
+ printf ("pthread_mutexattr_settype (1): %s\n", strerror (error));
+ return 1;
+ }
+ error = pthread_mutexattr_gettype (&attr, &kind);
+ if (error)
+ {
+ printf ("pthread_mutexattr_gettype: %s\n", strerror (error));
+ return 1;
+ }
+ error = pthread_mutexattr_settype (&attr, kind);
+ if (error)
+ {
+ printf ("pthread_mutexattr_settype (2): %s\n", strerror (error));
+ return 1;
+ }
+ return 0;
+}
+
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

View File

@ -1,426 +0,0 @@
From 6c07233f12e00b9cf66fb5d4a9b7ddb897590912 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 19 Feb 2015 15:52:08 +0100
Subject: [PATCH] Simplify handling of nameserver configuration in resolver
[BZ #13028]
[BZ #17053]
* resolv/res_init.c (__res_vinit): Remove use of ext.nsmap.
* resolv/res_send.c (__libc_res_nsend): Likewise.
(get_nsaddr): New function.
(res_ourserver_p, send_vc, reopen): Use it instead of accessing
statp directly.
---
resolv/res_init.c | 47 +++++-----------
resolv/res_send.c | 164 +++++++++++++++++++++++-------------------------------
2 files changed, 84 insertions(+), 127 deletions(-)
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 553ba12..66561ff 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -153,10 +153,8 @@ __res_vinit(res_state statp, int preinit) {
char *cp, **pp;
int n;
char buf[BUFSIZ];
- int nserv = 0; /* number of IPv4 nameservers read from file */
-#ifdef _LIBC
- int nservall = 0; /* number of (IPv4 + IPV6) nameservers read from file */
-#endif
+ int nserv = 0; /* number of nameservers read from file */
+ int have_serv6 = 0;
int haveenv = 0;
int havesearch = 0;
#ifdef RESOLVSORT
@@ -184,15 +182,9 @@ __res_vinit(res_state statp, int preinit) {
statp->_flags = 0;
statp->qhook = NULL;
statp->rhook = NULL;
- statp->_u._ext.nsinit = 0;
statp->_u._ext.nscount = 0;
-#ifdef _LIBC
- statp->_u._ext.nscount6 = 0;
- for (n = 0; n < MAXNS; n++) {
- statp->_u._ext.nsaddrs[n] = NULL;
- statp->_u._ext.nsmap[n] = MAXNS;
- }
-#endif
+ for (n = 0; n < MAXNS; n++)
+ statp->_u._ext.nsaddrs[n] = NULL;
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
@@ -296,11 +288,7 @@ __res_vinit(res_state statp, int preinit) {
continue;
}
/* read nameservers to query */
-#ifdef _LIBC
- if (MATCH(buf, "nameserver") && nservall < MAXNS) {
-#else
if (MATCH(buf, "nameserver") && nserv < MAXNS) {
-#endif
struct in_addr a;
cp = buf + sizeof("nameserver") - 1;
@@ -308,13 +296,12 @@ __res_vinit(res_state statp, int preinit) {
cp++;
if ((*cp != '\0') && (*cp != '\n')
&& __inet_aton(cp, &a)) {
- statp->nsaddr_list[nservall].sin_addr = a;
- statp->nsaddr_list[nservall].sin_family = AF_INET;
- statp->nsaddr_list[nservall].sin_port =
+ statp->nsaddr_list[nserv].sin_addr = a;
+ statp->nsaddr_list[nserv].sin_family = AF_INET;
+ statp->nsaddr_list[nserv].sin_port =
htons(NAMESERVER_PORT);
nserv++;
#ifdef _LIBC
- nservall++;
} else {
struct in6_addr a6;
char *el;
@@ -356,10 +343,11 @@ __res_vinit(res_state statp, int preinit) {
}
}
- statp->_u._ext.nsaddrs[nservall] = sa6;
- statp->_u._ext.nssocks[nservall] = -1;
- statp->_u._ext.nsmap[nservall] = MAXNS + 1;
- nservall++;
+ statp->nsaddr_list[nserv].sin_family = 0;
+ statp->_u._ext.nsaddrs[nserv] = sa6;
+ statp->_u._ext.nssocks[nserv] = -1;
+ have_serv6 = 1;
+ nserv++;
}
}
#endif
@@ -414,10 +402,9 @@ __res_vinit(res_state statp, int preinit) {
continue;
}
}
- statp->nscount = nservall;
+ statp->nscount = nserv;
#ifdef _LIBC
- if (nservall - nserv > 0) {
- statp->_u._ext.nscount6 = nservall - nserv;
+ if (have_serv6) {
/* We try IPv6 servers again. */
statp->ipv6_unavail = false;
}
@@ -606,11 +593,7 @@ __res_iclose(res_state statp, bool free_addr) {
statp->_vcsock = -1;
statp->_flags &= ~(RES_F_VC | RES_F_CONN);
}
-#ifdef _LIBC
- for (ns = 0; ns < MAXNS; ns++)
-#else
for (ns = 0; ns < statp->_u._ext.nscount; ns++)
-#endif
if (statp->_u._ext.nsaddrs[ns]) {
if (statp->_u._ext.nssocks[ns] != -1) {
close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
@@ -621,8 +604,6 @@ __res_iclose(res_state statp, bool free_addr) {
statp->_u._ext.nsaddrs[ns] = NULL;
}
}
- if (free_addr)
- statp->_u._ext.nsinit = 0;
}
libc_hidden_def (__res_iclose)
diff --git a/resolv/res_send.c b/resolv/res_send.c
index c35fb66..5e53cc2 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -184,6 +184,7 @@ evNowTime(struct timespec *res) {
/* Forward. */
+static struct sockaddr *get_nsaddr (res_state, int);
static int send_vc(res_state, const u_char *, int,
const u_char *, int,
u_char **, int *, int *, int, u_char **,
@@ -221,20 +222,21 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
in_port_t port = in4p->sin_port;
in_addr_t addr = in4p->sin_addr.s_addr;
- for (ns = 0; ns < MAXNS; ns++) {
+ for (ns = 0; ns < statp->nscount; ns++) {
const struct sockaddr_in *srv =
- (struct sockaddr_in *)EXT(statp).nsaddrs[ns];
+ (struct sockaddr_in *) get_nsaddr (statp, ns);
- if ((srv != NULL) && (srv->sin_family == AF_INET) &&
+ if ((srv->sin_family == AF_INET) &&
(srv->sin_port == port) &&
(srv->sin_addr.s_addr == INADDR_ANY ||
srv->sin_addr.s_addr == addr))
return (1);
}
} else if (inp->sin6_family == AF_INET6) {
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
+ for (ns = 0; ns < statp->nscount; ns++) {
+ const struct sockaddr_in6 *srv
+ = (struct sockaddr_in6 *) get_nsaddr (statp, ns);
+ if ((srv->sin6_family == AF_INET6) &&
(srv->sin6_port == inp->sin6_port) &&
!(memcmp(&srv->sin6_addr, &in6addr_any,
sizeof (struct in6_addr)) &&
@@ -384,80 +386,48 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
* If the ns_addr_list in the resolver context has changed, then
* invalidate our cached copy and the associated timing data.
*/
- if (EXT(statp).nsinit) {
+ if (EXT(statp).nscount != 0) {
int needclose = 0;
if (EXT(statp).nscount != statp->nscount)
needclose++;
else
- for (ns = 0; ns < MAXNS; ns++) {
- unsigned int map = EXT(statp).nsmap[ns];
- if (map < MAXNS
+ for (ns = 0; ns < statp->nscount; ns++) {
+ if (statp->nsaddr_list[ns].sin_family != 0
&& !sock_eq((struct sockaddr_in6 *)
- &statp->nsaddr_list[map],
+ &statp->nsaddr_list[ns],
EXT(statp).nsaddrs[ns]))
{
needclose++;
break;
}
}
- if (needclose)
+ if (needclose) {
__res_iclose(statp, false);
+ EXT(statp).nscount = 0;
+ }
}
/*
* Maybe initialize our private copy of the ns_addr_list.
*/
- if (EXT(statp).nsinit == 0) {
- unsigned char map[MAXNS];
-
- memset (map, MAXNS, sizeof (map));
- for (n = 0; n < MAXNS; n++) {
- ns = EXT(statp).nsmap[n];
- if (ns < statp->nscount)
- map[ns] = n;
- else if (ns < MAXNS) {
- free(EXT(statp).nsaddrs[n]);
- EXT(statp).nsaddrs[n] = NULL;
- EXT(statp).nsmap[n] = MAXNS;
- }
- }
- n = statp->nscount;
- if (statp->nscount > EXT(statp).nscount)
- for (n = EXT(statp).nscount, ns = 0;
- n < statp->nscount; n++) {
- while (ns < MAXNS
- && EXT(statp).nsmap[ns] != MAXNS)
- ns++;
- if (ns == MAXNS)
- break;
- /* NS never exceeds MAXNS, but gcc 4.9 somehow
- does not see this. */
- DIAG_PUSH_NEEDS_COMMENT;
- DIAG_IGNORE_NEEDS_COMMENT (4.9,
- "-Warray-bounds");
- EXT(statp).nsmap[ns] = n;
- DIAG_POP_NEEDS_COMMENT;
- map[n] = ns++;
- }
- EXT(statp).nscount = n;
- for (ns = 0; ns < EXT(statp).nscount; ns++) {
- n = map[ns];
- if (EXT(statp).nsaddrs[n] == NULL)
- EXT(statp).nsaddrs[n] =
+ if (EXT(statp).nscount == 0) {
+ for (ns = 0; ns < statp->nscount; ns++) {
+ EXT(statp).nssocks[ns] = -1;
+ if (statp->nsaddr_list[ns].sin_family == 0)
+ continue;
+ if (EXT(statp).nsaddrs[ns] == NULL)
+ EXT(statp).nsaddrs[ns] =
malloc(sizeof (struct sockaddr_in6));
- if (EXT(statp).nsaddrs[n] != NULL) {
- memset (mempcpy(EXT(statp).nsaddrs[n],
+ if (EXT(statp).nsaddrs[ns] != NULL)
+ memset (mempcpy(EXT(statp).nsaddrs[ns],
&statp->nsaddr_list[ns],
sizeof (struct sockaddr_in)),
'\0',
sizeof (struct sockaddr_in6)
- sizeof (struct sockaddr_in));
- EXT(statp).nssocks[n] = -1;
- n++;
- }
}
- EXT(statp).nsinit = 1;
+ EXT(statp).nscount = statp->nscount;
}
/*
@@ -466,44 +436,37 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
*/
if (__builtin_expect ((statp->options & RES_ROTATE) != 0, 0) &&
(statp->options & RES_BLAST) == 0) {
- struct sockaddr_in6 *ina;
- unsigned int map;
-
- n = 0;
- while (n < MAXNS && EXT(statp).nsmap[n] == MAXNS)
- n++;
- if (n < MAXNS) {
- ina = EXT(statp).nsaddrs[n];
- map = EXT(statp).nsmap[n];
- for (;;) {
- ns = n + 1;
- while (ns < MAXNS
- && EXT(statp).nsmap[ns] == MAXNS)
- ns++;
- if (ns == MAXNS)
- break;
- EXT(statp).nsaddrs[n] = EXT(statp).nsaddrs[ns];
- EXT(statp).nsmap[n] = EXT(statp).nsmap[ns];
- n = ns;
- }
- EXT(statp).nsaddrs[n] = ina;
- EXT(statp).nsmap[n] = map;
+ struct sockaddr_in ina;
+ struct sockaddr_in6 *inp;
+ int lastns = statp->nscount - 1;
+ int fd;
+
+ inp = EXT(statp).nsaddrs[0];
+ ina = statp->nsaddr_list[0];
+ fd = EXT(statp).nssocks[0];
+ for (ns = 0; ns < lastns; ns++) {
+ EXT(statp).nsaddrs[ns] = EXT(statp).nsaddrs[ns + 1];
+ statp->nsaddr_list[ns] = statp->nsaddr_list[ns + 1];
+ EXT(statp).nssocks[ns] = EXT(statp).nssocks[ns + 1];
}
+ EXT(statp).nsaddrs[lastns] = inp;
+ statp->nsaddr_list[lastns] = ina;
+ EXT(statp).nssocks[lastns] = fd;
}
/*
* Send request, RETRY times, or until successful.
*/
for (try = 0; try < statp->retry; try++) {
- for (ns = 0; ns < MAXNS; ns++)
+ for (ns = 0; ns < statp->nscount; ns++)
{
#ifdef DEBUG
char tmpbuf[40];
#endif
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+#if defined USE_HOOKS || defined DEBUG
+ struct sockaddr *nsap = get_nsaddr (statp, ns);
+#endif
- if (nsap == NULL)
- goto next_ns;
same_ns:
#ifdef USE_HOOKS
if (__glibc_unlikely (statp->qhook != NULL)) {
@@ -542,9 +505,9 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
Dprint(statp->options & RES_DEBUG,
(stdout, ";; Querying server (# %d) address = %s\n",
- ns + 1, inet_ntop(nsap->sin6_family,
- (nsap->sin6_family == AF_INET6
- ? &nsap->sin6_addr
+ ns + 1, inet_ntop(nsap->sa_family,
+ (nsap->sa_family == AF_INET6
+ ? &((struct sockaddr_in6 *) nsap)->sin6_addr
: &((struct sockaddr_in *) nsap)->sin_addr),
tmpbuf, sizeof (tmpbuf))));
@@ -660,6 +623,21 @@ libresolv_hidden_def (res_nsend)
/* Private */
+static struct sockaddr *
+get_nsaddr (res_state statp, int n)
+{
+
+ if (statp->nsaddr_list[n].sin_family == 0 && EXT(statp).nsaddrs[n] != NULL)
+ /* EXT(statp).nsaddrs[n] holds an address that is larger than
+ struct sockaddr, and user code did not update
+ statp->nsaddr_list[n]. */
+ return (struct sockaddr *) EXT(statp).nsaddrs[n];
+ else
+ /* User code updated statp->nsaddr_list[n], or statp->nsaddr_list[n]
+ has the same content as EXT(statp).nsaddrs[n]. */
+ return (struct sockaddr *) (void *) &statp->nsaddr_list[n];
+}
+
static int
send_vc(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
@@ -674,7 +652,7 @@ send_vc(res_state statp,
// XXX REMOVE
// int anssiz = *anssizp;
HEADER *anhp = (HEADER *) ans;
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+ struct sockaddr *nsap = get_nsaddr (statp, ns);
int truncating, connreset, n;
/* On some architectures compiler might emit a warning indicating
'resplen' may be used uninitialized. However if buf2 == NULL
@@ -711,8 +689,8 @@ send_vc(res_state statp,
if (getpeername(statp->_vcsock,
(struct sockaddr *)&peer, &size) < 0 ||
- !sock_eq(&peer, nsap)) {
- __res_iclose(statp, false);
+ !sock_eq(&peer, (struct sockaddr_in6 *) nsap)) {
+ __res_iclose(statp, false);
statp->_flags &= ~RES_F_VC;
}
}
@@ -721,20 +699,19 @@ send_vc(res_state statp,
if (statp->_vcsock >= 0)
__res_iclose(statp, false);
- statp->_vcsock = socket(nsap->sin6_family, SOCK_STREAM, 0);
+ statp->_vcsock = socket(nsap->sa_family, SOCK_STREAM, 0);
if (statp->_vcsock < 0) {
*terrno = errno;
Perror(statp, stderr, "socket(vc)", errno);
return (-1);
}
__set_errno (0);
- if (connect(statp->_vcsock, (struct sockaddr *)nsap,
- nsap->sin6_family == AF_INET
+ if (connect(statp->_vcsock, nsap,
+ nsap->sa_family == AF_INET
? sizeof (struct sockaddr_in)
: sizeof (struct sockaddr_in6)) < 0) {
*terrno = errno;
- Aerror(statp, stderr, "connect/vc", errno,
- (struct sockaddr *) nsap);
+ Aerror(statp, stderr, "connect/vc", errno, nsap);
__res_iclose(statp, false);
return (0);
}
@@ -945,8 +922,7 @@ static int
reopen (res_state statp, int *terrno, int ns)
{
if (EXT(statp).nssocks[ns] == -1) {
- struct sockaddr *nsap
- = (struct sockaddr *) EXT(statp).nsaddrs[ns];
+ struct sockaddr *nsap = get_nsaddr (statp, ns);
socklen_t slen;
/* only try IPv6 if IPv6 NS and if not failed before */
--
2.3.2

View File

@ -1,641 +0,0 @@
2015-03-17 Alexandre Oliva <aoliva@redhat.com>
[BZ #17090]
[BZ #17620]
[BZ #17621]
[BZ #17628]
* NEWS: Update.
* elf/dl-tls.c (_dl_update_slotinfo): Clean up outdated DTV
entries with Static TLS too. Skip entries past the end of the
allocated DTV, from Alan Modra.
(tls_get_addr_tail): Update to glibc_likely/unlikely. Move
Static TLS DTV entry set up from...
(_dl_allocate_tls_init): ... here (fix modid assertion), ...
* elf/dl-reloc.c (_dl_nothread_init_static_tls): ... here...
* nptl/allocatestack.c (init_one_static_tls): ... and here...
* elf/dlopen.c (dl_open_worker): Drop l_tls_modid upper bound
for Static TLS.
* elf/tlsdeschtab.h (map_generation): Return size_t. Check
that the slot we find is associated with the given map before
using its generation count.
* nptl_db/db_info.c: Include ldsodefs.h.
(rtld_global, dtv_slotinfo_list, dtv_slotinfo): New typedefs.
* nptl_db/structs.def (DB_RTLD_VARIABLE): New macro.
(DB_MAIN_VARIABLE, DB_RTLD_GLOBAL_FIELD): Likewise.
(link_map::l_tls_offset): New struct field.
(dtv_t::counter): Likewise.
(rtld_global): New struct.
(_rtld_global): New rtld variable.
(dl_tls_dtv_slotinfo_list): New rtld global field.
(dtv_slotinfo_list): New struct.
(dtv_slotinfo): Likewise.
* nptl_db/td_symbol_list.c: Drop gnu/lib-names.h include.
(td_lookup): Rename to...
(td_mod_lookup): ... this. Use new mod parameter instead of
LIBPTHREAD_SO.
* nptl_db/td_thr_tlsbase.c: Include link.h.
(dtv_slotinfo_list, dtv_slotinfo): New functions.
(td_thr_tlsbase): Check DTV generation. Compute Static TLS
addresses even if the DTV is out of date or missing them.
* nptl_db/fetch-value.c (_td_locate_field): Do not refuse to
index zero-length arrays.
* nptl_db/thread_dbP.h: Include gnu/lib-names.h.
(td_lookup): Make it a macro implemented in terms of...
(td_mod_lookup): ... this declaration.
* nptl_db/db-symbols.awk (DB_RTLD_VARIABLE): Override.
(DB_MAIN_VARIABLE): Likewise.
Index: glibc-2.21/elf/dl-open.c
===================================================================
--- glibc-2.21.orig/elf/dl-open.c
+++ glibc-2.21/elf/dl-open.c
@@ -533,17 +533,7 @@ TLS generation counter wrapped! Please
&& imap->l_tls_blocksize > 0)
{
/* For static TLS we have to allocate the memory here and
- now. This includes allocating memory in the DTV. But we
- cannot change any DTV other than our own. So, if we
- cannot guarantee that there is room in the DTV we don't
- even try it and fail the load.
-
- XXX We could track the minimum DTV slots allocated in
- all threads. */
- if (! RTLD_SINGLE_THREAD_P && imap->l_tls_modid > DTV_SURPLUS)
- _dl_signal_error (0, "dlopen", NULL, N_("\
-cannot load any more object with static TLS"));
-
+ now, but we can delay updating the DTV. */
imap->l_need_tls_init = 0;
#ifdef SHARED
/* Update the slot information data for at least the
Index: glibc-2.21/elf/dl-reloc.c
===================================================================
--- glibc-2.21.orig/elf/dl-reloc.c
+++ glibc-2.21/elf/dl-reloc.c
@@ -136,12 +136,6 @@ _dl_nothread_init_static_tls (struct lin
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
- /* Fill in the DTV slot so that a later LD/GD access will find it. */
- dtv_t *dtv = THREAD_DTV ();
- assert (map->l_tls_modid <= dtv[-1].counter);
- dtv[map->l_tls_modid].pointer.val = dest;
- dtv[map->l_tls_modid].pointer.is_static = true;
-
/* Initialize the memory. */
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
Index: glibc-2.21/elf/dl-tls.c
===================================================================
--- glibc-2.21.orig/elf/dl-tls.c
+++ glibc-2.21/elf/dl-tls.c
@@ -493,17 +493,14 @@ _dl_allocate_tls_init (void *result)
assert (listp->slotinfo[cnt].gen <= GL(dl_tls_generation));
maxgen = MAX (maxgen, listp->slotinfo[cnt].gen);
+ dtv[map->l_tls_modid].pointer.val = TLS_DTV_UNALLOCATED;
+ dtv[map->l_tls_modid].pointer.is_static = false;
+
if (map->l_tls_offset == NO_TLS_OFFSET
|| map->l_tls_offset == FORCED_DYNAMIC_TLS_OFFSET)
- {
- /* For dynamically loaded modules we simply store
- the value indicating deferred allocation. */
- dtv[map->l_tls_modid].pointer.val = TLS_DTV_UNALLOCATED;
- dtv[map->l_tls_modid].pointer.is_static = false;
- continue;
- }
+ continue;
- assert (map->l_tls_modid == cnt);
+ assert (map->l_tls_modid == total + cnt);
assert (map->l_tls_blocksize >= map->l_tls_initimage_size);
#if TLS_TCB_AT_TP
assert ((size_t) map->l_tls_offset >= map->l_tls_blocksize);
@@ -515,8 +512,6 @@ _dl_allocate_tls_init (void *result)
#endif
/* Copy the initialization image and clear the BSS part. */
- dtv[map->l_tls_modid].pointer.val = dest;
- dtv[map->l_tls_modid].pointer.is_static = true;
memset (__mempcpy (dest, map->l_tls_initimage,
map->l_tls_initimage_size), '\0',
map->l_tls_blocksize - map->l_tls_initimage_size);
@@ -679,13 +674,16 @@ _dl_update_slotinfo (unsigned long int r
struct link_map *map = listp->slotinfo[cnt].map;
if (map == NULL)
{
- /* If this modid was used at some point the memory
- might still be allocated. */
- if (! dtv[total + cnt].pointer.is_static
- && dtv[total + cnt].pointer.val != TLS_DTV_UNALLOCATED)
+ if (dtv[-1].counter >= total + cnt)
{
- free (dtv[total + cnt].pointer.val);
+ /* If this modid was used at some point the memory
+ might still be allocated. */
+ if (! dtv[total + cnt].pointer.is_static
+ && (dtv[total + cnt].pointer.val
+ != TLS_DTV_UNALLOCATED))
+ free (dtv[total + cnt].pointer.val);
dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED;
+ dtv[total + cnt].pointer.is_static = false;
}
continue;
@@ -718,10 +716,8 @@ _dl_update_slotinfo (unsigned long int r
memalign and not malloc. */
free (dtv[modid].pointer.val);
- /* This module is loaded dynamically- We defer memory
- allocation. */
- dtv[modid].pointer.is_static = false;
dtv[modid].pointer.val = TLS_DTV_UNALLOCATED;
+ dtv[modid].pointer.is_static = false;
if (modid == req_modid)
the_map = map;
@@ -759,13 +755,12 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t
the_map = listp->slotinfo[idx].map;
}
- again:
/* Make sure that, if a dlopen running in parallel forces the
variable into static storage, we'll wait until the address in the
static TLS block is set up, and use that. If we're undecided
yet, make sure we make the decision holding the lock as well. */
- if (__builtin_expect (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET, 0))
+ if (__glibc_unlikely (the_map->l_tls_offset
+ != FORCED_DYNAMIC_TLS_OFFSET))
{
__rtld_lock_lock_recursive (GL(dl_load_lock));
if (__glibc_likely (the_map->l_tls_offset == NO_TLS_OFFSET))
@@ -773,22 +768,28 @@ tls_get_addr_tail (GET_ADDR_ARGS, dtv_t
the_map->l_tls_offset = FORCED_DYNAMIC_TLS_OFFSET;
__rtld_lock_unlock_recursive (GL(dl_load_lock));
}
- else
+ else if (__glibc_likely (the_map->l_tls_offset
+ != FORCED_DYNAMIC_TLS_OFFSET))
{
+#if TLS_TCB_AT_TP
+ void *p = (char *) THREAD_SELF - the_map->l_tls_offset;
+#elif TLS_DTV_AT_TP
+ void *p = (char *) THREAD_SELF + the_map->l_tls_offset + TLS_PRE_TCB_SIZE;
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
__rtld_lock_unlock_recursive (GL(dl_load_lock));
- if (__builtin_expect (the_map->l_tls_offset
- != FORCED_DYNAMIC_TLS_OFFSET, 1))
- {
- void *p = dtv[GET_ADDR_MODULE].pointer.val;
- if (__glibc_unlikely (p == TLS_DTV_UNALLOCATED))
- goto again;
- return (char *) p + GET_ADDR_OFFSET;
- }
+ dtv[GET_ADDR_MODULE].pointer.is_static = true;
+ dtv[GET_ADDR_MODULE].pointer.val = p;
+
+ return (char *) p + GET_ADDR_OFFSET;
}
+ else
+ __rtld_lock_unlock_recursive (GL(dl_load_lock));
}
void *p = dtv[GET_ADDR_MODULE].pointer.val = allocate_and_init (the_map);
- dtv[GET_ADDR_MODULE].pointer.is_static = false;
+ assert (!dtv[GET_ADDR_MODULE].pointer.is_static);
return (char *) p + GET_ADDR_OFFSET;
}
Index: glibc-2.21/elf/tlsdeschtab.h
===================================================================
--- glibc-2.21.orig/elf/tlsdeschtab.h
+++ glibc-2.21/elf/tlsdeschtab.h
@@ -42,7 +42,7 @@ eq_tlsdesc (void *p, void *q)
return tdp->tlsinfo.ti_offset == tdq->tlsinfo.ti_offset;
}
-inline static int
+inline static size_t
map_generation (struct link_map *map)
{
size_t idx = map->l_tls_modid;
@@ -58,7 +58,7 @@ map_generation (struct link_map *map)
we can assume that, if the generation count is zero, we
still haven't determined the generation count for this
module. */
- if (listp->slotinfo[idx].gen)
+ if (listp->slotinfo[idx].map == map && listp->slotinfo[idx].gen)
return listp->slotinfo[idx].gen;
else
break;
Index: glibc-2.21/nptl/allocatestack.c
===================================================================
--- glibc-2.21.orig/nptl/allocatestack.c
+++ glibc-2.21/nptl/allocatestack.c
@@ -1190,7 +1190,6 @@ __nptl_setxid (struct xid_command *cmdp)
static inline void __attribute__((always_inline))
init_one_static_tls (struct pthread *curp, struct link_map *map)
{
- dtv_t *dtv = GET_DTV (TLS_TPADJ (curp));
# if TLS_TCB_AT_TP
void *dest = (char *) curp - map->l_tls_offset;
# elif TLS_DTV_AT_TP
@@ -1199,11 +1198,9 @@ init_one_static_tls (struct pthread *cur
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
# endif
- /* Fill in the DTV slot so that a later LD/GD access will find it. */
- dtv[map->l_tls_modid].pointer.val = dest;
- dtv[map->l_tls_modid].pointer.is_static = true;
-
- /* Initialize the memory. */
+ /* We cannot delay the initialization of the Static TLS area, since
+ it can be accessed with LE or IE, but since the DTV is only used
+ by GD and LD, we can delay its update to avoid a race. */
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
Index: glibc-2.21/nptl_db/db-symbols.awk
===================================================================
--- glibc-2.21.orig/nptl_db/db-symbols.awk
+++ glibc-2.21/nptl_db/db-symbols.awk
@@ -2,6 +2,8 @@
# we've just built. It checks for all the symbols used in td_symbol_list.
BEGIN {
+%define DB_RTLD_VARIABLE(name) /* Nothing. */
+%define DB_MAIN_VARIABLE(name) /* Nothing. */
%define DB_LOOKUP_NAME(idx, name) required[STRINGIFY (name)] = 1;
%define DB_LOOKUP_NAME_TH_UNIQUE(idx, name) th_unique[STRINGIFY (name)] = 1;
%include "db-symbols.h"
Index: glibc-2.21/nptl_db/db_info.c
===================================================================
--- glibc-2.21.orig/nptl_db/db_info.c
+++ glibc-2.21/nptl_db/db_info.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include "thread_dbP.h"
#include <tls.h>
+#include <ldsodefs.h>
typedef struct pthread pthread;
typedef struct pthread_key_struct pthread_key_struct;
@@ -37,6 +38,9 @@ typedef struct
} dtv;
typedef struct link_map link_map;
+typedef struct rtld_global rtld_global;
+typedef struct dtv_slotinfo_list dtv_slotinfo_list;
+typedef struct dtv_slotinfo dtv_slotinfo;
/* Actually static in nptl/init.c, but we only need it for typeof. */
extern bool __nptl_initial_report_events;
Index: glibc-2.21/nptl_db/fetch-value.c
===================================================================
--- glibc-2.21.orig/nptl_db/fetch-value.c
+++ glibc-2.21/nptl_db/fetch-value.c
@@ -69,7 +69,8 @@ _td_locate_field (td_thragent_t *ta,
}
}
- if (idx != 0 && idx - (psaddr_t) 0 > DB_DESC_NELEM (desc))
+ if (idx != 0 && DB_DESC_NELEM (desc) != 0
+ && idx - (psaddr_t) 0 > DB_DESC_NELEM (desc))
/* This is an internal indicator to callers with nonzero IDX
that the IDX value is too big. */
return TD_NOAPLIC;
Index: glibc-2.21/nptl_db/structs.def
===================================================================
--- glibc-2.21.orig/nptl_db/structs.def
+++ glibc-2.21/nptl_db/structs.def
@@ -22,6 +22,28 @@
# define STRUCTS_DEF_DEFAULTS 1
#endif
+#ifndef DB_RTLD_VARIABLE
+# define DB_RTLD_VARIABLE(name) DB_VARIABLE (name)
+#endif
+
+#ifndef DB_MAIN_VARIABLE
+# define DB_MAIN_VARIABLE(name) DB_VARIABLE (name)
+#endif
+
+#ifndef DB_RTLD_GLOBAL_FIELD
+# if !IS_IN (libpthread)
+# define DB_RTLD_GLOBAL_FIELD(field) \
+ DB_STRUCT_FIELD (rtld_global, _##field) \
+ DB_MAIN_VARIABLE (_##field)
+# elif defined SHARED
+# define DB_RTLD_GLOBAL_FIELD(field) \
+ DB_STRUCT_FIELD (rtld_global, _##field)
+# else
+# define DB_RTLD_GLOBAL_FIELD(field) \
+ DB_MAIN_VARIABLE (_##field)
+# endif
+#endif /* DB_RTLD_GLOBAL_FIELD */
+
DB_STRUCT (pthread)
DB_STRUCT_FIELD (pthread, list)
DB_STRUCT_FIELD (pthread, report_events)
@@ -70,14 +92,31 @@ DB_STRUCT (pthread_key_data_level2)
DB_STRUCT_ARRAY_FIELD (pthread_key_data_level2, data)
DB_STRUCT_FIELD (link_map, l_tls_modid)
+DB_STRUCT_FIELD (link_map, l_tls_offset)
DB_STRUCT_ARRAY_FIELD (dtv, dtv)
#define pointer_val pointer.val /* Field of anonymous struct in dtv_t. */
DB_STRUCT_FIELD (dtv_t, pointer_val)
+DB_STRUCT_FIELD (dtv_t, counter)
#if !IS_IN (libpthread) || TLS_TCB_AT_TP
DB_STRUCT_FIELD (pthread, dtvp)
#endif
+#if !(IS_IN (libpthread) && !defined SHARED)
+DB_STRUCT (rtld_global)
+DB_RTLD_VARIABLE (_rtld_global)
+#endif
+DB_RTLD_GLOBAL_FIELD (dl_tls_dtv_slotinfo_list)
+
+DB_STRUCT (dtv_slotinfo_list)
+DB_STRUCT_FIELD (dtv_slotinfo_list, len)
+DB_STRUCT_FIELD (dtv_slotinfo_list, next)
+DB_STRUCT_ARRAY_FIELD (dtv_slotinfo_list, slotinfo)
+
+DB_STRUCT (dtv_slotinfo)
+DB_STRUCT_FIELD (dtv_slotinfo, gen)
+DB_STRUCT_FIELD (dtv_slotinfo, map)
+
#ifdef STRUCTS_DEF_DEFAULTS
# undef DB_STRUCT_ARRAY_FIELD
# undef DB_ARRAY_VARIABLE
Index: glibc-2.21/nptl_db/td_symbol_list.c
===================================================================
--- glibc-2.21.orig/nptl_db/td_symbol_list.c
+++ glibc-2.21/nptl_db/td_symbol_list.c
@@ -18,7 +18,6 @@
<http://www.gnu.org/licenses/>. */
#include <assert.h>
-#include <gnu/lib-names.h>
#include "thread_dbP.h"
static const char *symbol_list_arr[] =
@@ -41,12 +40,12 @@ td_symbol_list (void)
ps_err_e
-td_lookup (struct ps_prochandle *ps, int idx, psaddr_t *sym_addr)
+td_mod_lookup (struct ps_prochandle *ps, const char *mod,
+ int idx, psaddr_t *sym_addr)
{
ps_err_e result;
assert (idx >= 0 && idx < SYM_NUM_MESSAGES);
- result = ps_pglobal_lookup (ps, LIBPTHREAD_SO, symbol_list_arr[idx],
- sym_addr);
+ result = ps_pglobal_lookup (ps, mod, symbol_list_arr[idx], sym_addr);
#ifdef HAVE_ASM_GLOBAL_DOT_NAME
/* For PowerPC, 64-bit uses dot symbols but 32-bit does not.
Index: glibc-2.21/nptl_db/td_thr_tlsbase.c
===================================================================
--- glibc-2.21.orig/nptl_db/td_thr_tlsbase.c
+++ glibc-2.21/nptl_db/td_thr_tlsbase.c
@@ -17,14 +17,118 @@
<http://www.gnu.org/licenses/>. */
#include "thread_dbP.h"
+#include <link.h>
+/* Get the DTV slotinfo list head entry from the dynamic loader state
+ into *LISTHEAD. */
+static td_err_e
+dtv_slotinfo_list (td_thragent_t *ta,
+ psaddr_t *listhead)
+{
+ td_err_e err;
+ psaddr_t head;
+
+ if (ta->ta_addr__rtld_global == 0
+ && td_mod_lookup (ta->ph, LD_SO, SYM__rtld_global,
+ &ta->ta_addr__rtld_global) != PS_OK)
+ ta->ta_addr__rtld_global = (void*)-1;
+
+ if (ta->ta_addr__rtld_global != (void*)-1)
+ {
+ err = DB_GET_FIELD (head, ta, ta->ta_addr__rtld_global,
+ rtld_global, _dl_tls_dtv_slotinfo_list, 0);
+ if (err != TD_OK)
+ return err;
+ }
+ else
+ {
+ if (ta->ta_addr__dl_tls_dtv_slotinfo_list == 0
+ && td_mod_lookup (ta->ph, NULL, SYM__dl_tls_dtv_slotinfo_list,
+ &ta->ta_addr__dl_tls_dtv_slotinfo_list) != PS_OK)
+ return TD_ERR;
+
+ err = _td_fetch_value (ta, ta->ta_var__dl_tls_dtv_slotinfo_list,
+ SYM_DESC__dl_tls_dtv_slotinfo_list,
+ 0, ta->ta_addr__dl_tls_dtv_slotinfo_list, &head);
+ if (err != TD_OK)
+ return err;
+ }
+
+ *listhead = head;
+ return TD_OK;
+}
+
+/* Get the address of the DTV slotinfo entry for MODID into
+ *DTVSLOTINFO. */
+static td_err_e
+dtv_slotinfo (td_thragent_t *ta,
+ unsigned long int modid,
+ psaddr_t *dtvslotinfo)
+{
+ td_err_e err;
+ psaddr_t slot, temp;
+ size_t slbase = 0;
+
+ err = dtv_slotinfo_list (ta, &slot);
+ if (err != TD_OK)
+ return err;
+
+ while (slot)
+ {
+ /* Get the number of entries in this list entry's array. */
+ err = DB_GET_FIELD (temp, ta, slot, dtv_slotinfo_list, len, 0);
+ if (err != TD_OK)
+ return err;
+ size_t len = (uintptr_t)temp;
+
+ /* Did we find the list entry for modid? */
+ if (modid < slbase + len)
+ break;
+
+ /* We didn't, so get the next list entry. */
+ slbase += len;
+ err = DB_GET_FIELD (temp, ta, slot, dtv_slotinfo_list,
+ next, 0);
+ if (err != TD_OK)
+ return err;
+ slot = temp;
+ }
+
+ /* We reached the end of the list and found nothing. */
+ if (!slot)
+ return TD_ERR;
+
+ /* Take the slotinfo for modid from the list entry. */
+ err = DB_GET_FIELD_ADDRESS (temp, ta, slot, dtv_slotinfo_list,
+ slotinfo, modid - slbase);
+ if (err != TD_OK)
+ return err;
+ slot = temp;
+
+ *dtvslotinfo = slot;
+ return TD_OK;
+}
+
+/* Return in *BASE the base address of the TLS block for MODID within
+ TH.
+
+ It should return success and yield the correct pointer in any
+ circumstance where the TLS block for the module and thread
+ requested has already been initialized.
+
+ It should fail with TD_TLSDEFER only when the thread could not
+ possibly have observed any values in that TLS block. That way, the
+ debugger can fall back to showing initial values from the PT_TLS
+ segment (and refusing attempts to mutate) for the TD_TLSDEFER case,
+ and never fail to make the values the program will actually see
+ available to the user of the debugger. */
td_err_e
td_thr_tlsbase (const td_thrhandle_t *th,
unsigned long int modid,
psaddr_t *base)
{
td_err_e err;
- psaddr_t dtv, dtvslot, dtvptr;
+ psaddr_t dtv, dtvslot, dtvptr, temp;
if (modid < 1)
return TD_NOTLS;
@@ -50,11 +154,75 @@ td_thr_tlsbase (const td_thrhandle_t *th
return TD_TLSDEFER;
}
+ err = dtv_slotinfo (th->th_ta_p, modid, &temp);
+ if (err != TD_OK)
+ return err;
+
+ psaddr_t slot;
+ err = DB_GET_STRUCT (slot, th->th_ta_p, temp, dtv_slotinfo);
+ if (err != TD_OK)
+ return err;
+
+ /* Take the link_map from the slotinfo. */
+ psaddr_t map;
+ err = DB_GET_FIELD_LOCAL (map, th->th_ta_p, slot, dtv_slotinfo, map, 0);
+ if (err != TD_OK)
+ return err;
+ if (!map)
+ return TD_ERR;
+
+ /* Ok, the modid is good, now find out what DTV generation it
+ requires. */
+ err = DB_GET_FIELD_LOCAL (temp, th->th_ta_p, slot, dtv_slotinfo, gen, 0);
+ if (err != TD_OK)
+ return err;
+ size_t modgen = (uintptr_t)temp;
+
/* Get the DTV pointer from the thread descriptor. */
err = DB_GET_FIELD (dtv, th->th_ta_p, pd, pthread, dtvp, 0);
if (err != TD_OK)
return err;
+ psaddr_t dtvgenloc;
+ /* Get the DTV generation count at dtv[0].counter. */
+ err = DB_GET_FIELD_ADDRESS (dtvgenloc, th->th_ta_p, dtv, dtv, dtv, 0);
+ if (err != TD_OK)
+ return err;
+ err = DB_GET_FIELD (temp, th->th_ta_p, dtvgenloc, dtv_t, counter, 0);
+ if (err != TD_OK)
+ return err;
+ size_t dtvgen = (uintptr_t)temp;
+
+ /* Is the DTV current enough? */
+ if (dtvgen < modgen)
+ {
+ try_static_tls:
+ /* If the module uses Static TLS, we're still good. */
+ err = DB_GET_FIELD (temp, th->th_ta_p, map, link_map, l_tls_offset, 0);
+ if (err != TD_OK)
+ return err;
+ ptrdiff_t tlsoff = (uintptr_t)temp;
+
+ if (tlsoff != FORCED_DYNAMIC_TLS_OFFSET
+ && tlsoff != NO_TLS_OFFSET)
+ {
+ psaddr_t tp = pd;
+
+#if TLS_TCB_AT_TP
+ dtvptr = tp - tlsoff;
+#elif TLS_DTV_AT_TP
+ dtvptr = tp + tlsoff + TLS_PRE_TCB_SIZE;
+#else
+# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+#endif
+
+ *base = dtvptr;
+ return TD_OK;
+ }
+
+ return TD_TLSDEFER;
+ }
+
/* Find the corresponding entry in the DTV. */
err = DB_GET_FIELD_ADDRESS (dtvslot, th->th_ta_p, dtv, dtv, dtv, modid);
if (err != TD_OK)
@@ -68,7 +236,7 @@ td_thr_tlsbase (const td_thrhandle_t *th
/* It could be that the memory for this module is not allocated for
the given thread. */
if ((uintptr_t) dtvptr & 1)
- return TD_TLSDEFER;
+ goto try_static_tls;
*base = dtvptr;
return TD_OK;
Index: glibc-2.21/nptl_db/thread_dbP.h
===================================================================
--- glibc-2.21.orig/nptl_db/thread_dbP.h
+++ glibc-2.21/nptl_db/thread_dbP.h
@@ -29,6 +29,7 @@
#include "thread_db.h"
#include "../nptl/pthreadP.h" /* This is for *_BITMASK only. */
#include <list.h>
+#include <gnu/lib-names.h>
/* Indeces for the symbol names. */
enum
@@ -139,11 +140,11 @@ ta_ok (const td_thragent_t *ta)
}
-/* Internal wrapper around ps_pglobal_lookup. */
-extern ps_err_e td_lookup (struct ps_prochandle *ps,
- int idx, psaddr_t *sym_addr) attribute_hidden;
-
-
+/* Internal wrappers around ps_pglobal_lookup. */
+extern ps_err_e td_mod_lookup (struct ps_prochandle *ps, const char *modname,
+ int idx, psaddr_t *sym_addr) attribute_hidden;
+#define td_lookup(ps, idx, sym_addr) \
+ td_mod_lookup ((ps), LIBPTHREAD_SO, (idx), (sym_addr))
/* Store in psaddr_t VAR the address of inferior's symbol NAME. */

View File

@ -1,224 +0,0 @@
From c26efef9798914e208329c0e8c3c73bb1135d9e3 Mon Sep 17 00:00:00 2001
From: Mel Gorman <mgorman@suse.de>
Date: Thu, 2 Apr 2015 12:14:14 +0530
Subject: [PATCH] malloc: Consistently apply trim_threshold to all heaps [BZ
#17195]
Trimming heaps is a balance between saving memory and the system overhead
required to update page tables and discard allocated pages. The malloc
option M_TRIM_THRESHOLD is a tunable that users are meant to use to decide
where this balance point is but it is only applied to the main arena.
For scalability reasons, glibc malloc has per-thread heaps but these are
shrunk with madvise() if there is one page free at the top of the heap.
In some circumstances this can lead to high system overhead if a thread
has a control flow like
while (data_to_process) {
buf = malloc(large_size);
do_stuff();
free(buf);
}
For a large size, the free() will call madvise (pagetable teardown, page
free and TLB flush) every time followed immediately by a malloc (fault,
kernel page alloc, zeroing and charge accounting). The kernel overhead
can dominate such a workload.
This patch allows the user to tune when madvise gets called by applying
the trim threshold to the per-thread heaps and using similar logic to the
main arena when deciding whether to shrink. Alternatively if the dynamic
brk/mmap threshold gets adjusted then the new values will be obeyed by
the per-thread heaps.
Bug 17195 was a test case motivated by a problem encountered in scientific
applications written in python that performance badly due to high page fault
overhead. The basic operation of such a program was posted by Julian Taylor
https://sourceware.org/ml/libc-alpha/2015-02/msg00373.html
With this patch applied, the overhead is eliminated. All numbers in this
report are in seconds and were recorded by running Julian's program 30
times.
pyarray
glibc madvise
2.21 v2
System min 1.81 ( 0.00%) 0.00 (100.00%)
System mean 1.93 ( 0.00%) 0.02 ( 99.20%)
System stddev 0.06 ( 0.00%) 0.01 ( 88.99%)
System max 2.06 ( 0.00%) 0.03 ( 98.54%)
Elapsed min 3.26 ( 0.00%) 2.37 ( 27.30%)
Elapsed mean 3.39 ( 0.00%) 2.41 ( 28.84%)
Elapsed stddev 0.14 ( 0.00%) 0.02 ( 82.73%)
Elapsed max 4.05 ( 0.00%) 2.47 ( 39.01%)
glibc madvise
2.21 v2
User 141.86 142.28
System 57.94 0.60
Elapsed 102.02 72.66
Note that almost a minutes worth of system time is eliminted and the
program completes 28% faster on average.
To illustrate the problem without python this is a basic test-case for
the worst case scenario where every free is a madvise followed by a an alloc
/* gcc bench-free.c -lpthread -o bench-free */
static int num = 1024;
void __attribute__((noinline,noclone)) dostuff (void *p)
{
}
void *worker (void *data)
{
int i;
for (i = num; i--;)
{
void *m = malloc (48*4096);
dostuff (m);
free (m);
}
return NULL;
}
int main()
{
int i;
pthread_t t;
void *ret;
if (pthread_create (&t, NULL, worker, NULL))
exit (2);
if (pthread_join (t, &ret))
exit (3);
return 0;
}
Before the patch, this resulted in 1024 calls to madvise. With the patch applied,
madvise is called twice because the default trim threshold is high enough to avoid
this.
This a more complex case where there is a mix of frees. It's simply a different worker
function for the test case above
void *worker (void *data)
{
int i;
int j = 0;
void *free_index[num];
for (i = num; i--;)
{
void *m = malloc ((i % 58) *4096);
dostuff (m);
if (i % 2 == 0) {
free (m);
} else {
free_index[j++] = m;
}
}
for (; j >= 0; j--)
{
free(free_index[j]);
}
return NULL;
}
glibc 2.21 calls malloc 90305 times but with the patch applied, it's
called 13438. Increasing the trim threshold will decrease the number of
times it's called with the option of eliminating the overhead.
ebizzy is meant to generate a workload resembling common web application
server workloads. It is threaded with a large working set that at its core
has an allocation, do_stuff, free loop that also hits this case. The primary
metric of the benchmark is records processed per second. This is running on
my desktop which is a single socket machine with an I7-4770 and 8 cores.
Each thread count was run for 30 seconds. It was only run once as the
performance difference is so high that the variation is insignificant.
glibc 2.21 patch
threads 1 10230 44114
threads 2 19153 84925
threads 4 34295 134569
threads 8 51007 183387
Note that the saving happens to be a concidence as the size allocated
by ebizzy was less than the default threshold. If a different number of
chunks were specified then it may also be necessary to tune the threshold
to compensate
This is roughly quadrupling the performance of this benchmark. The difference in
system CPU usage illustrates why.
ebizzy running 1 thread with glibc 2.21
10230 records/s 306904
real 30.00 s
user 7.47 s
sys 22.49 s
22.49 seconds was spent in the kernel for a workload runinng 30 seconds. With the
patch applied
ebizzy running 1 thread with patch applied
44126 records/s 1323792
real 30.00 s
user 29.97 s
sys 0.00 s
system CPU usage was zero with the patch applied. strace shows that glibc
running this workload calls madvise approximately 9000 times a second. With
the patch applied madvise was called twice during the workload (or 0.06
times per second).
2015-02-10 Mel Gorman <mgorman@suse.de>
[BZ #17195]
* malloc/arena.c (free): Apply trim threshold to per-thread heaps
as well as the main arena.
---
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -241,6 +241,8 @@
/* For MIN, MAX, powerof2. */
#include <sys/param.h>
+/* For ALIGN_DOWN. */
+#include <libc-internal.h>
/*
Debugging:
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -658,7 +658,7 @@ heap_trim (heap_info *heap, size_t pad)
unsigned long pagesz = GLRO (dl_pagesize);
mchunkptr top_chunk = top (ar_ptr), p, bck, fwd;
heap_info *prev_heap;
- long new_size, top_size, extra, prev_size, misalign;
+ long new_size, top_size, top_area, extra, prev_size, misalign;
/* Can this heap go away completely? */
while (top_chunk == chunk_at_offset (heap, sizeof (*heap)))
@@ -694,9 +694,16 @@ heap_trim (heap_info *heap, size_t pad)
set_head (top_chunk, new_size | PREV_INUSE);
/*check_chunk(ar_ptr, top_chunk);*/
}
+
+ /* Uses similar logic for per-thread arenas as the main arena with systrim
+ by preserving the top pad and at least a page. */
top_size = chunksize (top_chunk);
- extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
- if (extra < (long) pagesz)
+ top_area = top_size - MINSIZE - 1;
+ if (top_area <= pad)
+ return 0;
+
+ extra = ALIGN_DOWN(top_area - pad, pagesz);
+ if ((unsigned long) extra < mp_.trim_threshold)
return 0;
/* Try to shrink. */