commit dc258ce62ae0bbb456c6a855dbb6b384ecf7e988
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Aug 3 13:59:17 2017 +0200

    getaddrinfo: Release resolver context on error in gethosts [BZ #21885]
    
    (cherry picked from commit 964263bb8d650f1681665c55704fb01a8e725621)

diff --git a/ChangeLog b/ChangeLog
index 8dbfc7eaff..28ce9c8479 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 8295f20c0a..9a64579658 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 efa7118498..699411cc92 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;						      \
       }									      \

commit 665ce88d68fd13c5c4cbaf2808434c618745137c
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Thu Aug 3 22:33:19 2017 +0000

    i686/multiarch: Regenerate ulps
    
    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)

diff --git a/ChangeLog b/ChangeLog
index 28ce9c8479..3478699b10 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 81dd1a09ea..053f5ec972 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

commit a4e5aa1a443cfad09bc98f9bb527995371a53a88
Author: Aurelien Jarno <aurelien@aurel32.net>
Date:   Thu Aug 3 22:35:48 2017 +0000

    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)

diff --git a/ChangeLog b/ChangeLog
index 3478699b10..4357ad1eb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+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.
diff --git a/stdlib/getentropy.c b/stdlib/getentropy.c
index a71d4cd8f5..a88bbf8de3 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);

commit 799859f6635d68487ea2472bd79d96a7639a1ab1
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Aug 6 10:44:30 2017 -0700

    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)

diff --git a/ChangeLog b/ChangeLog
index 4357ad1eb8..764c827161 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 1d087ea732..6f900840d4 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;
 
