glibc: add 11 upstream patches, including a fix for #7307.

This commit is contained in:
Leah Neukirchen 2017-08-21 16:07:18 +02:00
parent 98977222a9
commit 728afd17c6
12 changed files with 955 additions and 1 deletions

View file

@ -0,0 +1,61 @@
From dc258ce62ae0bbb456c6a855dbb6b384ecf7e988 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 3 Aug 2017 13:59:17 +0200
Subject: [PATCH 01] getaddrinfo: Release resolver context on error in
gethosts [BZ #21885]
(cherry picked from commit 964263bb8d650f1681665c55704fb01a8e725621)
---
ChangeLog | 6 ++++++
NEWS | 6 ++++++
sysdeps/posix/getaddrinfo.c | 2 ++
3 files changed, 14 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 8dbfc7e..28ce9c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-03 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #21885]
+ * sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context
+ on memory allocation failure.
+
2017-08-02 Siddhesh Poyarekar <siddhesh@sourceware.org>
* version.h (RELEASE): Set to "stable"
diff --git a/NEWS b/NEWS
index 8295f20..9a64579 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,12 @@ See the end for copying conditions.
Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
using `glibc' in the "product" field.
+Version 2.26.1
+
+The following bugs are resolved with this release:
+
+ [21885] getaddrinfo: Release resolver context on error in gethosts
+
Version 2.26
Major new features:
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index efa7118..699411c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -255,6 +255,8 @@ convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
break; \
if (!scratch_buffer_grow (tmpbuf)) \
{ \
+ __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \
+ __resolv_context_put (res_ctx); \
result = -EAI_MEMORY; \
goto free_and_return; \
} \
--
2.7.4.GIT

View file

@ -0,0 +1,80 @@
From 665ce88d68fd13c5c4cbaf2808434c618745137c Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Thu, 3 Aug 2017 22:33:19 +0000
Subject: [PATCH 02] i686/multiarch: Regenerate ulps
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
This comes from running “make regen-ulps” on an AMD Opteron 2378 CPU.
Changelog:
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
(cherry picked from commit 144bdab050bdd78c327d98a79b15c5b164e1d56f)
---
ChangeLog | 4 ++++
sysdeps/i386/i686/fpu/multiarch/libm-test-ulps | 14 +++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 28ce9c8..3478699 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
+
2017-08-03 Florian Weimer <fweimer@redhat.com>
[BZ #21885]
diff --git a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
index 81dd1a0..053f5ec 100644
--- a/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
+++ b/sysdeps/i386/i686/fpu/multiarch/libm-test-ulps
@@ -58,7 +58,7 @@ double: 1
float128: 2
idouble: 1
ifloat128: 2
-ildouble: 4
+ildouble: 5
ldouble: 3
Function: "asin":
@@ -1154,8 +1154,8 @@ float128: 4
idouble: 3
ifloat: 3
ifloat128: 4
-ildouble: 7
-ldouble: 7
+ildouble: 8
+ldouble: 8
Function: Imaginary part of "clog10_upward":
double: 1
@@ -2013,8 +2013,8 @@ double: 3
float: 4
idouble: 3
ifloat: 4
-ildouble: 5
-ldouble: 5
+ildouble: 6
+ldouble: 6
Function: "hypot":
double: 1
@@ -2205,8 +2205,8 @@ float128: 8
idouble: 3
ifloat: 4
ifloat128: 8
-ildouble: 5
-ldouble: 5
+ildouble: 6
+ldouble: 6
Function: "log":
double: 1
--
2.7.4.GIT

View file

@ -0,0 +1,48 @@
From a4e5aa1a443cfad09bc98f9bb527995371a53a88 Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Thu, 3 Aug 2017 22:35:48 +0000
Subject: [PATCH 03] Fix the return type of the getentropy stub
The return type of the getentropy stub is wrongly defined as ssize_t,
while both the <sys/random.h> header and the Linux implementation
define it as int. This patch fixes that.
Changelog:
* stdlib/getentropy.c (getentropy): Change return type to int.
(cherry picked from commit 2b34e2716f1e84b2c3457ffc868c3dc775b55845)
---
ChangeLog | 4 ++++
stdlib/getentropy.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 3478699..4357ad1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
+ * stdlib/getentropy.c (getentropy): Change return type to int.
+
+2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
+
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Regenerated.
2017-08-03 Florian Weimer <fweimer@redhat.com>
diff --git a/stdlib/getentropy.c b/stdlib/getentropy.c
index a71d4cd..a88bbf8 100644
--- a/stdlib/getentropy.c
+++ b/stdlib/getentropy.c
@@ -21,7 +21,7 @@
/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
success and -1 on failure. */
-ssize_t
+int
getentropy (void *buffer, size_t length)
{
__set_errno (ENOSYS);
--
2.7.4.GIT

View file

@ -0,0 +1,95 @@
From 799859f6635d68487ea2472bd79d96a7639a1ab1 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Sun, 6 Aug 2017 10:44:30 -0700
Subject: [PATCH 04] x86-64: Use _dl_runtime_resolve_opt only with AVX512F
[BZ #21871]
On AVX machines with XGETBV (ECX == 1) like Skylake processors,
(gdb) disass _dl_runtime_resolve_avx_opt
Dump of assembler code for function _dl_runtime_resolve_avx_opt:
0x0000000000015890 <+0>: push %rax
0x0000000000015891 <+1>: push %rcx
0x0000000000015892 <+2>: push %rdx
0x0000000000015893 <+3>: mov $0x1,%ecx
0x0000000000015898 <+8>: xgetbv
0x000000000001589b <+11>: mov %eax,%r11d
0x000000000001589e <+14>: pop %rdx
0x000000000001589f <+15>: pop %rcx
0x00000000000158a0 <+16>: pop %rax
0x00000000000158a1 <+17>: and $0x4,%r11d
0x00000000000158a5 <+21>: bnd je 0x16200 <_dl_runtime_resolve_sse_vex>
End of assembler dump.
is slower than:
(gdb) disass _dl_runtime_resolve_avx_slow
Dump of assembler code for function _dl_runtime_resolve_avx_slow:
0x0000000000015850 <+0>: vorpd %ymm0,%ymm1,%ymm8
0x0000000000015854 <+4>: vorpd %ymm2,%ymm3,%ymm9
0x0000000000015858 <+8>: vorpd %ymm4,%ymm5,%ymm10
0x000000000001585c <+12>: vorpd %ymm6,%ymm7,%ymm11
0x0000000000015860 <+16>: vorpd %ymm8,%ymm9,%ymm9
0x0000000000015865 <+21>: vorpd %ymm10,%ymm11,%ymm10
0x000000000001586a <+26>: vpcmpeqd %xmm8,%xmm8,%xmm8
0x000000000001586f <+31>: vorpd %ymm9,%ymm10,%ymm10
0x0000000000015874 <+36>: vptest %ymm10,%ymm8
0x0000000000015879 <+41>: bnd jae 0x158b0 <_dl_runtime_resolve_avx>
0x000000000001587c <+44>: vzeroupper
0x000000000001587f <+47>: bnd jmpq 0x16200 <_dl_runtime_resolve_sse_vex>
End of assembler dump.
(gdb)
since xgetbv takes much more cycles than single cycle operations like
vpord/vvpcmpeq/ptest. _dl_runtime_resolve_opt should be used only with
AVX512 where AVX512 instructions lead to lower CPU frequency on Skylake
server.
[BZ #21871]
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
(cherry picked from commit d2cf37c0a2a375cf2fde69f1afbcc49e45368fc4)
---
ChangeLog | 6 ++++++
sysdeps/x86/cpu-features.c | 7 +++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4357ad1..764c827 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #21871]
+ * sysdeps/x86/cpu-features.c (init_cpu_features): Set
+ bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
+
2017-08-03 Aurelien Jarno <aurelien@aurel32.net>
* stdlib/getentropy.c (getentropy): Change return type to int.
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 1d087ea..6f90084 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -244,10 +244,13 @@ init_cpu_features (struct cpu_features *cpu_features)
|= bit_arch_Prefer_No_AVX512;
/* To avoid SSE transition penalty, use _dl_runtime_resolve_slow.
- If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */
+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt.
+ Use _dl_runtime_resolve_opt only with AVX512F since it is
+ slower than _dl_runtime_resolve_slow with AVX. */
cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow]
|= bit_arch_Use_dl_runtime_resolve_slow;
- if (cpu_features->max_cpuid >= 0xd)
+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
+ && cpu_features->max_cpuid >= 0xd)
{
unsigned int eax;
--
2.7.4.GIT

View file

@ -0,0 +1,212 @@
From 82efa1ffd43bed1494d20a4b86f6b15ac6bb5545 Mon Sep 17 00:00:00 2001
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon, 17 Jul 2017 10:59:59 -0300
Subject: [PATCH 05] posix: Set p{read,write}v2 to return ENOTSUP (BZ#21780)
Different than other architectures hppa-linux-gnu define different values
for ENOTSUP and EOPNOTSUPP, where the later is a Linux specific one.
This leads to tst-preadwritev{64}v2 tests failures:
$ ./testrun.sh misc/tst-preadvwritev2
error: tst-preadvwritev2-common.c:35: preadv2 failure did not set errno to ENOTSUP (223)
error: 1 test failures
The straightforward fix is to return the POSIX defined ENOTSUP on all
p{read,write}v{64}v2 implementations instead of Linux specific one.
Checked on x86_64-linux-gnu and the tst-preadwritev{64}v2 on
hppa-linux-gnu (although due the installed kernel on my testing system
the pwritev{64}v2 with an invalid flag still fails due a known kernel
issue [1]).
[BZ #21780]
* sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
EOPNOTSUPP.
* sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/posix/pwritev2.c (pwritev2): Likewise.
* sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
* sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
* sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
* sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
* sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
[1] https://sourceware.org/ml/libc-alpha/2017-06/msg00726.html
Cherry-pick of 852d63120783fae5bf85a067320dc4ba1ed59f11
---
ChangeLog | 13 +++++++++++++
sysdeps/posix/preadv2.c | 2 +-
sysdeps/posix/preadv64v2.c | 2 +-
sysdeps/posix/pwritev2.c | 2 +-
sysdeps/posix/pwritev64v2.c | 2 +-
sysdeps/unix/sysv/linux/preadv2.c | 4 ++--
sysdeps/unix/sysv/linux/preadv64v2.c | 4 ++--
sysdeps/unix/sysv/linux/pwritev2.c | 4 ++--
sysdeps/unix/sysv/linux/pwritev64v2.c | 4 ++--
9 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 764c827..459062c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-08-09 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ [BZ #21780]
+ * sysdeps/posix/preadv2.c (preadv2): Use ENOTSUP instead of
+ EOPNOTSUPP.
+ * sysdeps/posix/preadv64v2.c (preadv64v2): Likewise.
+ * sysdeps/posix/pwritev2.c (pwritev2): Likewise.
+ * sysdeps/posix/pwritev64v2.c (pwritev64v2): Likewise.
+ * sysdeps/unix/sysv/linux/preadv2.c (preadv2): Likewise.
+ * sysdeps/unix/sysv/linux/preadv64v2.c (preadv64v2): Likewise.
+ * sysdeps/unix/sysv/linux/pwritev2.c (pwritev2): Likewise.
+ * sysdeps/unix/sysv/linux/pwritev64v2.c (pwritev64v2): Likewise.
+
2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
[BZ #21871]
diff --git a/sysdeps/posix/preadv2.c b/sysdeps/posix/preadv2.c
index 2a7cf11..d27f702 100644
--- a/sysdeps/posix/preadv2.c
+++ b/sysdeps/posix/preadv2.c
@@ -28,7 +28,7 @@ preadv2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
diff --git a/sysdeps/posix/preadv64v2.c b/sysdeps/posix/preadv64v2.c
index e084f3f..ce7cb40 100644
--- a/sysdeps/posix/preadv64v2.c
+++ b/sysdeps/posix/preadv64v2.c
@@ -25,7 +25,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
diff --git a/sysdeps/posix/pwritev2.c b/sysdeps/posix/pwritev2.c
index 5b7650c..7ec8cbc 100644
--- a/sysdeps/posix/pwritev2.c
+++ b/sysdeps/posix/pwritev2.c
@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
diff --git a/sysdeps/posix/pwritev64v2.c b/sysdeps/posix/pwritev64v2.c
index 0f2f9ef..be98aee 100644
--- a/sysdeps/posix/pwritev64v2.c
+++ b/sysdeps/posix/pwritev64v2.c
@@ -26,7 +26,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, OFF_T offset,
{
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
index 11fe85e..137e2dd 100644
--- a/sysdeps/unix/sysv/linux/preadv2.c
+++ b/sysdeps/unix/sysv/linux/preadv2.c
@@ -32,7 +32,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
# ifdef __NR_preadv2
ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
LO_HI_LONG (offset), flags);
- if (result >= 0 || errno != ENOSYS)
+ if (result >= 0)
return result;
# endif
/* Trying to emulate the preadv2 syscall flags is troublesome:
@@ -46,7 +46,7 @@ preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
return preadv (fd, vector, count, offset);
diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
index 9d7f8c9..8f41325 100644
--- a/sysdeps/unix/sysv/linux/preadv64v2.c
+++ b/sysdeps/unix/sysv/linux/preadv64v2.c
@@ -30,7 +30,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
#ifdef __NR_preadv64v2
ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
LO_HI_LONG (offset), flags);
- if (result >= 0 || errno != ENOSYS)
+ if (result >= 0)
return result;
#endif
/* Trying to emulate the preadv2 syscall flags is troublesome:
@@ -44,7 +44,7 @@ preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
return preadv64 (fd, vector, count, offset);
diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
index 72f0471..8e5032f 100644
--- a/sysdeps/unix/sysv/linux/pwritev2.c
+++ b/sysdeps/unix/sysv/linux/pwritev2.c
@@ -28,7 +28,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
# ifdef __NR_pwritev2
ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
LO_HI_LONG (offset), flags);
- if (result >= 0 || errno != ENOSYS)
+ if (result >= 0)
return result;
# endif
/* Trying to emulate the pwritev2 syscall flags is troublesome:
@@ -42,7 +42,7 @@ pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
return pwritev (fd, vector, count, offset);
diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
index def9a0b..d2800c6 100644
--- a/sysdeps/unix/sysv/linux/pwritev64v2.c
+++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
@@ -30,7 +30,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
#ifdef __NR_pwritev64v2
ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
LO_HI_LONG (offset), flags);
- if (result >= 0 || errno != ENOSYS)
+ if (result >= 0)
return result;
#endif
/* Trying to emulate the pwritev2 syscall flags is troublesome:
@@ -44,7 +44,7 @@ pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
if (flags != 0)
{
- __set_errno (EOPNOTSUPP);
+ __set_errno (ENOTSUP);
return -1;
}
return pwritev64 (fd, vector, count, offset);
--
2.7.4.GIT

View file

@ -0,0 +1,75 @@
From 302434688d925134065498b4a5574f6ee6bfb9fd Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 10 Aug 2017 09:10:36 +0200
Subject: [PATCH 06] nss: Call __resolv_context_put before early return in
get*_r [BZ #21932]
This corrects an oversight introduced in commit
352f4ff9a268b81ef5d4b2413f582565806e4790 (resolv: Introduce struct
resolv_context).
(cherry picked from commit 3016149819268b14660f791b971910ccc2cc13e5)
---
ChangeLog | 6 ++++++
NEWS | 1 +
nss/getXXbyYY_r.c | 10 +++++++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 459062c..3127648 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-09 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #21932]
+ * nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
+ before early return.
+
2017-08-09 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #21780]
diff --git a/NEWS b/NEWS
index 9a64579..ec6cf34 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Version 2.26.1
The following bugs are resolved with this release:
[21885] getaddrinfo: Release resolver context on error in gethosts
+ [21932] Unpaired __resolv_context_get in generic get*_r implementation
Version 2.26
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 6c547ea..bce80e0 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
H_ERRNO_VAR_P))
{
case -1:
+# ifdef NEED__RES
+ __resolv_context_put (res_ctx);
+# endif
return errno;
case 1:
#ifdef NEED_H_ERRNO
@@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
H_ERRNO_VAR);
if (nscd_status >= 0)
- return nscd_status;
+ {
+# ifdef NEED__RES
+ __resolv_context_put (res_ctx);
+# endif
+ return nscd_status;
+ }
}
#endif
--
2.7.4.GIT

View file

@ -0,0 +1,74 @@
From c55ad6452e2d63ebf6fcaabb00bfd27aae02ffb6 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 10 Aug 2017 15:58:28 +0200
Subject: [PATCH 07] malloc: Avoid optimizer warning with GCC 7 and -O3
(cherry picked from commit eac43cbb8d808a40004aa0a4a286f5c5155beccb)
---
ChangeLog | 5 +++++
malloc/malloc.c | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3127648..5ea9b8b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-10 Florian Weimer <fweimer@redhat.com>
+
+ * malloc/malloc.c (get_max_fast): Reimplement as an inline
+ function which calls __builtin_unreachable.
+
2017-08-09 Florian Weimer <fweimer@redhat.com>
[BZ #21932]
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 54e406b..e3ff778 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1658,6 +1658,9 @@ typedef struct malloc_chunk *mfastbinptr;
#define arena_is_corrupt(A) (((A)->flags & ARENA_CORRUPTION_BIT))
#define set_arena_corrupt(A) ((A)->flags |= ARENA_CORRUPTION_BIT)
+/* Maximum size of memory handled in fastbins. */
+static INTERNAL_SIZE_T global_max_fast;
+
/*
Set value of max_fast.
Use impossibly small value if 0.
@@ -1668,8 +1671,20 @@ typedef struct malloc_chunk *mfastbinptr;
#define set_max_fast(s) \
global_max_fast = (((s) == 0) \
? SMALLBIN_WIDTH : ((s + SIZE_SZ) & ~MALLOC_ALIGN_MASK))
-#define get_max_fast() global_max_fast
+static inline INTERNAL_SIZE_T
+get_max_fast (void)
+{
+ /* Tell the GCC optimizers that global_max_fast is never larger
+ than MAX_FAST_SIZE. This avoids out-of-bounds array accesses in
+ _int_malloc after constant propagation of the size parameter.
+ (The code never executes because malloc preserves the
+ global_max_fast invariant, but the optimizers may not recognize
+ this.) */
+ if (global_max_fast > MAX_FAST_SIZE)
+ __builtin_unreachable ();
+ return global_max_fast;
+}
/*
----------- Internal state representation and initialization -----------
@@ -1797,9 +1812,6 @@ static struct malloc_par mp_ =
#endif
};
-/* Maximum size of memory handled in fastbins. */
-static INTERNAL_SIZE_T global_max_fast;
-
/*
Initialize a malloc_state struct.
--
2.7.4.GIT

View file

@ -0,0 +1,79 @@
From 2aa1a7a8f8b9b7879bc6eb1c34d1580f992c406d Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 11 Aug 2017 15:48:14 +0200
Subject: [PATCH 08] assert: Suppress pedantic warning caused by statement
expression [BZ #21242]
(cherry picked from commit 8b2c63e4e2ad1fd161f80004ed30624f2a37b57b)
---
ChangeLog | 7 +++++++
NEWS | 1 +
assert/assert.h | 12 +++++++++---
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5ea9b8b..0057c09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-08-11 Florian Weimer <fweimer@redhat.com>
+
+ [BZ #21242]
+ * assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert):
+ Suppress pedantic warning resulting from statement expression.
+ (__ASSERT_FUNCTION): Add missing __extension__.
+
2017-08-10 Florian Weimer <fweimer@redhat.com>
* malloc/malloc.c (get_max_fast): Reimplement as an inline
diff --git a/NEWS b/NEWS
index ec6cf34..d57c405 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Version 2.26.1
The following bugs are resolved with this release:
+ [21242] assert: Suppress pedantic warning caused by statement expression
[21885] getaddrinfo: Release resolver context on error in gethosts
[21932] Unpaired __resolv_context_get in generic get*_r implementation
diff --git a/assert/assert.h b/assert/assert.h
index 22f0195..6801cfe 100644
--- a/assert/assert.h
+++ b/assert/assert.h
@@ -91,13 +91,19 @@ __END_DECLS
? __ASSERT_VOID_CAST (0) \
: __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION))
# else
+/* The first occurrence of EXPR is not evaluated due to the sizeof,
+ but will trigger any pedantic warnings masked by the __extension__
+ for the second occurrence. The explicit comparison against zero is
+ required to support function pointers and bit fields in this
+ context, and to suppress the evaluation of variable length
+ arrays. */
# define assert(expr) \
- ({ \
+ ((void) sizeof ((expr) == 0), __extension__ ({ \
if (expr) \
; /* empty */ \
else \
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
- })
+ }))
# endif
# ifdef __USE_GNU
@@ -113,7 +119,7 @@ __END_DECLS
C9x has a similar variable called __func__, but prefer the GCC one since
it demangles C++ function names. */
# if defined __cplusplus ? __GNUC_PREREQ (2, 6) : __GNUC_PREREQ (2, 4)
-# define __ASSERT_FUNCTION __PRETTY_FUNCTION__
+# define __ASSERT_FUNCTION __extension__ __PRETTY_FUNCTION__
# else
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNCTION __func__
--
2.7.4.GIT

View file

@ -0,0 +1,83 @@
From 645b7635ba8fd58062245419e8bb668ab90cd3ec Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
Date: Mon, 7 Aug 2017 09:14:14 -0300
Subject: [PATCH 09] powerpc: Restrict xssqrtqp operands to Vector Registers
(bug 21941)
POWER ISA 3.0 introduces the xssqrtqp instructions, which expects
operands to be in Vector Registers (Altivec/VMX), even though this
instruction belongs to the Vector-Scalar Instruction Set.
In GCC's Extended Assembly for POWER, the 'wq' register constraint is
provided for use with IEEE 754 128-bit floating-point values. However,
this constraint does not limit the register allocation to Vector
Registers (Altivec/VMX) and could assign a Vector-Scalar Register (VSX)
to the operands of the instruction.
This patch changes the register constraint used in sqrtf128 from 'wq' to
'v', in order to request a Vector Register (Altivec/VMX) for use with
the xssqrtqp instruction.
Tested for powerpc64le and --with-cpu=power9.
[BZ #21941]
* sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
xssqrtqp requires operands to be in Vector Registers
(Altivec/VMX), replace the register constraint 'wq' with 'v'.
* sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
(__ieee754_sqrtf128): Likewise.
(cherry picked from commit 4d98ace9de3183309cb394cd0110eda5ad2d2531)
---
ChangeLog | 9 +++++++++
sysdeps/powerpc/fpu/math_private.h | 2 +-
sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0057c09..6886cd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-08-10 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
+
+ [BZ #21941]
+ * sysdeps/powerpc/fpu/math_private.h (__ieee754_sqrtf128): Since
+ xssqrtqp requires operands to be in Vector Registers
+ (Altivec/VMX), replace the register constraint 'wq' with 'v'.
+ * sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
+ (__ieee754_sqrtf128): Likewise.
+
2017-08-11 Florian Weimer <fweimer@redhat.com>
[BZ #21242]
diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
index d8fd492..396fd05 100644
--- a/sysdeps/powerpc/fpu/math_private.h
+++ b/sysdeps/powerpc/fpu/math_private.h
@@ -30,7 +30,7 @@ extern __always_inline _Float128
__ieee754_sqrtf128 (_Float128 __x)
{
_Float128 __z;
- asm ("xssqrtqp %0,%1" : "=wq" (__z) : "wq" (__x));
+ asm ("xssqrtqp %0,%1" : "=v" (__z) : "v" (__x));
return __z;
}
#endif
diff --git a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
index 769d3f8..59fd826 100644
--- a/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
+++ b/sysdeps/powerpc/powerpc64le/power9/fpu/e_sqrtf128.c
@@ -30,7 +30,7 @@ __float128
__ieee754_sqrtf128 (__float128 a)
{
__float128 z;
- asm ("xssqrtqp %0,%1" : "=wq" (z) : "wq" (a));
+ asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a));
return z;
}
strong_alias (__ieee754_sqrtf128, __sqrtf128_finite)
--
2.7.4.GIT

View file

@ -0,0 +1,77 @@
From c2921b17a37e887b8a5ca9d84b875b9ba702b79c Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
Date: Mon, 21 Aug 2017 14:23:27 +0200
Subject: [PATCH 10] Do not use __builtin_types_compatible_p in C++ mode
(bug 21930)
The logic to define isinf for float128 depends on the availability of
__builtin_types_compatible_p, which is only available in C mode,
however, the conditionals do not check for C or C++ mode. This lead to
an error in libstdc++ configure, as reported by bug 21930.
This patch adds a conditional for C mode in the definition of isinf for
float128. No definition is provided in C++ mode, since libstdc++
headers undefine isinf.
Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).
[BZ #21930]
* math/math.h (isinf): Check if in C or C++ mode before using
__builtin_types_compatible_p, since this is a C mode feature.
(cherry picked from commit 47a67213a9f51c5f8816d240500b10db605d8b77)
---
ChangeLog | 6 ++++++
NEWS | 1 +
math/math.h | 8 ++++++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6886cd9..415fa3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
+
+ [BZ #21930]
+ * math/math.h (isinf): Check if in C or C++ mode before using
+ __builtin_types_compatible_p, since this is a C mode feature.
+
2017-08-10 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
[BZ #21941]
diff --git a/NEWS b/NEWS
index d57c405..75b82c8 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ The following bugs are resolved with this release:
[21242] assert: Suppress pedantic warning caused by statement expression
[21885] getaddrinfo: Release resolver context on error in gethosts
+ [21930] Do not use __builtin_types_compatible_p in C++ mode
[21932] Unpaired __resolv_context_get in generic get*_r implementation
Version 2.26
diff --git a/math/math.h b/math/math.h
index e217080..dea8dbe 100644
--- a/math/math.h
+++ b/math/math.h
@@ -442,8 +442,12 @@ enum
/* Return nonzero value if X is positive or negative infinity. */
# if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
- && !defined __SUPPORT_SNAN__
- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */
+ && !defined __SUPPORT_SNAN__ && !defined __cplusplus
+ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
+ use the helper function, __isinff128, with older compilers. This is
+ only provided for C mode, because in C++ mode, GCC has no support
+ for __builtin_types_compatible_p (and when in C++ mode, this macro is
+ not used anyway, because libstdc++ headers undefine it). */
# define isinf(x) \
(__builtin_types_compatible_p (__typeof (x), _Float128) \
? __isinff128 (x) : __builtin_isinf_sign (x))
--
2.7.4.GIT

View file

@ -0,0 +1,70 @@
From 5e989c36934d0f0cf13b7a53ef2fa440bce39210 Mon Sep 17 00:00:00 2001
From: "Gabriel F. T. Gomes" <gftg@linux.vnet.ibm.com>
Date: Mon, 14 Aug 2017 17:51:51 -0300
Subject: [PATCH 11] Do not use generic selection in C++ mode
The logic to protect the use of generic selection (_Generic) does not
check for C or C++ mode, however, generic selection is a C-only
feature.
Tested for powerpc64le.
* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
in C++ mode.
(cherry picked from commit 6913ad65e00bb32417ad39c41d292b976171e27e)
---
ChangeLog | 5 +++++
misc/sys/cdefs.h | 19 ++++++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 415fa3c..23c00ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
+ * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
+ in C++ mode.
+
+2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
+
[BZ #21930]
* math/math.h (isinf): Check if in C or C++ mode before using
__builtin_types_compatible_p, since this is a C mode feature.
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 06523bf..0c80821 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -464,17 +464,18 @@
# define __glibc_macro_warning(msg)
#endif
-/* Support for generic selection (ISO C11) is available in GCC since
- version 4.9. Previous versions do not provide generic selection,
- even though they might set __STDC_VERSION__ to 201112L, when in
- -std=c11 mode. Thus, we must check for !defined __GNUC__ when
- testing __STDC_VERSION__ for generic selection support.
+/* Generic selection (ISO C11) is a C-only feature, available in GCC
+ since version 4.9. Previous versions do not provide generic
+ selection, even though they might set __STDC_VERSION__ to 201112L,
+ when in -std=c11 mode. Thus, we must check for !defined __GNUC__
+ when testing __STDC_VERSION__ for generic selection support.
On the other hand, Clang also defines __GNUC__, so a clang-specific
check is required to enable the use of generic selection. */
-#if __GNUC_PREREQ (4, 9) \
- || __glibc_clang_has_extension (c_generic_selections) \
- || (!defined __GNUC__ && defined __STDC_VERSION__ \
- && __STDC_VERSION__ >= 201112L)
+#if !defined __cplusplus \
+ && (__GNUC_PREREQ (4, 9) \
+ || __glibc_clang_has_extension (c_generic_selections) \
+ || (!defined __GNUC__ && defined __STDC_VERSION__ \
+ && __STDC_VERSION__ >= 201112L))
# define __HAVE_GENERIC_SELECTION 1
#else
# define __HAVE_GENERIC_SELECTION 0
--
2.7.4.GIT

View file

@ -1,7 +1,7 @@
# Template file for 'glibc'
pkgname=glibc
version=2.26
revision=1
revision=2
bootstrap=yes
short_desc="The GNU C library"
maintainer="Juan RP <xtraeme@voidlinux.eu>"