From c0dd082d433d887474bc05e1bf45d95ef2d40bbbc922a6d396189b36fdb41d4e Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 28 Sep 2017 14:37:11 +0000 Subject: [PATCH] Accepting request 529148 from home:Andreas_Schwab:Factory - assert-pedantic.patch: Suppress pedantic warning caused by statement expression (BZ #21242, BZ #21972) - math-c++-compat.patch: Add more C++ compatibility - getaddrinfo-errno.patch: Fix errno and h_errno handling in getaddrinfo (BZ #21915, BZ #21922) - resolv-conf-oom.patch: Fix memory handling in OOM situation during resolv.conf parsing (BZ #22095, BZ #22096) - dynarray-enlarge.patch: Fix initial size of dynarray allocation and set errno on overflow error - nearbyint-inexact.patch: Avoid spurious inexact in nearbyint (BZ #22225) OBS-URL: https://build.opensuse.org/request/show/529148 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=479 --- assert-pedantic.patch | 192 +++++++++++ dynarray-allocation.patch | 127 ++++++++ getaddrinfo-errno.patch | 649 ++++++++++++++++++++++++++++++++++++++ glibc-testsuite.changes | 14 + glibc-testsuite.spec | 17 +- glibc-utils.changes | 14 + glibc-utils.spec | 17 +- glibc.changes | 14 + glibc.spec | 17 +- math-c++-compat.patch | 37 +++ nearbyint-inexact.patch | 107 +++++++ resolv-conf-oom.patch | 44 +++ 12 files changed, 1246 insertions(+), 3 deletions(-) create mode 100644 assert-pedantic.patch create mode 100644 dynarray-allocation.patch create mode 100644 getaddrinfo-errno.patch create mode 100644 nearbyint-inexact.patch create mode 100644 resolv-conf-oom.patch diff --git a/assert-pedantic.patch b/assert-pedantic.patch new file mode 100644 index 0000000..4d7c9d1 --- /dev/null +++ b/assert-pedantic.patch @@ -0,0 +1,192 @@ +2017-08-21 Florian Weimer + + [BZ #21972] + * assert/assert.h (assert): Use static_cast (bool) for C++. + Use the ternary operator in the warning branch for GNU C. + * assert/Makefile (tests): Add tst-assert-c++, tst-assert-g++. + (CFLAGS-tst-assert-c++.o): Compile in C++11 mode. + (CFLAGS-tst-assert-g++.o): Compile in GnU C++11 mode. + (LDLIBS-tst-assert-c++, LDLIBS-tst-assert-g++): Link with libstdc++. + * assert/tst-assert-c++.cc, assert/tst-assert-g++.cc: New files. + +2017-08-11 Florian Weimer + + [BZ #21242] + * assert/assert.h [__GNUC__ && !__STRICT_ANSI__] (assert): + Suppress pedantic warning resulting from statement expression. + (__ASSERT_FUNCTION): Add missing __extension__. + +Index: glibc-2.26/assert/Makefile +=================================================================== +--- glibc-2.26.orig/assert/Makefile ++++ glibc-2.26/assert/Makefile +@@ -25,6 +25,15 @@ include ../Makeconfig + headers := assert.h + + routines := assert assert-perr __assert +-tests := test-assert test-assert-perr ++tests := test-assert test-assert-perr tst-assert-c++ tst-assert-g++ + + include ../Rules ++ ++ifeq ($(have-cxx-thread_local),yes) ++CFLAGS-tst-assert-c++.o = -std=c++11 ++LDLIBS-tst-assert-c++ = -lstdc++ ++CFLAGS-tst-assert-g++.o = -std=gnu++11 ++LDLIBS-tst-assert-g++ = -lstdc++ ++else ++tests-unsupported += tst-assert-c++ tst-assert-g++ ++endif +Index: glibc-2.26/assert/assert.h +=================================================================== +--- glibc-2.26.orig/assert/assert.h ++++ glibc-2.26/assert/assert.h +@@ -85,19 +85,29 @@ __END_DECLS + /* When possible, define assert so that it does not add extra + parentheses around EXPR. Otherwise, those added parentheses would + suppress warnings we'd expect to be detected by gcc's -Wparentheses. */ +-# if !defined __GNUC__ || defined __STRICT_ANSI__ ++# if defined __cplusplus ++# define assert(expr) \ ++ (static_cast (expr) \ ++ ? void (0) \ ++ : __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION)) ++# elif !defined __GNUC__ || defined __STRICT_ANSI__ + # define assert(expr) \ + ((expr) \ + ? __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 ternary operator 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) ? 1 : 0), __extension__ ({ \ + if (expr) \ + ; /* empty */ \ + else \ + __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \ +- }) ++ })) + # endif + + # ifdef __USE_GNU +@@ -113,7 +123,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__ +Index: glibc-2.26/assert/tst-assert-c++.cc +=================================================================== +--- /dev/null ++++ glibc-2.26/assert/tst-assert-c++.cc +@@ -0,0 +1,78 @@ ++/* Tests for interactions between C++ and assert. ++ Copyright (C) 2017 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 ++ . */ ++ ++#include ++ ++/* The C++ standard requires that if the assert argument is a constant ++ subexpression, then the assert itself is one, too. */ ++constexpr int ++check_constexpr () ++{ ++ return (assert (true), 1); ++} ++ ++/* Objects of this class can be contextually converted to bool, but ++ cannot be compared to int. */ ++struct no_int ++{ ++ no_int () = default; ++ no_int (const no_int &) = delete; ++ ++ explicit operator bool () const ++ { ++ return true; ++ } ++ ++ bool operator! () const; /* No definition. */ ++ template bool operator== (T) const; /* No definition. */ ++ template bool operator!= (T) const; /* No definition. */ ++}; ++ ++/* This class tests that operator== is not used by assert. */ ++struct bool_and_int ++{ ++ bool_and_int () = default; ++ bool_and_int (const no_int &) = delete; ++ ++ explicit operator bool () const ++ { ++ return true; ++ } ++ ++ bool operator! () const; /* No definition. */ ++ template bool operator== (T) const; /* No definition. */ ++ template bool operator!= (T) const; /* No definition. */ ++}; ++ ++static int ++do_test () ++{ ++ { ++ no_int value; ++ assert (value); ++ } ++ ++ { ++ bool_and_int value; ++ assert (value); ++ } ++ ++ return 0; ++} ++ ++#include +Index: glibc-2.26/assert/tst-assert-g++.cc +=================================================================== +--- /dev/null ++++ glibc-2.26/assert/tst-assert-g++.cc +@@ -0,0 +1,19 @@ ++/* Tests for interactions between C++ and assert. GNU C++11 version. ++ Copyright (C) 2017 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 ++ . */ ++ ++#include diff --git a/dynarray-allocation.patch b/dynarray-allocation.patch new file mode 100644 index 0000000..a67b56e --- /dev/null +++ b/dynarray-allocation.patch @@ -0,0 +1,127 @@ +2017-08-30 Florian Weimer + + * malloc/dynarray_emplace_enlarge.c + (__libc_dynarray_emplace_enlarge): Set errno on overflow. + * malloc/dynarray_resize.c (__libc_dynarray_resize): Likewise. + * malloc/tst-dynarray.c (test_long_overflow): New function. + (do_test): Call it. + +2017-09-06 Florian Weimer + + * malloc/dynarray_emplace_enlarge.c + (__libc_dynarray_emplace_enlarge): Add missing else. + +Index: glibc-2.26/malloc/dynarray_emplace_enlarge.c +=================================================================== +--- glibc-2.26.orig/malloc/dynarray_emplace_enlarge.c ++++ glibc-2.26/malloc/dynarray_emplace_enlarge.c +@@ -17,6 +17,7 @@ + . */ + + #include ++#include + #include + #include + #include +@@ -32,7 +33,7 @@ __libc_dynarray_emplace_enlarge (struct + size. */ + if (element_size < 4) + new_allocated = 16; +- if (element_size < 8) ++ else if (element_size < 8) + new_allocated = 8; + else + new_allocated = 4; +@@ -43,8 +44,11 @@ __libc_dynarray_emplace_enlarge (struct + { + new_allocated = list->allocated + list->allocated / 2 + 1; + if (new_allocated <= list->allocated) +- /* Overflow. */ +- return false; ++ { ++ /* Overflow. */ ++ __set_errno (ENOMEM); ++ return false; ++ } + } + + size_t new_size; +Index: glibc-2.26/malloc/dynarray_resize.c +=================================================================== +--- glibc-2.26.orig/malloc/dynarray_resize.c ++++ glibc-2.26/malloc/dynarray_resize.c +@@ -17,6 +17,7 @@ + . */ + + #include ++#include + #include + #include + #include +@@ -38,7 +39,11 @@ __libc_dynarray_resize (struct dynarray_ + + size_t new_size_bytes; + if (check_mul_overflow_size_t (size, element_size, &new_size_bytes)) +- return false; ++ { ++ /* Overflow. */ ++ __set_errno (ENOMEM); ++ return false; ++ } + void *new_array; + if (list->array == scratch) + { +Index: glibc-2.26/malloc/tst-dynarray.c +=================================================================== +--- glibc-2.26.orig/malloc/tst-dynarray.c ++++ glibc-2.26/malloc/tst-dynarray.c +@@ -18,6 +18,9 @@ + + #include "tst-dynarray-shared.h" + ++#include ++#include ++ + #define DYNARRAY_STRUCT dynarray_long + #define DYNARRAY_ELEMENT long + #define DYNARRAY_PREFIX dynarray_long_ +@@ -463,6 +466,31 @@ test_long_init (void) + } + } + ++/* Test overflow in resize. */ ++static void ++test_long_overflow (void) ++{ ++ { ++ struct dynarray_long dyn; ++ dynarray_long_init (&dyn); ++ errno = EINVAL; ++ TEST_VERIFY (!dynarray_long_resize ++ (&dyn, (SIZE_MAX / sizeof (long)) + 1)); ++ TEST_VERIFY (errno == ENOMEM); ++ TEST_VERIFY (dynarray_long_has_failed (&dyn)); ++ } ++ ++ { ++ struct dynarray_long_noscratch dyn; ++ dynarray_long_noscratch_init (&dyn); ++ errno = EINVAL; ++ TEST_VERIFY (!dynarray_long_noscratch_resize ++ (&dyn, (SIZE_MAX / sizeof (long)) + 1)); ++ TEST_VERIFY (errno == ENOMEM); ++ TEST_VERIFY (dynarray_long_noscratch_has_failed (&dyn)); ++ } ++} ++ + /* Test NUL-terminated string construction with the add function and + the simple finalize function. */ + static void +@@ -538,6 +566,7 @@ do_test (void) + test_int (); + test_str (); + test_long_init (); ++ test_long_overflow (); + test_zstr (); + return 0; + } diff --git a/getaddrinfo-errno.patch b/getaddrinfo-errno.patch new file mode 100644 index 0000000..9b05528 --- /dev/null +++ b/getaddrinfo-errno.patch @@ -0,0 +1,649 @@ +2017-09-01 Florian Weimer + + [BZ #21915] + [BZ #21922] + * sysdeps/posix/getaddrinfo.c (gethosts): Look at NSS function + result to determine success or failure, not the errno value. + * nss/Makefile (tests): Add tst-nss-files-hosts-erange. + (tst-nss-files-hosts-erange): Link with -ldl. + * nss/tst-nss-files-hosts-erange.c: New file. + * nss/tst-resolv-basic.c (response): Handle nodata.example. + (do_test): Add NO_DATA tests. + * resolv/tst-resolv-basic.c (test_nodata_nxdomain): New function. + (do_test): Call it. + +2017-09-01 Florian Weimer + + [BZ #21922] + * sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error + coming from gethostbyname2_r. + +2017-09-01 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if + status indicates it is set. + +2017-09-01 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS + function lookup failures more reliable. + +2017-09-01 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly. + (getcanonname): Likewise. + (gaih_inet): Likewise. + +2017-09-01 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gethosts): Use errno directly. + (getcanonname): Likewise. + (gaih_inet): Likewise. + +2017-08-08 Florian Weimer + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Remove unreachable + return statement. + +Index: glibc-2.26/nss/Makefile +=================================================================== +--- glibc-2.26.orig/nss/Makefile ++++ glibc-2.26/nss/Makefile +@@ -58,6 +58,11 @@ tests = test-netdb test-digits-dots ts + tst-nss-test5 + xtests = bug-erange + ++# Tests which need libdl ++ifeq (yes,$(build-shared)) ++tests += tst-nss-files-hosts-erange ++endif ++ + # If we have a thread library then we can test cancellation against + # some routines like getpwuid_r. + ifeq (yes,$(have-thread-library)) +@@ -154,3 +159,5 @@ $(patsubst %,$(objpfx)%.out,$(tests)) : + ifeq (yes,$(have-thread-library)) + $(objpfx)tst-cancel-getpwuid_r: $(shared-thread-library) + endif ++ ++$(objpfx)tst-nss-files-hosts-erange: $(libdl) +Index: glibc-2.26/nss/tst-nss-files-hosts-erange.c +=================================================================== +--- /dev/null ++++ glibc-2.26/nss/tst-nss-files-hosts-erange.c +@@ -0,0 +1,109 @@ ++/* Parse /etc/hosts in multi mode with a trailing long line (bug 21915). ++ Copyright (C) 2017 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 ++ . */ ++ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct support_chroot *chroot_env; ++ ++#define X10 "XXXXXXXXXX" ++#define X100 X10 X10 X10 X10 X10 X10 X10 X10 X10 X10 ++#define X1000 X100 X100 X100 X100 X100 X100 X100 X100 X100 X100 ++ ++static void ++prepare (int argc, char **argv) ++{ ++ chroot_env = support_chroot_create ++ ((struct support_chroot_configuration) ++ { ++ .resolv_conf = "", ++ .hosts = ++ "127.0.0.1 localhost localhost.localdomain\n" ++ "::1 localhost localhost.localdomain\n" ++ "192.0.2.1 example.com\n" ++ "#" X1000 X100 "\n", ++ .host_conf = "multi on\n", ++ }); ++} ++ ++static int ++do_test (void) ++{ ++ support_become_root (); ++ if (!support_can_chroot ()) ++ return EXIT_UNSUPPORTED; ++ ++ __nss_configure_lookup ("hosts", "files"); ++ if (dlopen (LIBNSS_FILES_SO, RTLD_LAZY) == NULL) ++ FAIL_EXIT1 ("could not load " LIBNSS_DNS_SO ": %s", dlerror ()); ++ ++ xchroot (chroot_env->path_chroot); ++ ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ check_hostent ("gethostbyname example.com", ++ gethostbyname ("example.com"), ++ "name: example.com\n" ++ "address: 192.0.2.1\n"); ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ check_hostent ("gethostbyname2 AF_INET example.com", ++ gethostbyname2 ("example.com", AF_INET), ++ "name: example.com\n" ++ "address: 192.0.2.1\n"); ++ { ++ struct addrinfo hints = ++ { ++ .ai_family = AF_UNSPEC, ++ .ai_socktype = SOCK_STREAM, ++ .ai_protocol = IPPROTO_TCP, ++ }; ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ struct addrinfo *ai; ++ int ret = getaddrinfo ("example.com", "80", &hints, &ai); ++ check_addrinfo ("example.com AF_UNSPEC", ai, ret, ++ "address: STREAM/TCP 192.0.2.1 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ ++ hints.ai_family = AF_INET; ++ errno = ERANGE; ++ h_errno = NETDB_INTERNAL; ++ ret = getaddrinfo ("example.com", "80", &hints, &ai); ++ check_addrinfo ("example.com AF_INET", ai, ret, ++ "address: STREAM/TCP 192.0.2.1 80\n"); ++ if (ret == 0) ++ freeaddrinfo (ai); ++ } ++ ++ support_chroot_free (chroot_env); ++ return 0; ++} ++ ++#define PREPARE prepare ++#include +Index: glibc-2.26/resolv/tst-resolv-basic.c +=================================================================== +--- glibc-2.26.orig/resolv/tst-resolv-basic.c ++++ glibc-2.26/resolv/tst-resolv-basic.c +@@ -50,7 +50,7 @@ response (const struct resolv_response_c + qname_compare = qname + 2; + else + qname_compare = qname; +- enum {www, alias, nxdomain, long_name} requested_qname; ++ enum {www, alias, nxdomain, long_name, nodata} requested_qname; + if (strcmp (qname_compare, "www.example") == 0) + requested_qname = www; + else if (strcmp (qname_compare, "alias.example") == 0) +@@ -59,6 +59,8 @@ response (const struct resolv_response_c + requested_qname = nxdomain; + else if (strcmp (qname_compare, LONG_NAME) == 0) + requested_qname = long_name; ++ else if (strcmp (qname_compare, "nodata.example") == 0) ++ requested_qname = nodata; + else + { + support_record_failure (); +@@ -87,6 +89,8 @@ response (const struct resolv_response_c + resolv_response_close_record (b); + resolv_response_open_record (b, "www.example", qclass, qtype, 0); + break; ++ case nodata: ++ return; + case nxdomain: + FAIL_EXIT1 ("unreachable"); + } +@@ -267,6 +271,55 @@ test_bug_21295 (void) + } + } + ++/* Run tests which do not expect any data. */ ++static void ++test_nodata_nxdomain (void) ++{ ++ /* Iterate through different address families. */ ++ int families[] = { AF_UNSPEC, AF_INET, AF_INET6, -1 }; ++ for (int i = 0; families[i] >= 0; ++i) ++ /* If do_tcp, prepend "t." to the name to trigger TCP ++ fallback. */ ++ for (int do_tcp = 0; do_tcp < 2; ++do_tcp) ++ /* If do_nxdomain, trigger an NXDOMAIN error (DNS failure), ++ otherwise use a NODATA response (empty but successful ++ answer). */ ++ for (int do_nxdomain = 0; do_nxdomain < 2; ++do_nxdomain) ++ { ++ int family = families[i]; ++ char *name = xasprintf ("%s%s.example", ++ do_tcp ? "t." : "", ++ do_nxdomain ? "nxdomain" : "nodata"); ++ ++ if (family != AF_UNSPEC) ++ { ++ if (do_nxdomain) ++ check_h (name, family, "error: HOST_NOT_FOUND\n"); ++ else ++ check_h (name, family, "error: NO_ADDRESS\n"); ++ } ++ ++ const char *expected; ++ if (do_nxdomain) ++ expected = "error: Name or service not known\n"; ++ else ++ expected = "error: No address associated with hostname\n"; ++ ++ check_ai (name, "80", family, expected); ++ ++ struct addrinfo hints = ++ { ++ .ai_family = family, ++ .ai_flags = AI_V4MAPPED | AI_ALL, ++ }; ++ check_ai_hints (name, "80", hints, expected); ++ hints.ai_flags |= AI_CANONNAME; ++ check_ai_hints (name, "80", hints, expected); ++ ++ free (name); ++ } ++} ++ + static int + do_test (void) + { +@@ -439,29 +492,8 @@ do_test (void) + "address: DGRAM/UDP 2001:db8::4 80\n" + "address: RAW/IP 2001:db8::4 80\n"); + +- check_h ("nxdomain.example", AF_INET, +- "error: HOST_NOT_FOUND\n"); +- check_h ("nxdomain.example", AF_INET6, +- "error: HOST_NOT_FOUND\n"); +- check_ai ("nxdomain.example", "80", AF_UNSPEC, +- "error: Name or service not known\n"); +- check_ai ("nxdomain.example", "80", AF_INET, +- "error: Name or service not known\n"); +- check_ai ("nxdomain.example", "80", AF_INET6, +- "error: Name or service not known\n"); +- +- check_h ("t.nxdomain.example", AF_INET, +- "error: HOST_NOT_FOUND\n"); +- check_h ("t.nxdomain.example", AF_INET6, +- "error: HOST_NOT_FOUND\n"); +- check_ai ("t.nxdomain.example", "80", AF_UNSPEC, +- "error: Name or service not known\n"); +- check_ai ("t.nxdomain.example", "80", AF_INET, +- "error: Name or service not known\n"); +- check_ai ("t.nxdomain.example", "80", AF_INET6, +- "error: Name or service not known\n"); +- + test_bug_21295 (); ++ test_nodata_nxdomain (); + + resolv_test_end (aux); + +Index: glibc-2.26/support/namespace.h +=================================================================== +--- glibc-2.26.orig/support/namespace.h ++++ glibc-2.26/support/namespace.h +@@ -66,7 +66,9 @@ struct support_chroot_configuration + { + /* File contents. The files are not created if the field is + NULL. */ +- const char *resolv_conf; ++ const char *resolv_conf; /* /etc/resolv.conf. */ ++ const char *hosts; /* /etc/hosts. */ ++ const char *host_conf; /* /etc/host.conf. */ + }; + + /* The result of the creation of a chroot. */ +@@ -78,8 +80,11 @@ struct support_chroot + /* Path to the chroot directory. */ + char *path_chroot; + +- /* Path to the /etc/resolv.conf file. */ +- char *path_resolv_conf; ++ /* Paths to files in the chroot. These are absolute and outside of ++ the chroot. */ ++ char *path_resolv_conf; /* /etc/resolv.conf. */ ++ char *path_hosts; /* /etc/hosts. */ ++ char *path_host_conf; /* /etc/host.conf. */ + }; + + /* Create a chroot environment. The returned data should be freed +Index: glibc-2.26/support/support_chroot.c +=================================================================== +--- glibc-2.26.orig/support/support_chroot.c ++++ glibc-2.26/support/support_chroot.c +@@ -24,6 +24,23 @@ + #include + #include + ++/* If CONTENTS is not NULL, write it to the file at DIRECTORY/RELPATH, ++ and store the name in *ABSPATH. If CONTENTS is NULL, store NULL in ++ *ABSPATH. */ ++static void ++write_file (const char *directory, const char *relpath, const char *contents, ++ char **abspath) ++{ ++ if (contents != NULL) ++ { ++ *abspath = xasprintf ("%s/%s", directory, relpath); ++ add_temp_file (*abspath); ++ support_write_file_string (*abspath, contents); ++ } ++ else ++ *abspath = NULL; ++} ++ + struct support_chroot * + support_chroot_create (struct support_chroot_configuration conf) + { +@@ -39,15 +56,10 @@ support_chroot_create (struct support_ch + xmkdir (path_etc, 0777); + add_temp_file (path_etc); + +- if (conf.resolv_conf != NULL) +- { +- /* Create an empty resolv.conf file. */ +- chroot->path_resolv_conf = xasprintf ("%s/resolv.conf", path_etc); +- add_temp_file (chroot->path_resolv_conf); +- support_write_file_string (chroot->path_resolv_conf, conf.resolv_conf); +- } +- else +- chroot->path_resolv_conf = NULL; ++ write_file (path_etc, "resolv.conf", conf.resolv_conf, ++ &chroot->path_resolv_conf); ++ write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts); ++ write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf); + + free (path_etc); + +@@ -67,5 +79,7 @@ support_chroot_free (struct support_chro + { + free (chroot->path_chroot); + free (chroot->path_resolv_conf); ++ free (chroot->path_hosts); ++ free (chroot->path_host_conf); + free (chroot); + } +Index: glibc-2.26/sysdeps/posix/getaddrinfo.c +=================================================================== +--- glibc-2.26.orig/sysdeps/posix/getaddrinfo.c ++++ glibc-2.26/sysdeps/posix/getaddrinfo.c +@@ -241,48 +241,43 @@ convert_hostent_to_gaih_addrtuple (const + + #define gethosts(_family, _type) \ + { \ +- int herrno; \ + struct hostent th; \ +- struct hostent *h; \ + char *localcanon = NULL; \ + no_data = 0; \ +- while (1) { \ +- rc = 0; \ +- status = DL_CALL_FCT (fct, (name, _family, &th, \ +- tmpbuf->data, tmpbuf->length, \ +- &rc, &herrno, NULL, &localcanon)); \ +- if (rc != ERANGE || herrno != NETDB_INTERNAL) \ +- 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; \ +- } \ +- } \ +- if (status == NSS_STATUS_SUCCESS && rc == 0) \ +- h = &th; \ +- else \ +- h = NULL; \ +- if (rc != 0) \ ++ while (1) \ + { \ +- if (herrno == NETDB_INTERNAL) \ ++ status = DL_CALL_FCT (fct, (name, _family, &th, \ ++ tmpbuf->data, tmpbuf->length, \ ++ &errno, &h_errno, NULL, &localcanon)); \ ++ if (status != NSS_STATUS_TRYAGAIN || h_errno != NETDB_INTERNAL \ ++ || errno != ERANGE) \ ++ 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; \ ++ } \ ++ } \ ++ if (status == NSS_STATUS_NOTFOUND \ ++ || status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL) \ ++ { \ ++ if (h_errno == NETDB_INTERNAL) \ + { \ +- __set_h_errno (herrno); \ + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \ + __resolv_context_put (res_ctx); \ + result = -EAI_SYSTEM; \ + goto free_and_return; \ + } \ +- if (herrno == TRY_AGAIN) \ ++ if (h_errno == TRY_AGAIN) \ + no_data = EAI_AGAIN; \ + else \ +- no_data = herrno == NO_DATA; \ ++ no_data = h_errno == NO_DATA; \ + } \ +- else if (h != NULL) \ ++ else if (status == NSS_STATUS_SUCCESS) \ + { \ +- if (!convert_hostent_to_gaih_addrtuple (req, _family,h, &addrmem)) \ ++ if (!convert_hostent_to_gaih_addrtuple (req, _family, &th, &addrmem)) \ + { \ + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); \ + __resolv_context_put (res_ctx); \ +@@ -334,10 +329,8 @@ getcanonname (service_user *nip, struct + if (cfct != NULL) + { + char buf[256]; +- int herrno; +- int rc; + if (DL_CALL_FCT (cfct, (at->name ?: name, buf, sizeof (buf), +- &s, &rc, &herrno)) != NSS_STATUS_SUCCESS) ++ &s, &errno, &h_errno)) != NSS_STATUS_SUCCESS) + /* If the canonical name cannot be determined, use the passed + string. */ + s = (char *) name; +@@ -353,7 +346,6 @@ gaih_inet (const char *name, const struc + const struct gaih_typeproto *tp = gaih_inet_typeproto; + struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; + struct gaih_addrtuple *at = NULL; +- int rc; + bool got_ipv6 = false; + const char *canon = NULL; + const char *orig_name = name; +@@ -395,7 +387,8 @@ gaih_inet (const char *name, const struc + st = (struct gaih_servtuple *) + alloca_account (sizeof (struct gaih_servtuple), alloca_used); + +- if ((rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf))) ++ int rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf); ++ if (__glibc_unlikely (rc != 0)) + return rc; + } + else +@@ -420,13 +413,9 @@ gaih_inet (const char *name, const struc + alloca_account (sizeof (struct gaih_servtuple), + alloca_used); + +- if ((rc = gaih_inet_serv (service->name, +- tp, req, newp, tmpbuf))) +- { +- if (rc) +- continue; +- return rc; +- } ++ if (gaih_inet_serv (service->name, ++ tp, req, newp, tmpbuf) != 0) ++ continue; + + *pst = newp; + pst = &(newp->next); +@@ -499,7 +488,7 @@ gaih_inet (const char *name, const struc + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + + char *p = NULL; +- rc = __idna_to_ascii_lz (name, &p, idn_flags); ++ int rc = __idna_to_ascii_lz (name, &p, idn_flags); + if (rc != IDNA_SUCCESS) + { + /* No need to jump to free_and_return here. */ +@@ -600,14 +589,13 @@ gaih_inet (const char *name, const struc + int rc; + struct hostent th; + struct hostent *h; +- int herrno; + + while (1) + { + rc = __gethostbyname2_r (name, AF_INET, &th, + tmpbuf->data, tmpbuf->length, +- &h, &herrno); +- if (rc != ERANGE || herrno != NETDB_INTERNAL) ++ &h, &h_errno); ++ if (rc != ERANGE || h_errno != NETDB_INTERNAL) + break; + if (!scratch_buffer_grow (tmpbuf)) + { +@@ -629,15 +617,20 @@ gaih_inet (const char *name, const struc + } + *pat = addrmem; + } ++ else ++ { ++ if (h_errno == NO_DATA) ++ result = -EAI_NODATA; ++ else ++ result = -EAI_NONAME; ++ goto free_and_return; ++ } + } + else + { +- if (herrno == NETDB_INTERNAL) +- { +- __set_h_errno (herrno); +- result = -EAI_SYSTEM; +- } +- else if (herrno == TRY_AGAIN) ++ if (h_errno == NETDB_INTERNAL) ++ result = -EAI_SYSTEM; ++ else if (h_errno == TRY_AGAIN) + result = -EAI_AGAIN; + else + /* We made requests but they turned out no data. +@@ -660,8 +653,7 @@ gaih_inet (const char *name, const struc + { + /* Try to use nscd. */ + struct nscd_ai_result *air = NULL; +- int herrno; +- int err = __nscd_getai (name, &air, &herrno); ++ int err = __nscd_getai (name, &air, &h_errno); + if (air != NULL) + { + /* Transform into gaih_addrtuple list. */ +@@ -752,9 +744,9 @@ gaih_inet (const char *name, const struc + goto free_and_return; + else if (__nss_not_use_nscd_hosts == 0) + { +- if (herrno == NETDB_INTERNAL && errno == ENOMEM) ++ if (h_errno == NETDB_INTERNAL && errno == ENOMEM) + result = -EAI_MEMORY; +- else if (herrno == TRY_AGAIN) ++ else if (h_errno == TRY_AGAIN) + result = -EAI_AGAIN; + else + result = -EAI_SYSTEM; +@@ -793,24 +785,21 @@ gaih_inet (const char *name, const struc + + if (fct4 != NULL) + { +- int herrno; +- + while (1) + { +- rc = 0; + status = DL_CALL_FCT (fct4, (name, pat, + tmpbuf->data, tmpbuf->length, +- &rc, &herrno, ++ &errno, &h_errno, + NULL)); + if (status == NSS_STATUS_SUCCESS) + break; + if (status != NSS_STATUS_TRYAGAIN +- || rc != ERANGE || herrno != NETDB_INTERNAL) ++ || errno != ERANGE || h_errno != NETDB_INTERNAL) + { +- if (herrno == TRY_AGAIN) ++ if (h_errno == TRY_AGAIN) + no_data = EAI_AGAIN; + else +- no_data = herrno == NO_DATA; ++ no_data = h_errno == NO_DATA; + break; + } + +@@ -940,13 +929,17 @@ gaih_inet (const char *name, const struc + } + else + { ++ /* Could not locate any of the lookup functions. ++ The NSS lookup code does not consistently set ++ errno, so we need to supply our own error ++ code here. The root cause could either be a ++ resource allocation failure, or a missing ++ service function in the DSO (so it should not ++ be listed in /etc/nsswitch.conf). Assume the ++ former, and return EBUSY. */ + status = NSS_STATUS_UNAVAIL; +- /* Could not load any of the lookup functions. Indicate +- an internal error if the failure was due to a system +- error other than the file not being found. We use the +- errno from the last failed callback. */ +- if (errno != 0 && errno != ENOENT) +- __set_h_errno (NETDB_INTERNAL); ++ __set_h_errno (NETDB_INTERNAL); ++ __set_errno (EBUSY); + } + } + +@@ -962,7 +955,10 @@ gaih_inet (const char *name, const struc + __resolv_context_enable_inet6 (res_ctx, res_enable_inet6); + __resolv_context_put (res_ctx); + +- if (h_errno == NETDB_INTERNAL) ++ /* If we have a failure which sets errno, report it using ++ EAI_SYSTEM. */ ++ if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL) ++ && h_errno == NETDB_INTERNAL) + { + result = -EAI_SYSTEM; + goto free_and_return; diff --git a/glibc-testsuite.changes b/glibc-testsuite.changes index 9a69689..316674b 100644 --- a/glibc-testsuite.changes +++ b/glibc-testsuite.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Sep 28 07:57:52 UTC 2017 - schwab@suse.de + +- assert-pedantic.patch: Suppress pedantic warning caused by statement + expression (BZ #21242, BZ #21972) +- math-c++-compat.patch: Add more C++ compatibility +- getaddrinfo-errno.patch: Fix errno and h_errno handling in getaddrinfo + (BZ #21915, BZ #21922) +- resolv-conf-oom.patch: Fix memory handling in OOM situation during + resolv.conf parsing (BZ #22095, BZ #22096) +- dynarray-enlarge.patch: Fix initial size of dynarray allocation and set + errno on overflow error +- nearbyint-inexact.patch: Avoid spurious inexact in nearbyint (BZ #22225) + ------------------------------------------------------------------- Mon Sep 25 10:12:24 UTC 2017 - schwab@suse.de diff --git a/glibc-testsuite.spec b/glibc-testsuite.spec index 8bf4b0d..b2d600a 100644 --- a/glibc-testsuite.spec +++ b/glibc-testsuite.spec @@ -269,7 +269,7 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts +# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts (BZ #21885, BZ #21932) Patch1000: resolv-context-leak.patch # PATCH-FIX-UPSTREAM Use _dl_runtime_resolve_opt only with AVX512F (BZ #21871) Patch1001: dl-runtime-resolve-opt-avx512f.patch @@ -283,6 +283,16 @@ Patch1004: remove-nss-nis-compat.patch Patch1005: eh-frame-zero-terminator.patch # PATCH-FIX-UPSTREAM x86: Add x86_64 to x86-64 HWCAP (BZ #22093) Patch1006: ld-so-hwcap-x86-64.patch +# PATCH-FIX-UPSTREAM assert: Suppress pedantic warning caused by statement expression (BZ #21242, BZ #21972) +Patch1007: assert-pedantic.patch +# PATCH-FIX-UPSTREAM Fix errno and h_errno handling in getaddrinfo (BZ #21915, BZ #21922) +Patch1008: getaddrinfo-errno.patch +# PATCH-FIX-UPSTREAM Fix memory handling in OOM situation during resolv.conf parsing (BZ #22095, BZ #22096) +Patch1009: resolv-conf-oom.patch +# PATCH-FIX-UPSTREAM Fix initial size of dynarray allocation and set errno on overflow error +Patch1010: dynarray-allocation.patch +# PATCH-FIX-UPSTREAM Avoid spurious inexact in nearbyint (BZ #22225) +Patch1011: nearbyint-inexact.patch ### # Patches awaiting upstream approval @@ -519,6 +529,11 @@ rm nscd/s-stamp %patch1004 -p1 %patch1005 -p1 %patch1006 -p1 +%patch1007 -p1 +%patch1008 -p1 +%patch1009 -p1 +%patch1010 -p1 +%patch1011 -p1 %patch2000 -p1 %patch2001 -p1 diff --git a/glibc-utils.changes b/glibc-utils.changes index 9a69689..316674b 100644 --- a/glibc-utils.changes +++ b/glibc-utils.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Sep 28 07:57:52 UTC 2017 - schwab@suse.de + +- assert-pedantic.patch: Suppress pedantic warning caused by statement + expression (BZ #21242, BZ #21972) +- math-c++-compat.patch: Add more C++ compatibility +- getaddrinfo-errno.patch: Fix errno and h_errno handling in getaddrinfo + (BZ #21915, BZ #21922) +- resolv-conf-oom.patch: Fix memory handling in OOM situation during + resolv.conf parsing (BZ #22095, BZ #22096) +- dynarray-enlarge.patch: Fix initial size of dynarray allocation and set + errno on overflow error +- nearbyint-inexact.patch: Avoid spurious inexact in nearbyint (BZ #22225) + ------------------------------------------------------------------- Mon Sep 25 10:12:24 UTC 2017 - schwab@suse.de diff --git a/glibc-utils.spec b/glibc-utils.spec index 865f2a1..0fdf13b 100644 --- a/glibc-utils.spec +++ b/glibc-utils.spec @@ -269,7 +269,7 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts +# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts (BZ #21885, BZ #21932) Patch1000: resolv-context-leak.patch # PATCH-FIX-UPSTREAM Use _dl_runtime_resolve_opt only with AVX512F (BZ #21871) Patch1001: dl-runtime-resolve-opt-avx512f.patch @@ -283,6 +283,16 @@ Patch1004: remove-nss-nis-compat.patch Patch1005: eh-frame-zero-terminator.patch # PATCH-FIX-UPSTREAM x86: Add x86_64 to x86-64 HWCAP (BZ #22093) Patch1006: ld-so-hwcap-x86-64.patch +# PATCH-FIX-UPSTREAM assert: Suppress pedantic warning caused by statement expression (BZ #21242, BZ #21972) +Patch1007: assert-pedantic.patch +# PATCH-FIX-UPSTREAM Fix errno and h_errno handling in getaddrinfo (BZ #21915, BZ #21922) +Patch1008: getaddrinfo-errno.patch +# PATCH-FIX-UPSTREAM Fix memory handling in OOM situation during resolv.conf parsing (BZ #22095, BZ #22096) +Patch1009: resolv-conf-oom.patch +# PATCH-FIX-UPSTREAM Fix initial size of dynarray allocation and set errno on overflow error +Patch1010: dynarray-allocation.patch +# PATCH-FIX-UPSTREAM Avoid spurious inexact in nearbyint (BZ #22225) +Patch1011: nearbyint-inexact.patch ### # Patches awaiting upstream approval @@ -519,6 +529,11 @@ rm nscd/s-stamp %patch1004 -p1 %patch1005 -p1 %patch1006 -p1 +%patch1007 -p1 +%patch1008 -p1 +%patch1009 -p1 +%patch1010 -p1 +%patch1011 -p1 %patch2000 -p1 %patch2001 -p1 diff --git a/glibc.changes b/glibc.changes index 9a69689..316674b 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Thu Sep 28 07:57:52 UTC 2017 - schwab@suse.de + +- assert-pedantic.patch: Suppress pedantic warning caused by statement + expression (BZ #21242, BZ #21972) +- math-c++-compat.patch: Add more C++ compatibility +- getaddrinfo-errno.patch: Fix errno and h_errno handling in getaddrinfo + (BZ #21915, BZ #21922) +- resolv-conf-oom.patch: Fix memory handling in OOM situation during + resolv.conf parsing (BZ #22095, BZ #22096) +- dynarray-enlarge.patch: Fix initial size of dynarray allocation and set + errno on overflow error +- nearbyint-inexact.patch: Avoid spurious inexact in nearbyint (BZ #22225) + ------------------------------------------------------------------- Mon Sep 25 10:12:24 UTC 2017 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index 1ab4931..1988d7c 100644 --- a/glibc.spec +++ b/glibc.spec @@ -275,7 +275,7 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts +# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts (BZ #21885, BZ #21932) Patch1000: resolv-context-leak.patch # PATCH-FIX-UPSTREAM Use _dl_runtime_resolve_opt only with AVX512F (BZ #21871) Patch1001: dl-runtime-resolve-opt-avx512f.patch @@ -289,6 +289,16 @@ Patch1004: remove-nss-nis-compat.patch Patch1005: eh-frame-zero-terminator.patch # PATCH-FIX-UPSTREAM x86: Add x86_64 to x86-64 HWCAP (BZ #22093) Patch1006: ld-so-hwcap-x86-64.patch +# PATCH-FIX-UPSTREAM assert: Suppress pedantic warning caused by statement expression (BZ #21242, BZ #21972) +Patch1007: assert-pedantic.patch +# PATCH-FIX-UPSTREAM Fix errno and h_errno handling in getaddrinfo (BZ #21915, BZ #21922) +Patch1008: getaddrinfo-errno.patch +# PATCH-FIX-UPSTREAM Fix memory handling in OOM situation during resolv.conf parsing (BZ #22095, BZ #22096) +Patch1009: resolv-conf-oom.patch +# PATCH-FIX-UPSTREAM Fix initial size of dynarray allocation and set errno on overflow error +Patch1010: dynarray-allocation.patch +# PATCH-FIX-UPSTREAM Avoid spurious inexact in nearbyint (BZ #22225) +Patch1011: nearbyint-inexact.patch ### # Patches awaiting upstream approval @@ -525,6 +535,11 @@ rm nscd/s-stamp %patch1004 -p1 %patch1005 -p1 %patch1006 -p1 +%patch1007 -p1 +%patch1008 -p1 +%patch1009 -p1 +%patch1010 -p1 +%patch1011 -p1 %patch2000 -p1 %patch2001 -p1 diff --git a/math-c++-compat.patch b/math-c++-compat.patch index a68648f..8664d97 100644 --- a/math-c++-compat.patch +++ b/math-c++-compat.patch @@ -32,6 +32,11 @@ * 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-18 Gabriel F. T. Gomes + + * misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if + in C++ mode. + Index: glibc-2.26/math/math.h =================================================================== --- glibc-2.26.orig/math/math.h @@ -145,3 +150,35 @@ Index: glibc-2.26/math/math.h } /* extern C++ */ # endif /* __cplusplus */ #endif /* Use IEC_60559_BFP_EXT. */ +Index: glibc-2.26/misc/sys/cdefs.h +=================================================================== +--- glibc-2.26.orig/misc/sys/cdefs.h ++++ glibc-2.26/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 diff --git a/nearbyint-inexact.patch b/nearbyint-inexact.patch new file mode 100644 index 0000000..aba9ec2 --- /dev/null +++ b/nearbyint-inexact.patch @@ -0,0 +1,107 @@ +2017-09-28 Joseph Myers + + [BZ #22225] + * sysdeps/ieee754/dbl-64/s_nearbyint.c (__nearbyint): Use + math_opt_barrier on argument when doing arithmetic on it. + * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c (__nearbyint): + Likewise. Use math_force_eval not math_opt_barrier after + arithmetic. + * sysdeps/ieee754/flt-32/s_nearbyintf.c (__nearbyintf): Use + math_opt_barrier on argument when doing arithmetic on it. + * sysdeps/ieee754/ldbl-128/s_nearbyintl.c (__nearbyintl): + Likewise. + +Index: glibc-2.26/sysdeps/ieee754/dbl-64/s_nearbyint.c +=================================================================== +--- glibc-2.26.orig/sysdeps/ieee754/dbl-64/s_nearbyint.c ++++ glibc-2.26/sysdeps/ieee754/dbl-64/s_nearbyint.c +@@ -48,7 +48,7 @@ __nearbyint (double x) + if (j0 < 0) + { + libc_feholdexcept (&env); +- w = TWO52[sx] + x; ++ w = TWO52[sx] + math_opt_barrier (x); + t = w - TWO52[sx]; + math_force_eval (t); + libc_fesetenv (&env); +@@ -65,7 +65,7 @@ __nearbyint (double x) + return x; /* x is integral */ + } + libc_feholdexcept (&env); +- w = TWO52[sx] + x; ++ w = TWO52[sx] + math_opt_barrier (x); + t = w - TWO52[sx]; + math_force_eval (t); + libc_fesetenv (&env); +Index: glibc-2.26/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c +=================================================================== +--- glibc-2.26.orig/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c ++++ glibc-2.26/sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c +@@ -42,9 +42,9 @@ __nearbyint(double x) + if(__builtin_expect(j0<52, 1)) { + if(j0<0) { + libc_feholdexcept (&env); +- double w = TWO52[sx]+x; ++ double w = TWO52[sx] + math_opt_barrier (x); + double t = w-TWO52[sx]; +- math_opt_barrier(t); ++ math_force_eval (t); + libc_fesetenv (&env); + return __copysign (t, x); + } +@@ -53,9 +53,9 @@ __nearbyint(double x) + else return x; /* x is integral */ + } + libc_feholdexcept (&env); +- double w = TWO52[sx]+x; ++ double w = TWO52[sx] + math_opt_barrier (x); + double t = w-TWO52[sx]; +- math_opt_barrier (t); ++ math_force_eval (t); + libc_fesetenv (&env); + return t; + } +Index: glibc-2.26/sysdeps/ieee754/flt-32/s_nearbyintf.c +=================================================================== +--- glibc-2.26.orig/sysdeps/ieee754/flt-32/s_nearbyintf.c ++++ glibc-2.26/sysdeps/ieee754/flt-32/s_nearbyintf.c +@@ -37,7 +37,7 @@ __nearbyintf(float x) + if(j0<23) { + if(j0<0) { + libc_feholdexceptf (&env); +- w = TWO23[sx]+x; ++ w = TWO23[sx] + math_opt_barrier (x); + t = w-TWO23[sx]; + math_force_eval (t); + libc_fesetenvf (&env); +@@ -50,7 +50,7 @@ __nearbyintf(float x) + else return x; /* x is integral */ + } + libc_feholdexceptf (&env); +- w = TWO23[sx]+x; ++ w = TWO23[sx] + math_opt_barrier (x); + t = w-TWO23[sx]; + math_force_eval (t); + libc_fesetenvf (&env); +Index: glibc-2.26/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +=================================================================== +--- glibc-2.26.orig/sysdeps/ieee754/ldbl-128/s_nearbyintl.c ++++ glibc-2.26/sysdeps/ieee754/ldbl-128/s_nearbyintl.c +@@ -45,7 +45,7 @@ _Float128 __nearbyintl(_Float128 x) + if(j0<112) { + if(j0<0) { + feholdexcept (&env); +- w = TWO112[sx]+x; ++ w = TWO112[sx] + math_opt_barrier (x); + t = w-TWO112[sx]; + math_force_eval (t); + fesetenv (&env); +@@ -58,7 +58,7 @@ _Float128 __nearbyintl(_Float128 x) + else return x; /* x is integral */ + } + feholdexcept (&env); +- w = TWO112[sx]+x; ++ w = TWO112[sx] + math_opt_barrier (x); + t = w-TWO112[sx]; + math_force_eval (t); + fesetenv (&env); diff --git a/resolv-conf-oom.patch b/resolv-conf-oom.patch new file mode 100644 index 0000000..129aa7a --- /dev/null +++ b/resolv-conf-oom.patch @@ -0,0 +1,44 @@ +2017-09-06 Florian Weimer + + [BZ #22096] + * resolv/resolv_conf.c (__resolv_conf_attach): Do not free conf in + case of failure to obtain the global conf object. + +2017-09-06 Florian Weimer + + [BZ #22095] + * resolv/res_init.c (res_vinit_1): Avoid memory leak in case of + dynarray allocation failure. + +Index: glibc-2.26/resolv/res_init.c +=================================================================== +--- glibc-2.26.orig/resolv/res_init.c ++++ glibc-2.26/resolv/res_init.c +@@ -446,6 +446,11 @@ res_vinit_1 (FILE *fp, struct resolv_con + (&parser->nameserver_list); + if (p != NULL) + *p = sa; ++ else ++ { ++ free (sa); ++ return false; ++ } + } + continue; + } +Index: glibc-2.26/resolv/resolv_conf.c +=================================================================== +--- glibc-2.26.orig/resolv/resolv_conf.c ++++ glibc-2.26/resolv/resolv_conf.c +@@ -600,10 +600,7 @@ __resolv_conf_attach (struct __res_state + + struct resolv_conf_global *global_copy = get_locked_global (); + if (global_copy == NULL) +- { +- free (conf); +- return false; +- } ++ return false; + + /* Try to find an unused index in the array. */ + size_t index;