Accepting request 531231 from Base:System

- nss-compat.patch: Move nss_compat from nis to nss subdir and install it
  unconditionally
- nsswitch.conf: switch back to compat for passwd, group, shadow (forwarded request 531230 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/531231
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=214
This commit is contained in:
Dominique Leuenberger 2017-10-06 08:53:16 +00:00 committed by Git OBS Bridge
commit 2e345b60f5
17 changed files with 8595 additions and 55 deletions

192
assert-pedantic.patch Normal file
View File

@ -0,0 +1,192 @@
2017-08-21 Florian Weimer <fweimer@redhat.com>
[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 <fweimer@redhat.com>
[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 <bool> (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
+ <http://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+
+/* 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 <class T> bool operator== (T) const; /* No definition. */
+ template <class T> 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 <class T> bool operator== (T) const; /* No definition. */
+ template <class T> bool operator!= (T) const; /* No definition. */
+};
+
+static int
+do_test ()
+{
+ {
+ no_int value;
+ assert (value);
+ }
+
+ {
+ bool_and_int value;
+ assert (value);
+ }
+
+ return 0;
+}
+
+#include <support/test-driver.c>
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
+ <http://www.gnu.org/licenses/>. */
+
+#include <tst-assert-c++.cc>

127
dynarray-allocation.patch Normal file
View File

@ -0,0 +1,127 @@
2017-08-30 Florian Weimer <fweimer@redhat.com>
* 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 <fweimer@redhat.com>
* 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 @@
<http://www.gnu.org/licenses/>. */
#include <dynarray.h>
+#include <errno.h>
#include <malloc-internal.h>
#include <stdlib.h>
#include <string.h>
@@ -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 @@
<http://www.gnu.org/licenses/>. */
#include <dynarray.h>
+#include <errno.h>
#include <malloc-internal.h>
#include <stdlib.h>
#include <string.h>
@@ -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 <errno.h>
+#include <stdint.h>
+
#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;
}

View File

@ -0,0 +1,31 @@
2017-08-31 H.J. Lu <hongjiu.lu@intel.com>
[BZ #22051]
* Makerules (build-module-helper-objlist): Filter out
$(elf-objpfx)sofini.os.
(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
needed.
Index: glibc-2.26/Makerules
===================================================================
--- glibc-2.26.orig/Makerules
+++ glibc-2.26/Makerules
@@ -686,14 +686,17 @@ $(build-module-helper) -o $@ $(shlib-lds
$(call after-link,$@)
endef
+# sofini.os must be placed last since it terminates .eh_frame section.
build-module-helper-objlist = \
$(patsubst %_pic.a,$(whole-archive) %_pic.a $(no-whole-archive),\
$(filter-out %.lds $(map-file) $(+preinit) $(+postinit) \
+ $(elf-objpfx)sofini.os \
$(link-libc-deps),$^))
build-module-objlist = $(build-module-helper-objlist) $(LDLIBS-$(@F:%.so=%).so)
build-shlib-objlist = $(build-module-helper-objlist) \
- $(LDLIBS-$(@F:lib%.so=%).so)
+ $(LDLIBS-$(@F:lib%.so=%).so) \
+ $(filter $(elf-objpfx)sofini.os,$^)
# Don't try to use -lc when making libc.so itself.
# Also omits crti.o and crtn.o, which we do not want

649
getaddrinfo-errno.patch Normal file
View File

@ -0,0 +1,649 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
[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 <fweimer@redhat.com>
[BZ #21922]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
coming from gethostbyname2_r.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if
status indicates it is set.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS
function lookup failures more reliable.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly.
(getcanonname): Likewise.
(gaih_inet): Likewise.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gethosts): Use errno directly.
(getcanonname): Likewise.
(gaih_inet): Likewise.
2017-08-08 Florian Weimer <fweimer@redhat.com>
* 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
+ <http://www.gnu.org/licenses/>. */
+
+
+#include <dlfcn.h>
+#include <errno.h>
+#include <gnu/lib-names.h>
+#include <netdb.h>
+#include <nss.h>
+#include <support/check.h>
+#include <support/check_nss.h>
+#include <support/namespace.h>
+#include <support/test-driver.h>
+#include <support/xunistd.h>
+
+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 <support/test-driver.c>
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 <support/test-driver.h>
#include <support/xunistd.h>
+/* 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;

View File

@ -1,3 +1,48 @@
-------------------------------------------------------------------
Wed Oct 4 12:14:30 UTC 2017 - schwab@suse.de
- nss-compat.patch: Move nss_compat from nis to nss subdir and install it
unconditionally
- nsswitch.conf: switch back to compat for passwd, group, shadow
-------------------------------------------------------------------
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-allocation.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
- math-c++-compat.patch: add more C++ compatibility (BZ #22146)
-------------------------------------------------------------------
Tue Sep 12 06:37:36 UTC 2017 - schwab@suse.de
- Remove rpcsvc/yppasswd.* from glibc-devel
- ld-so-hwcap-x86-64.patch: add x86_64 to hwcap (bsc#1056606, BZ #22093)
-------------------------------------------------------------------
Thu Aug 31 13:43:07 UTC 2017 - schwab@suse.de
- eh-frame-zero-terminator.patch: Properly terminate .eh_frame (BZ #22051)
-------------------------------------------------------------------
Thu Aug 31 07:06:20 UTC 2017 - schwab@suse.de
- Disable obsolete libnsl and NIS support
- remove-nss-nis-compat.patch: remove nis and compat from default NSS
configs
- nsswitch.conf: Likewise
-------------------------------------------------------------------
Tue Aug 29 07:13:42 UTC 2017 - schwab@suse.de

View File

@ -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
@ -277,6 +277,24 @@ Patch1001: dl-runtime-resolve-opt-avx512f.patch
Patch1002: libpthread-compat-wrappers.patch
# PATCH-FIX-UPSTREAM Do not use __builtin_types_compatible_p in C++ mode (BZ #21930)
Patch1003: math-c++-compat.patch
# PATCH-FIX-UPSTREAM Remove nis and compat from default NSS configs
Patch1004: remove-nss-nis-compat.patch
# PATCH-FIX-UPSTREAM Properly terminate .eh_frame (BZ #22051)
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
# PATCH-FIX-UPSTREAM Move nss_compat from nis to nss subdir and install it unconditionally
Patch1012: nss-compat.patch
###
# Patches awaiting upstream approval
@ -510,6 +528,15 @@ rm nscd/s-stamp
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch2000 -p1
%patch2001 -p1
@ -677,7 +704,7 @@ configure_and_build_glibc() {
--enable-kernel=%{enablekernel} \
--with-bugurl=http://bugs.opensuse.org \
--enable-bind-now \
--enable-obsolete-rpc --enable-obsolete-nsl \
--enable-obsolete-rpc \
--disable-timezone-tools
# Should we enable --enable-systemtap?
# Should we enable --enable-nss-crypt to build use freebl3 hash functions?
@ -769,12 +796,6 @@ pushd crypt_blowfish-%{crypt_bf_version}
make man
popd
#######################################################################
###
### CHECK
###
#######################################################################
%check
%if %{build_testsuite}
# The testsuite will fail if asneeded is used
@ -916,6 +937,11 @@ export RPM_BUILD_ROOT
mkdir -p %{buildroot}/%{_lib}/obsolete
%endif
# remove nsl compat library
rm -f %{buildroot}%{_libdir}/libnsl*
# part of libnsl-devel
rm -f %{buildroot}%{_includedir}/rpcsvc/yppasswd.*
# Miscelanna:
install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
@ -1202,10 +1228,6 @@ exit 0
/%{_lib}/libnss_files.so.2
/%{_lib}/libnss_hesiod-%{libversion}.so
/%{_lib}/libnss_hesiod.so.2
/%{_lib}/libnss_nis-%{libversion}.so
/%{_lib}/libnss_nis.so.2
/%{_lib}/libnss_nisplus-%{libversion}.so
/%{_lib}/libnss_nisplus.so.2
/%{_lib}/libpthread-%{libversion}.so
/%{_lib}/libpthread.so.0
/%{_lib}/libresolv-%{libversion}.so
@ -1318,7 +1340,6 @@ exit 0
%{_libdir}/libm-%{libversion}.a
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
@ -1374,7 +1395,6 @@ exit 0
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a
%{_libdir}/libnsl_p.a
%{_libdir}/librt_p.a
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a

View File

@ -1,3 +1,48 @@
-------------------------------------------------------------------
Wed Oct 4 12:14:30 UTC 2017 - schwab@suse.de
- nss-compat.patch: Move nss_compat from nis to nss subdir and install it
unconditionally
- nsswitch.conf: switch back to compat for passwd, group, shadow
-------------------------------------------------------------------
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-allocation.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
- math-c++-compat.patch: add more C++ compatibility (BZ #22146)
-------------------------------------------------------------------
Tue Sep 12 06:37:36 UTC 2017 - schwab@suse.de
- Remove rpcsvc/yppasswd.* from glibc-devel
- ld-so-hwcap-x86-64.patch: add x86_64 to hwcap (bsc#1056606, BZ #22093)
-------------------------------------------------------------------
Thu Aug 31 13:43:07 UTC 2017 - schwab@suse.de
- eh-frame-zero-terminator.patch: Properly terminate .eh_frame (BZ #22051)
-------------------------------------------------------------------
Thu Aug 31 07:06:20 UTC 2017 - schwab@suse.de
- Disable obsolete libnsl and NIS support
- remove-nss-nis-compat.patch: remove nis and compat from default NSS
configs
- nsswitch.conf: Likewise
-------------------------------------------------------------------
Tue Aug 29 07:13:42 UTC 2017 - schwab@suse.de

View File

@ -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
@ -277,6 +277,24 @@ Patch1001: dl-runtime-resolve-opt-avx512f.patch
Patch1002: libpthread-compat-wrappers.patch
# PATCH-FIX-UPSTREAM Do not use __builtin_types_compatible_p in C++ mode (BZ #21930)
Patch1003: math-c++-compat.patch
# PATCH-FIX-UPSTREAM Remove nis and compat from default NSS configs
Patch1004: remove-nss-nis-compat.patch
# PATCH-FIX-UPSTREAM Properly terminate .eh_frame (BZ #22051)
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
# PATCH-FIX-UPSTREAM Move nss_compat from nis to nss subdir and install it unconditionally
Patch1012: nss-compat.patch
###
# Patches awaiting upstream approval
@ -510,6 +528,15 @@ rm nscd/s-stamp
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch2000 -p1
%patch2001 -p1
@ -677,7 +704,7 @@ configure_and_build_glibc() {
--enable-kernel=%{enablekernel} \
--with-bugurl=http://bugs.opensuse.org \
--enable-bind-now \
--enable-obsolete-rpc --enable-obsolete-nsl \
--enable-obsolete-rpc \
--disable-timezone-tools
# Should we enable --enable-systemtap?
# Should we enable --enable-nss-crypt to build use freebl3 hash functions?
@ -769,12 +796,6 @@ pushd crypt_blowfish-%{crypt_bf_version}
make man
popd
#######################################################################
###
### CHECK
###
#######################################################################
%check
%if %{build_testsuite}
# The testsuite will fail if asneeded is used
@ -916,6 +937,11 @@ export RPM_BUILD_ROOT
mkdir -p %{buildroot}/%{_lib}/obsolete
%endif
# remove nsl compat library
rm -f %{buildroot}%{_libdir}/libnsl*
# part of libnsl-devel
rm -f %{buildroot}%{_includedir}/rpcsvc/yppasswd.*
# Miscelanna:
install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
@ -1202,10 +1228,6 @@ exit 0
/%{_lib}/libnss_files.so.2
/%{_lib}/libnss_hesiod-%{libversion}.so
/%{_lib}/libnss_hesiod.so.2
/%{_lib}/libnss_nis-%{libversion}.so
/%{_lib}/libnss_nis.so.2
/%{_lib}/libnss_nisplus-%{libversion}.so
/%{_lib}/libnss_nisplus.so.2
/%{_lib}/libpthread-%{libversion}.so
/%{_lib}/libpthread.so.0
/%{_lib}/libresolv-%{libversion}.so
@ -1318,7 +1340,6 @@ exit 0
%{_libdir}/libm-%{libversion}.a
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
@ -1374,7 +1395,6 @@ exit 0
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a
%{_libdir}/libnsl_p.a
%{_libdir}/librt_p.a
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a

View File

@ -1,3 +1,48 @@
-------------------------------------------------------------------
Wed Oct 4 12:14:30 UTC 2017 - schwab@suse.de
- nss-compat.patch: Move nss_compat from nis to nss subdir and install it
unconditionally
- nsswitch.conf: switch back to compat for passwd, group, shadow
-------------------------------------------------------------------
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-allocation.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
- math-c++-compat.patch: add more C++ compatibility (BZ #22146)
-------------------------------------------------------------------
Tue Sep 12 06:37:36 UTC 2017 - schwab@suse.de
- Remove rpcsvc/yppasswd.* from glibc-devel
- ld-so-hwcap-x86-64.patch: add x86_64 to hwcap (bsc#1056606, BZ #22093)
-------------------------------------------------------------------
Thu Aug 31 13:43:07 UTC 2017 - schwab@suse.de
- eh-frame-zero-terminator.patch: Properly terminate .eh_frame (BZ #22051)
-------------------------------------------------------------------
Thu Aug 31 07:06:20 UTC 2017 - schwab@suse.de
- Disable obsolete libnsl and NIS support
- remove-nss-nis-compat.patch: remove nis and compat from default NSS
configs
- nsswitch.conf: Likewise
-------------------------------------------------------------------
Tue Aug 29 07:13:42 UTC 2017 - schwab@suse.de

View File

@ -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
@ -283,6 +283,24 @@ Patch1001: dl-runtime-resolve-opt-avx512f.patch
Patch1002: libpthread-compat-wrappers.patch
# PATCH-FIX-UPSTREAM Do not use __builtin_types_compatible_p in C++ mode (BZ #21930)
Patch1003: math-c++-compat.patch
# PATCH-FIX-UPSTREAM Remove nis and compat from default NSS configs
Patch1004: remove-nss-nis-compat.patch
# PATCH-FIX-UPSTREAM Properly terminate .eh_frame (BZ #22051)
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
# PATCH-FIX-UPSTREAM Move nss_compat from nis to nss subdir and install it unconditionally
Patch1012: nss-compat.patch
###
# Patches awaiting upstream approval
@ -516,6 +534,15 @@ rm nscd/s-stamp
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch2000 -p1
%patch2001 -p1
@ -683,7 +710,7 @@ configure_and_build_glibc() {
--enable-kernel=%{enablekernel} \
--with-bugurl=http://bugs.opensuse.org \
--enable-bind-now \
--enable-obsolete-rpc --enable-obsolete-nsl \
--enable-obsolete-rpc \
--disable-timezone-tools
# Should we enable --enable-systemtap?
# Should we enable --enable-nss-crypt to build use freebl3 hash functions?
@ -775,12 +802,6 @@ pushd crypt_blowfish-%{crypt_bf_version}
make man
popd
#######################################################################
###
### CHECK
###
#######################################################################
%check
%if %{build_testsuite}
# The testsuite will fail if asneeded is used
@ -922,6 +943,11 @@ export RPM_BUILD_ROOT
mkdir -p %{buildroot}/%{_lib}/obsolete
%endif
# remove nsl compat library
rm -f %{buildroot}%{_libdir}/libnsl*
# part of libnsl-devel
rm -f %{buildroot}%{_includedir}/rpcsvc/yppasswd.*
# Miscelanna:
install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
@ -1208,10 +1234,6 @@ exit 0
/%{_lib}/libnss_files.so.2
/%{_lib}/libnss_hesiod-%{libversion}.so
/%{_lib}/libnss_hesiod.so.2
/%{_lib}/libnss_nis-%{libversion}.so
/%{_lib}/libnss_nis.so.2
/%{_lib}/libnss_nisplus-%{libversion}.so
/%{_lib}/libnss_nisplus.so.2
/%{_lib}/libpthread-%{libversion}.so
/%{_lib}/libpthread.so.0
/%{_lib}/libresolv-%{libversion}.so
@ -1324,7 +1346,6 @@ exit 0
%{_libdir}/libm-%{libversion}.a
%{_libdir}/libmvec.a
%endif
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
@ -1380,7 +1401,6 @@ exit 0
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a
%{_libdir}/libnsl_p.a
%{_libdir}/librt_p.a
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a

190
ld-so-hwcap-x86-64.patch Normal file
View File

@ -0,0 +1,190 @@
2017-09-11 H.J. Lu <hongjiu.lu@intel.com>
[BZ #22093]
* sysdeps/x86/cpu-features.c (init_cpu_features): Initialize
GLRO(dl_hwcap) to HWCAP_X86_64 for x86-64.
* sysdeps/x86/dl-hwcap.h (HWCAP_COUNT): Updated.
(HWCAP_IMPORTANT): Likewise.
(HWCAP_X86_64): New enum.
(HWCAP_X86_AVX512_1): Updated.
* sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): Add "x86_64".
* sysdeps/x86_64/Makefile (tests): Add tst-x86_64-1.
(modules-names): Add x86_64/tst-x86_64mod-1.
(LDFLAGS-tst-x86_64mod-1.so): New.
($(objpfx)tst-x86_64-1): Likewise.
($(objpfx)x86_64/tst-x86_64mod-1.os): Likewise.
(tst-x86_64-1-clean): Likewise.
* sysdeps/x86_64/tst-x86_64-1.c: New file.
* sysdeps/x86_64/tst-x86_64mod-1.c: Likewise.
Index: glibc-2.26/sysdeps/x86/cpu-features.c
===================================================================
--- glibc-2.26.orig/sysdeps/x86/cpu-features.c
+++ glibc-2.26/sysdeps/x86/cpu-features.c
@@ -336,7 +336,6 @@ no_cpuid:
/* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. */
GLRO(dl_platform) = NULL;
- GLRO(dl_hwcap) = 0;
#if !HAVE_TUNABLES && defined SHARED
/* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do
this. */
@@ -344,6 +343,7 @@ no_cpuid:
#endif
#ifdef __x86_64__
+ GLRO(dl_hwcap) = HWCAP_X86_64;
if (cpu_features->kind == arch_kind_intel)
{
if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
@@ -374,6 +374,7 @@ no_cpuid:
GLRO(dl_platform) = "haswell";
}
#else
+ GLRO(dl_hwcap) = 0;
if (CPU_FEATURES_CPU_P (cpu_features, SSE2))
GLRO(dl_hwcap) |= HWCAP_X86_SSE2;
Index: glibc-2.26/sysdeps/x86/dl-hwcap.h
===================================================================
--- glibc-2.26.orig/sysdeps/x86/dl-hwcap.h
+++ glibc-2.26/sysdeps/x86/dl-hwcap.h
@@ -24,15 +24,16 @@
# define HWCAP_PLATFORMS_START 0
# define HWCAP_PLATFORMS_COUNT 4
# define HWCAP_START 0
-# define HWCAP_COUNT 2
-# define HWCAP_IMPORTANT (HWCAP_X86_SSE2 | HWCAP_X86_AVX512_1)
+# define HWCAP_COUNT 3
+# define HWCAP_IMPORTANT \
+ (HWCAP_X86_SSE2 | HWCAP_X86_64 | HWCAP_X86_AVX512_1)
#elif defined __x86_64__
/* For 64 bit, only cover x86-64 platforms and capabilities. */
# define HWCAP_PLATFORMS_START 2
# define HWCAP_PLATFORMS_COUNT 4
# define HWCAP_START 1
-# define HWCAP_COUNT 2
-# define HWCAP_IMPORTANT (HWCAP_X86_AVX512_1)
+# define HWCAP_COUNT 3
+# define HWCAP_IMPORTANT (HWCAP_X86_64 | HWCAP_X86_AVX512_1)
#else
/* For 32 bit, only cover i586, i686 and SSE2. */
# define HWCAP_PLATFORMS_START 0
@@ -45,7 +46,8 @@
enum
{
HWCAP_X86_SSE2 = 1 << 0,
- HWCAP_X86_AVX512_1 = 1 << 1
+ HWCAP_X86_64 = 1 << 1,
+ HWCAP_X86_AVX512_1 = 1 << 2
};
static inline const char *
Index: glibc-2.26/sysdeps/x86/dl-procinfo.c
===================================================================
--- glibc-2.26.orig/sysdeps/x86/dl-procinfo.c
+++ glibc-2.26/sysdeps/x86/dl-procinfo.c
@@ -58,11 +58,11 @@ PROCINFO_CLASS struct cpu_features _dl_x
#if !defined PROCINFO_DECL && defined SHARED
._dl_x86_hwcap_flags
#else
-PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][9]
+PROCINFO_CLASS const char _dl_x86_hwcap_flags[3][9]
#endif
#ifndef PROCINFO_DECL
= {
- "sse2", "avx512_1"
+ "sse2", "x86_64", "avx512_1"
}
#endif
#if !defined SHARED || defined PROCINFO_DECL
Index: glibc-2.26/sysdeps/x86_64/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/Makefile
+++ glibc-2.26/sysdeps/x86_64/Makefile
@@ -52,6 +52,12 @@ $(objpfx)tst-quad2pie: $(objpfx)tst-quad
CFLAGS-tst-quad1pie.c = $(PIE-ccflag)
CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
+tests += tst-x86_64-1
+modules-names += x86_64/tst-x86_64mod-1
+LDFLAGS-tst-x86_64mod-1.so = -Wl,-soname,tst-x86_64mod-1.so
+
+$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
+
tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \
tst-audit10 tst-sse tst-avx tst-avx512
test-extras += tst-audit4-aux tst-audit10-aux \
@@ -122,3 +128,14 @@ endif
ifeq ($(subdir),csu)
gen-as-const-headers += tlsdesc.sym rtld-offsets.sym
endif
+
+$(objpfx)x86_64/tst-x86_64mod-1.os: $(objpfx)tst-x86_64mod-1.os
+ $(make-target-directory)
+ rm -f $@
+ ln $< $@
+
+do-tests-clean common-mostlyclean: tst-x86_64-1-clean
+
+.PHONY: tst-x86_64-1-clean
+tst-x86_64-1-clean:
+ -rm -rf $(objpfx)x86_64
Index: glibc-2.26/sysdeps/x86_64/tst-x86_64-1.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/x86_64/tst-x86_64-1.c
@@ -0,0 +1,26 @@
+/* Test searching the "x86_64" directory for shared libraries.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+extern void foo (void);
+
+int
+main (void)
+{
+ foo ();
+ return 0;
+}
Index: glibc-2.26/sysdeps/x86_64/tst-x86_64mod-1.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/x86_64/tst-x86_64mod-1.c
@@ -0,0 +1,22 @@
+/* Test searching the "x86_64" directory for shared libraries.
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+void
+foo (void)
+{
+}

View File

@ -1,3 +1,9 @@
2017-09-22 Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
[BZ #22146]
math/math.h: Let fpclassify use the builtin in C++ mode, even
when optimazing for size.
2017-08-28 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
[BZ #21930]
@ -26,11 +32,31 @@
* 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 <gftg@linux.vnet.ibm.com>
* 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
+++ glibc-2.26/math/math.h
@@ -442,8 +442,12 @@ enum
@@ -402,7 +402,13 @@ enum
/* Return number of classification appropriate for X. */
# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ \
- && !defined __OPTIMIZE_SIZE__
+ && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus)
+ /* The check for __cplusplus allows the use of the builtin, even
+ when optimization for size is on. This is provided for
+ libstdc++, only to let its configure test work when it is built
+ with -Os. No further use of this definition of fpclassify is
+ expected in C++ mode, since libstdc++ provides its own version
+ of fpclassify in cmath (which undefines fpclassify). */
# define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
# else
@@ -442,8 +448,12 @@ enum
/* Return nonzero value if X is positive or negative infinity. */
# if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
@ -45,7 +71,7 @@ Index: glibc-2.26/math/math.h
# define isinf(x) \
(__builtin_types_compatible_p (__typeof (x), _Float128) \
? __isinff128 (x) : __builtin_isinf_sign (x))
@@ -470,7 +474,32 @@ enum
@@ -470,7 +480,32 @@ enum
# include <bits/iscanonical.h>
/* Return nonzero value if X is a signaling NaN. */
@ -79,7 +105,7 @@ Index: glibc-2.26/math/math.h
/* Return nonzero value if X is subnormal. */
# define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
@@ -484,15 +513,40 @@ enum
@@ -484,15 +519,40 @@ enum
# endif
# else /* __cplusplus */
extern "C++" {
@ -124,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

107
nearbyint-inexact.patch Normal file
View File

@ -0,0 +1,107 @@
2017-09-28 Joseph Myers <joseph@codesourcery.com>
[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);

6745
nss-compat.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,12 +22,9 @@
# For more information, please read the nsswitch.conf.5 manual page.
#
# passwd: files nis
# shadow: files nis
# group: files nis
passwd: compat [NOTFOUND=return] files
group: compat [NOTFOUND=return] files
passwd: compat
group: compat
shadow: compat
hosts: files dns
networks: files dns
@ -37,11 +34,9 @@ protocols: files
rpc: files
ethers: files
netmasks: files
netgroup: files nis
netgroup: files
publickey: files
bootparams: files
automount: files nis
automount: files
aliases: files

207
remove-nss-nis-compat.patch Normal file
View File

@ -0,0 +1,207 @@
2017-08-29 Steve Ellcey <sellcey@cavium.com>
* grp/initgroups.c: Include config.h.
(DEFAULT_CONFIG): New macro.
(internal_getgrouplist): Use DEFAULT_CONFIG.
* nscd/initgrcache.c (addinitgroupsX): Likewise.
* nss/nsswitch.c (__nss_disable_nscd): Likewise.
(DEFAULT_DEFCONFIG): New macro.
(__nss_database_lookup): Use DEFAULT_DEFCONFIG.
* nss/grp-lookup.c: Include config.h
(DEFAULT_CONFIG): Set definition based on LINK_OBSOLETE_NSL.
* nss/pwd-lookup.c (DEFAULT_CONFIG): Likewise.
* nss/spwd-lookup.c (DEFAULT_CONFIG): Likewise.
* manual/nss.texi: Update default values section.
Index: glibc-2.26/grp/initgroups.c
===================================================================
--- glibc-2.26.orig/grp/initgroups.c
+++ glibc-2.26/grp/initgroups.c
@@ -26,10 +26,16 @@
#include <sys/types.h>
#include <nsswitch.h>
#include <scratch_buffer.h>
+#include <config.h>
#include "../nscd/nscd-client.h"
#include "../nscd/nscd_proto.h"
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+#endif
/* Type of the lookup function. */
typedef enum nss_status (*initgroups_dyn_function) (const char *, gid_t,
@@ -84,7 +90,7 @@ internal_getgrouplist (const char *user,
&__nss_initgroups_database) < 0)
{
if (__nss_group_database == NULL)
- no_more = __nss_database_lookup ("group", NULL, "compat files",
+ no_more = __nss_database_lookup ("group", NULL, DEFAULT_CONFIG,
&__nss_group_database);
__nss_initgroups_database = __nss_group_database;
Index: glibc-2.26/manual/nss.texi
===================================================================
--- glibc-2.26.orig/manual/nss.texi
+++ glibc-2.26/manual/nss.texi
@@ -318,13 +318,17 @@ The @code{passwd}, @code{group}, and @co
traditionally handled in a special way. The appropriate files in the
@file{/etc} directory are read but if an entry with a name starting
with a @code{+} character is found NIS is used. This kind of lookup
-remains possible by using the special lookup service @code{compat}
-and the default value for the three databases above is
-@code{compat [NOTFOUND=return] files}.
+remains possible if @theglibc{} was configured with the
+@code{--enable-obsolete-nsl} option and the special lookup service
+@code{compat} is used. If @theglibc{} was configured with the
+@code{--enable-obsolete-nsl} option the default value for the three
+databases above is @code{compat [NOTFOUND=return] files}. If the
+@code{--enable-obsolete-nsl} option was not used the default value
+for the services is @code{files}.
-For all other databases the default value is
-@code{nis [NOTFOUND=return] files}. This solution gives the best
-chance to be correct since NIS and file based lookups are used.
+For all other databases the default value is @code{files} unless
+@theglibc{} was configured with @code{--enable-obsolete-rpc} option, in
+which case it the default value is @code{nis [NOTFOUND=return] files}.
@cindex optimizing NSS
A second point is that the user should try to optimize the lookup
Index: glibc-2.26/nscd/initgrcache.c
===================================================================
--- glibc-2.26.orig/nscd/initgrcache.c
+++ glibc-2.26/nscd/initgrcache.c
@@ -25,6 +25,7 @@
#include <unistd.h>
#include <sys/mman.h>
#include <scratch_buffer.h>
+#include <config.h>
#include "dbg_log.h"
#include "nscd.h"
@@ -34,6 +35,11 @@
#include "../nss/nsswitch.h"
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+#endif
/* Type of the lookup function. */
typedef enum nss_status (*initgroups_dyn_function) (const char *, gid_t,
@@ -85,8 +91,7 @@ addinitgroupsX (struct database_dyn *db,
int no_more;
if (group_database == NULL)
- no_more = __nss_database_lookup ("group", NULL,
- "compat [NOTFOUND=return] files",
+ no_more = __nss_database_lookup ("group", NULL, DEFAULT_CONFIG,
&group_database);
else
no_more = 0;
Index: glibc-2.26/nss/grp-lookup.c
===================================================================
--- glibc-2.26.orig/nss/grp-lookup.c
+++ glibc-2.26/nss/grp-lookup.c
@@ -16,7 +16,13 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <config.h>
+
#define DATABASE_NAME group
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+#endif
#include "XXX-lookup.c"
Index: glibc-2.26/nss/nsswitch.c
===================================================================
--- glibc-2.26.orig/nss/nsswitch.c
+++ glibc-2.26/nss/nsswitch.c
@@ -40,6 +40,15 @@
#include "nsswitch.h"
#include "../nscd/nscd_proto.h"
#include <sysdep.h>
+#include <config.h>
+
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+# define DEFAULT_DEFCONFIG "nis [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+# define DEFAULT_DEFCONFIG "files"
+#endif
/* Prototypes for the local functions. */
static name_database *nss_parse_file (const char *fname) internal_function;
@@ -151,8 +160,7 @@ __nss_database_lookup (const char *datab
or null to use the most common default. */
if (*ni == NULL)
{
- *ni = nss_parse_service_list (defconfig
- ?: "nis [NOTFOUND=return] files");
+ *ni = nss_parse_service_list (defconfig ?: DEFAULT_DEFCONFIG);
if (*ni != NULL)
{
/* Record the memory we've just allocated in defconfig_entries list,
@@ -848,8 +856,8 @@ __nss_disable_nscd (void (*cb) (size_t,
is_nscd = true;
/* Find all the relevant modules so that the init functions are called. */
- nss_load_all_libraries ("passwd", "compat [NOTFOUND=return] files");
- nss_load_all_libraries ("group", "compat [NOTFOUND=return] files");
+ nss_load_all_libraries ("passwd", DEFAULT_CONFIG);
+ nss_load_all_libraries ("group", DEFAULT_CONFIG);
nss_load_all_libraries ("hosts", "dns [!UNAVAIL=return] files");
nss_load_all_libraries ("services", NULL);
Index: glibc-2.26/nss/pwd-lookup.c
===================================================================
--- glibc-2.26.orig/nss/pwd-lookup.c
+++ glibc-2.26/nss/pwd-lookup.c
@@ -16,7 +16,13 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <config.h>
+
#define DATABASE_NAME passwd
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+#endif
#include "XXX-lookup.c"
Index: glibc-2.26/nss/spwd-lookup.c
===================================================================
--- glibc-2.26.orig/nss/spwd-lookup.c
+++ glibc-2.26/nss/spwd-lookup.c
@@ -16,8 +16,14 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#include <config.h>
+
#define DATABASE_NAME shadow
#define ALTERNATE_NAME passwd
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#ifdef LINK_OBSOLETE_NSL
+# define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
+#else
+# define DEFAULT_CONFIG "files"
+#endif
#include "XXX-lookup.c"

44
resolv-conf-oom.patch Normal file
View File

@ -0,0 +1,44 @@
2017-09-06 Florian Weimer <fweimer@redhat.com>
[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 <fweimer@redhat.com>
[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;