SHA256
1
0
forked from pool/glibc

Accepting request 580520 from Base:System

- Use %license (boo#1082318)

- Add systemtap-headers to BuildRequires
- Add --enable-systemtap to configure arguments (fate#324969, bsc#1073636)

- riscv-readelflib.patch: Fix parsing flags in ELF64 files on riscv

- Update to glibc 2.27
  * Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin, cosf,
    sinf, sincosf and tan with FMA
  * Optimized x86-64 trunc and truncf for processors with SSE4.1
  * Optimized generic expf, exp2f, logf, log2f, powf, sinf, cosf and
    sincosf
  * In order to support faster and safer process termination the malloc API
    family of functions will no longer print a failure address and stack
    backtrace after detecting heap corruption
  * The abort function terminates the process immediately, without flushing
    stdio streams
  * On platforms where long double has the IEEE binary128 format (aarch64,
    alpha, mips64, riscv, s390 and sparc), the math library now implements
    _Float128 interfaces for that type, as defined by ISO/IEC TS 18661-3:2015
    These are the same interfaces added in version 2.26 for some platforms where
    this format is supported but is not the format of long double
  * On platforms with support for _Float64x (aarch64, alpha, i386, ia64,
    mips64, powerpc64le, riscv, s390, sparc and x86_64), the math library now
    implements interfaces for that type, as defined by ISO/IEC TS
    18661-3:2015
  * The math library now implements interfaces for the _Float32, _Float64 and
    _Float32x types, as defined by ISO/IEC TS 18661-3:2015
  * glibc now implements the memfd_create and mlock2 functions on Linux

OBS-URL: https://build.opensuse.org/request/show/580520
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=219
This commit is contained in:
Dominique Leuenberger 2018-03-01 10:59:33 +00:00 committed by Git OBS Bridge
commit 1145ac875b
64 changed files with 475 additions and 15219 deletions

View File

@ -1,18 +0,0 @@
2017-10-10 Steve Ellcey <sellcey@cavium.com>
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (get_midr_from_mcpu):
Use strcmp instead of tunable_is_name.
Index: glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -37,7 +37,7 @@ static uint64_t
get_midr_from_mcpu (const char *mcpu)
{
for (int i = 0; i < sizeof (cpu_list) / sizeof (struct cpu_list); i++)
- if (tunable_is_name (mcpu, cpu_list[i].name) == 0)
+ if (strcmp (mcpu, cpu_list[i].name) == 0)
return cpu_list[i].midr;
return UINT64_MAX;

View File

@ -1,80 +0,0 @@
Don't close or flush stdio streams on abort
[BZ #15436]
* stdlib/abort.c (abort): Don't call fflush and __fcloseall.
Index: glibc-2.19/stdlib/abort.c
===================================================================
--- glibc-2.19.orig/stdlib/abort.c
+++ glibc-2.19/stdlib/abort.c
@@ -30,9 +30,6 @@
# define ABORT_INSTRUCTION
#endif
-#include <libio/libioP.h>
-#define fflush(s) _IO_flush_all_lockp (0)
-
/* Exported variable to locate abort message in core files etc. */
struct abort_msg_s *__abort_msg __attribute__ ((nocommon));
libc_hidden_def (__abort_msg)
@@ -66,16 +63,8 @@ abort (void)
__sigprocmask (SIG_UNBLOCK, &sigs, 0);
}
- /* Flush all streams. We cannot close them now because the user
- might have registered a handler for SIGABRT. */
- if (stage == 1)
- {
- ++stage;
- fflush (NULL);
- }
-
/* Send signal which possibly calls a user handler. */
- if (stage == 2)
+ if (stage == 1)
{
/* This stage is special: we must allow repeated calls of
`abort' when a user defined handler for SIGABRT is installed.
@@ -93,7 +82,7 @@ abort (void)
}
/* There was a handler installed. Now remove it. */
- if (stage == 3)
+ if (stage == 2)
{
++stage;
memset (&act, '\0', sizeof (struct sigaction));
@@ -103,30 +92,22 @@ abort (void)
__sigaction (SIGABRT, &act, NULL);
}
- /* Now close the streams which also flushes the output the user
- defined handler might has produced. */
- if (stage == 4)
- {
- ++stage;
- __fcloseall ();
- }
-
/* Try again. */
- if (stage == 5)
+ if (stage == 3)
{
++stage;
raise (SIGABRT);
}
/* Now try to abort using the system specific command. */
- if (stage == 6)
+ if (stage == 4)
{
++stage;
ABORT_INSTRUCTION;
}
/* If we can't signal ourselves and the abort instruction failed, exit. */
- if (stage == 7)
+ if (stage == 5)
{
++stage;
_exit (127);

View File

@ -1,8 +1,8 @@
Index: glibc-2.25/localedata/SUPPORTED Index: glibc-2.27/localedata/SUPPORTED
=================================================================== ===================================================================
--- glibc-2.25.orig/localedata/SUPPORTED --- glibc-2.27.orig/localedata/SUPPORTED
+++ glibc-2.25/localedata/SUPPORTED +++ glibc-2.27/localedata/SUPPORTED
@@ -129,6 +129,7 @@ en_CA.UTF-8/UTF-8 \ @@ -135,6 +135,7 @@ en_CA.UTF-8/UTF-8 \
en_CA/ISO-8859-1 \ en_CA/ISO-8859-1 \
en_DK.UTF-8/UTF-8 \ en_DK.UTF-8/UTF-8 \
en_DK/ISO-8859-1 \ en_DK/ISO-8859-1 \
@ -10,15 +10,15 @@ Index: glibc-2.25/localedata/SUPPORTED
en_GB.UTF-8/UTF-8 \ en_GB.UTF-8/UTF-8 \
en_GB/ISO-8859-1 \ en_GB/ISO-8859-1 \
en_HK.UTF-8/UTF-8 \ en_HK.UTF-8/UTF-8 \
@@ -145,6 +146,7 @@ en_PH.UTF-8/UTF-8 \ @@ -152,6 +153,7 @@ en_PH/ISO-8859-1 \
en_PH/ISO-8859-1 \ en_SC.UTF-8/UTF-8 \
en_SG.UTF-8/UTF-8 \ en_SG.UTF-8/UTF-8 \
en_SG/ISO-8859-1 \ en_SG/ISO-8859-1 \
+en_US.ISO-8859-15/ISO-8859-15 \ +en_US.ISO-8859-15/ISO-8859-15 \
en_US.UTF-8/UTF-8 \ en_US.UTF-8/UTF-8 \
en_US/ISO-8859-1 \ en_US/ISO-8859-1 \
en_ZA.UTF-8/UTF-8 \ en_ZA.UTF-8/UTF-8 \
@@ -269,6 +271,8 @@ it_IT/ISO-8859-1 \ @@ -277,6 +279,8 @@ it_IT/ISO-8859-1 \
it_IT@euro/ISO-8859-15 \ it_IT@euro/ISO-8859-15 \
iu_CA/UTF-8 \ iu_CA/UTF-8 \
ja_JP.EUC-JP/EUC-JP \ ja_JP.EUC-JP/EUC-JP \

View File

@ -1,192 +0,0 @@
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>

View File

@ -1,90 +0,0 @@
2017-12-18 Dmitry V. Levin <ldv@altlinux.org>
[BZ #22627]
* elf/dl-load.c (_dl_init_paths): Remove _dl_dst_substitute preparatory
code and invocation.
2017-12-14 Florian Weimer <fweimer@redhat.com>
[BZ #22607]
CVE-2017-1000409
* elf/dl-load.c (_dl_init_paths): Compute number of components in
the expanded path string.
2017-12-14 Florian Weimer <fweimer@redhat.com>
[BZ #22606]
CVE-2017-1000408
* elf/dl-load.c (system_dirs): Update comment.
(_dl_init_paths): Use nsystem_dirs_len to compute the array size.
Index: glibc-2.26/elf/dl-load.c
===================================================================
--- glibc-2.26.orig/elf/dl-load.c
+++ glibc-2.26/elf/dl-load.c
@@ -103,7 +103,9 @@ static size_t ncapstr attribute_relro;
static size_t max_capstrlen attribute_relro;
-/* Get the generated information about the trusted directories. */
+/* Get the generated information about the trusted directories. Use
+ an array of concatenated strings to avoid relocations. See
+ gen-trusted-dirs.awk. */
#include "trusted-dirs.h"
static const char system_dirs[] = SYSTEM_DIRS;
@@ -688,9 +690,8 @@ _dl_init_paths (const char *llp)
+ ncapstr * sizeof (enum r_dir_status))
/ sizeof (struct r_search_path_elem));
- rtld_search_dirs.dirs[0] = (struct r_search_path_elem *)
- malloc ((sizeof (system_dirs) / sizeof (system_dirs[0]))
- * round_size * sizeof (struct r_search_path_elem));
+ rtld_search_dirs.dirs[0] = malloc (nsystem_dirs_len * round_size
+ * sizeof (*rtld_search_dirs.dirs[0]));
if (rtld_search_dirs.dirs[0] == NULL)
{
errstring = N_("cannot create cache for search path");
@@ -776,37 +777,14 @@ _dl_init_paths (const char *llp)
if (llp != NULL && *llp != '\0')
{
- size_t nllp;
- const char *cp = llp;
- char *llp_tmp;
-
-#ifdef SHARED
- /* Expand DSTs. */
- size_t cnt = DL_DST_COUNT (llp, 1);
- if (__glibc_likely (cnt == 0))
- llp_tmp = strdupa (llp);
- else
- {
- /* Determine the length of the substituted string. */
- size_t total = DL_DST_REQUIRED (l, llp, strlen (llp), cnt);
-
- /* Allocate the necessary memory. */
- llp_tmp = (char *) alloca (total + 1);
- llp_tmp = _dl_dst_substitute (l, llp, llp_tmp, 1);
- }
-#else
- llp_tmp = strdupa (llp);
-#endif
+ char *llp_tmp = strdupa (llp);
/* Decompose the LD_LIBRARY_PATH contents. First determine how many
elements it has. */
- nllp = 1;
- while (*cp)
- {
- if (*cp == ':' || *cp == ';')
- ++nllp;
- ++cp;
- }
+ size_t nllp = 1;
+ for (const char *cp = llp_tmp; *cp != '\0'; ++cp)
+ if (*cp == ':' || *cp == ';')
+ ++nllp;
env_path_list.dirs = (struct r_search_path_elem **)
malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));

View File

@ -1,26 +0,0 @@
2017-08-06 H.J. Lu <hongjiu.lu@intel.com>
[BZ #21871]
* sysdeps/x86/cpu-features.c (init_cpu_features): Set
bit_arch_Use_dl_runtime_resolve_opt only with AVX512F.
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
@@ -244,10 +244,13 @@ init_cpu_features (struct cpu_features *
|= bit_arch_Prefer_No_AVX512;
/* To avoid SSE transition penalty, use _dl_runtime_resolve_slow.
- If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt. */
+ If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt.
+ Use _dl_runtime_resolve_opt only with AVX512F since it is
+ slower than _dl_runtime_resolve_slow with AVX. */
cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow]
|= bit_arch_Use_dl_runtime_resolve_slow;
- if (cpu_features->max_cpuid >= 0xd)
+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
+ && cpu_features->max_cpuid >= 0xd)
{
unsigned int eax;

View File

@ -1,851 +0,0 @@
2017-10-22 H.J. Lu <hongjiu.lu@intel.com>
[BZ #21265]
* sysdeps/x86/cpu-features-offsets.sym (XSAVE_STATE_SIZE_OFFSET):
New.
* sysdeps/x86/cpu-features.c: Include <libc-pointer-arith.h>.
(get_common_indeces): Set xsave_state_size, xsave_state_full_size
and bit_arch_XSAVEC_Usable if needed.
(init_cpu_features): Remove bit_arch_Use_dl_runtime_resolve_slow
and bit_arch_Use_dl_runtime_resolve_opt.
* sysdeps/x86/cpu-features.h (bit_arch_Use_dl_runtime_resolve_opt):
Removed.
(bit_arch_Use_dl_runtime_resolve_slow): Likewise.
(bit_arch_Prefer_No_AVX512): Updated.
(bit_arch_MathVec_Prefer_No_AVX512): Likewise.
(bit_arch_XSAVEC_Usable): New.
(STATE_SAVE_OFFSET): Likewise.
(STATE_SAVE_MASK): Likewise.
[__ASSEMBLER__]: Include <cpu-features-offsets.h>.
(cpu_features): Add xsave_state_size and xsave_state_full_size.
(index_arch_Use_dl_runtime_resolve_opt): Removed.
(index_arch_Use_dl_runtime_resolve_slow): Likewise.
(index_arch_XSAVEC_Usable): New.
* sysdeps/x86/cpu-tunables.c (TUNABLE_CALLBACK (set_hwcaps)):
Support XSAVEC_Usable. Remove Use_dl_runtime_resolve_slow.
* sysdeps/x86_64/Makefile (tst-x86_64-1-ENV): New if tunables
is enabled.
* sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup):
Replace _dl_runtime_resolve_sse, _dl_runtime_resolve_avx,
_dl_runtime_resolve_avx_slow, _dl_runtime_resolve_avx_opt,
_dl_runtime_resolve_avx512 and _dl_runtime_resolve_avx512_opt
with _dl_runtime_resolve_fxsave, _dl_runtime_resolve_xsave and
_dl_runtime_resolve_xsavec.
* sysdeps/x86_64/dl-trampoline.S (DL_RUNTIME_UNALIGNED_VEC_SIZE):
Removed.
(DL_RUNTIME_RESOLVE_REALIGN_STACK): Check STATE_SAVE_ALIGNMENT
instead of VEC_SIZE.
(REGISTER_SAVE_BND0): Removed.
(REGISTER_SAVE_BND1): Likewise.
(REGISTER_SAVE_BND3): Likewise.
(REGISTER_SAVE_RAX): Always defined to 0.
(VMOV): Removed.
(_dl_runtime_resolve_avx): Likewise.
(_dl_runtime_resolve_avx_slow): Likewise.
(_dl_runtime_resolve_avx_opt): Likewise.
(_dl_runtime_resolve_avx512): Likewise.
(_dl_runtime_resolve_avx512_opt): Likewise.
(_dl_runtime_resolve_sse): Likewise.
(_dl_runtime_resolve_sse_vex): Likewise.
(USE_FXSAVE): New.
(_dl_runtime_resolve_fxsave): Likewise.
(USE_XSAVE): Likewise.
(_dl_runtime_resolve_xsave): Likewise.
(USE_XSAVEC): Likewise.
(_dl_runtime_resolve_xsavec): Likewise.
* sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_avx512):
Removed.
(_dl_runtime_resolve_avx512_opt): Likewise.
(_dl_runtime_resolve_avx): Likewise.
(_dl_runtime_resolve_avx_opt): Likewise.
(_dl_runtime_resolve_sse): Likewise.
(_dl_runtime_resolve_sse_vex): Likewise.
(_dl_runtime_resolve_fxsave): New.
(_dl_runtime_resolve_xsave): Likewise.
(_dl_runtime_resolve_xsavec): Likewise.
Index: glibc-2.26/sysdeps/x86/cpu-features-offsets.sym
===================================================================
--- glibc-2.26.orig/sysdeps/x86/cpu-features-offsets.sym
+++ glibc-2.26/sysdeps/x86/cpu-features-offsets.sym
@@ -15,6 +15,7 @@ CPUID_ECX_OFFSET offsetof (struct cpuid_
CPUID_EDX_OFFSET offsetof (struct cpuid_registers, edx)
FAMILY_OFFSET offsetof (struct cpu_features, family)
MODEL_OFFSET offsetof (struct cpu_features, model)
+XSAVE_STATE_SIZE_OFFSET offsetof (struct cpu_features, xsave_state_size)
FEATURE_OFFSET offsetof (struct cpu_features, feature)
FEATURE_SIZE sizeof (unsigned int)
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
@@ -19,6 +19,7 @@
#include <cpuid.h>
#include <cpu-features.h>
#include <dl-hwcap.h>
+#include <libc-pointer-arith.h>
#if HAVE_TUNABLES
# define TUNABLE_NAMESPACE tune
@@ -103,6 +104,76 @@ get_common_indeces (struct cpu_features
}
}
}
+
+ /* For _dl_runtime_resolve, set xsave_state_size to xsave area
+ size + integer register save size and align it to 64 bytes. */
+ if (cpu_features->max_cpuid >= 0xd)
+ {
+ unsigned int eax, ebx, ecx, edx;
+
+ __cpuid_count (0xd, 0, eax, ebx, ecx, edx);
+ if (ebx != 0)
+ {
+ unsigned int xsave_state_full_size
+ = ALIGN_UP (ebx + STATE_SAVE_OFFSET, 64);
+
+ cpu_features->xsave_state_size
+ = xsave_state_full_size;
+ cpu_features->xsave_state_full_size
+ = xsave_state_full_size;
+
+ __cpuid_count (0xd, 1, eax, ebx, ecx, edx);
+
+ /* Check if XSAVEC is available. */
+ if ((eax & (1 << 1)) != 0)
+ {
+ unsigned int xstate_comp_offsets[32];
+ unsigned int xstate_comp_sizes[32];
+ unsigned int i;
+
+ xstate_comp_offsets[0] = 0;
+ xstate_comp_offsets[1] = 160;
+ xstate_comp_offsets[2] = 576;
+ xstate_comp_sizes[0] = 160;
+ xstate_comp_sizes[1] = 256;
+
+ for (i = 2; i < 32; i++)
+ {
+ if ((STATE_SAVE_MASK & (1 << i)) != 0)
+ {
+ __cpuid_count (0xd, i, eax, ebx, ecx, edx);
+ xstate_comp_sizes[i] = eax;
+ }
+ else
+ {
+ ecx = 0;
+ xstate_comp_sizes[i] = 0;
+ }
+
+ if (i > 2)
+ {
+ xstate_comp_offsets[i]
+ = (xstate_comp_offsets[i - 1]
+ + xstate_comp_sizes[i -1]);
+ if ((ecx & (1 << 1)) != 0)
+ xstate_comp_offsets[i]
+ = ALIGN_UP (xstate_comp_offsets[i], 64);
+ }
+ }
+
+ /* Use XSAVEC. */
+ unsigned int size
+ = xstate_comp_offsets[31] + xstate_comp_sizes[31];
+ if (size)
+ {
+ cpu_features->xsave_state_size
+ = ALIGN_UP (size + STATE_SAVE_OFFSET, 64);
+ cpu_features->feature[index_arch_XSAVEC_Usable]
+ |= bit_arch_XSAVEC_Usable;
+ }
+ }
+ }
+ }
}
}
@@ -242,23 +313,6 @@ init_cpu_features (struct cpu_features *
else
cpu_features->feature[index_arch_Prefer_No_AVX512]
|= bit_arch_Prefer_No_AVX512;
-
- /* To avoid SSE transition penalty, use _dl_runtime_resolve_slow.
- If XGETBV suports ECX == 1, use _dl_runtime_resolve_opt.
- Use _dl_runtime_resolve_opt only with AVX512F since it is
- slower than _dl_runtime_resolve_slow with AVX. */
- cpu_features->feature[index_arch_Use_dl_runtime_resolve_slow]
- |= bit_arch_Use_dl_runtime_resolve_slow;
- if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
- && cpu_features->max_cpuid >= 0xd)
- {
- unsigned int eax;
-
- __cpuid_count (0xd, 1, eax, ebx, ecx, edx);
- if ((eax & (1 << 2)) != 0)
- cpu_features->feature[index_arch_Use_dl_runtime_resolve_opt]
- |= bit_arch_Use_dl_runtime_resolve_opt;
- }
}
/* This spells out "AuthenticAMD". */
else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
Index: glibc-2.26/sysdeps/x86/cpu-features.h
===================================================================
--- glibc-2.26.orig/sysdeps/x86/cpu-features.h
+++ glibc-2.26/sysdeps/x86/cpu-features.h
@@ -37,9 +37,8 @@
#define bit_arch_Prefer_No_VZEROUPPER (1 << 17)
#define bit_arch_Fast_Unaligned_Copy (1 << 18)
#define bit_arch_Prefer_ERMS (1 << 19)
-#define bit_arch_Use_dl_runtime_resolve_opt (1 << 20)
-#define bit_arch_Use_dl_runtime_resolve_slow (1 << 21)
-#define bit_arch_Prefer_No_AVX512 (1 << 22)
+#define bit_arch_Prefer_No_AVX512 (1 << 20)
+#define bit_arch_XSAVEC_Usable (1 << 21)
/* CPUID Feature flags. */
@@ -88,6 +87,15 @@
/* The current maximum size of the feature integer bit array. */
#define FEATURE_INDEX_MAX 1
+/* Offset for fxsave/xsave area used by _dl_runtime_resolve. Also need
+ space to preserve RCX, RDX, RSI, RDI, R8, R9 and RAX. It must be
+ aligned to 16 bytes for fxsave and 64 bytes for xsave. */
+#define STATE_SAVE_OFFSET (8 * 7 + 8)
+
+/* Save SSE, AVX, AVX512, mask and bound registers. */
+#define STATE_SAVE_MASK \
+ ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 5) | (1 << 6) | (1 << 7))
+
#ifdef __ASSEMBLER__
# include <cpu-features-offsets.h>
@@ -123,8 +131,6 @@
# define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1*FEATURE_SIZE
# define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1*FEATURE_SIZE
# define index_arch_Prefer_ERMS FEATURE_INDEX_1*FEATURE_SIZE
-# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1*FEATURE_SIZE
-# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1*FEATURE_SIZE
# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1*FEATURE_SIZE
@@ -214,6 +220,18 @@ struct cpu_features
} cpuid[COMMON_CPUID_INDEX_MAX];
unsigned int family;
unsigned int model;
+ /* The state size for XSAVEC or XSAVE. The type must be unsigned long
+ int so that we use
+
+ sub xsave_state_size_offset(%rip) %RSP_LP
+
+ in _dl_runtime_resolve. */
+ unsigned long int xsave_state_size;
+ /* The full state size for XSAVE when XSAVEC is disabled by
+
+ GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable
+ */
+ unsigned int xsave_state_full_size;
unsigned int feature[FEATURE_INDEX_MAX];
/* Data cache size for use in memory and string routines, typically
L1 size. */
@@ -326,9 +344,8 @@ extern const struct cpu_features *__get_
# define index_arch_Prefer_No_VZEROUPPER FEATURE_INDEX_1
# define index_arch_Fast_Unaligned_Copy FEATURE_INDEX_1
# define index_arch_Prefer_ERMS FEATURE_INDEX_1
-# define index_arch_Use_dl_runtime_resolve_opt FEATURE_INDEX_1
-# define index_arch_Use_dl_runtime_resolve_slow FEATURE_INDEX_1
# define index_arch_Prefer_No_AVX512 FEATURE_INDEX_1
+# define index_arch_XSAVEC_Usable FEATURE_INDEX_1
#endif /* !__ASSEMBLER__ */
Index: glibc-2.26/sysdeps/x86/cpu-tunables.c
===================================================================
--- glibc-2.26.orig/sysdeps/x86/cpu-tunables.c
+++ glibc-2.26/sysdeps/x86/cpu-tunables.c
@@ -240,6 +240,16 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_v
Slow_SSE4_2, SSE4_2,
disable, 11);
break;
+ case 13:
+ if (disable)
+ {
+ /* Update xsave_state_size to XSAVE state size. */
+ cpu_features->xsave_state_size
+ = cpu_features->xsave_state_full_size;
+ CHECK_GLIBC_IFUNC_ARCH_OFF (n, cpu_features,
+ XSAVEC_Usable, 13);
+ }
+ break;
case 14:
if (disable)
{
@@ -308,13 +318,6 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_v
disable, 26);
}
break;
- case 27:
- {
- CHECK_GLIBC_IFUNC_ARCH_BOTH (n, cpu_features,
- Use_dl_runtime_resolve_slow,
- disable, 27);
- }
- break;
}
p += len + 1;
}
Index: glibc-2.26/sysdeps/x86_64/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/Makefile
+++ glibc-2.26/sysdeps/x86_64/Makefile
@@ -55,6 +55,10 @@ 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
+ifneq (no,$(have-tunables))
+# Test the state size for XSAVE when XSAVEC is disabled.
+tst-x86_64-1-ENV = GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable
+endif
$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
Index: glibc-2.26/sysdeps/x86_64/dl-machine.h
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/dl-machine.h
+++ glibc-2.26/sysdeps/x86_64/dl-machine.h
@@ -66,12 +66,9 @@ static inline int __attribute__ ((unused
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
Elf64_Addr *got;
- extern void _dl_runtime_resolve_sse (ElfW(Word)) attribute_hidden;
- extern void _dl_runtime_resolve_avx (ElfW(Word)) attribute_hidden;
- extern void _dl_runtime_resolve_avx_slow (ElfW(Word)) attribute_hidden;
- extern void _dl_runtime_resolve_avx_opt (ElfW(Word)) attribute_hidden;
- extern void _dl_runtime_resolve_avx512 (ElfW(Word)) attribute_hidden;
- extern void _dl_runtime_resolve_avx512_opt (ElfW(Word)) attribute_hidden;
+ extern void _dl_runtime_resolve_fxsave (ElfW(Word)) attribute_hidden;
+ extern void _dl_runtime_resolve_xsave (ElfW(Word)) attribute_hidden;
+ extern void _dl_runtime_resolve_xsavec (ElfW(Word)) attribute_hidden;
extern void _dl_runtime_profile_sse (ElfW(Word)) attribute_hidden;
extern void _dl_runtime_profile_avx (ElfW(Word)) attribute_hidden;
extern void _dl_runtime_profile_avx512 (ElfW(Word)) attribute_hidden;
@@ -120,29 +117,14 @@ elf_machine_runtime_setup (struct link_m
/* This function will get called to fix up the GOT entry
indicated by the offset on the stack, and then jump to
the resolved address. */
- if (HAS_ARCH_FEATURE (AVX512F_Usable))
- {
- if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt))
- *(ElfW(Addr) *) (got + 2)
- = (ElfW(Addr)) &_dl_runtime_resolve_avx512_opt;
- else
- *(ElfW(Addr) *) (got + 2)
- = (ElfW(Addr)) &_dl_runtime_resolve_avx512;
- }
- else if (HAS_ARCH_FEATURE (AVX_Usable))
- {
- if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_opt))
- *(ElfW(Addr) *) (got + 2)
- = (ElfW(Addr)) &_dl_runtime_resolve_avx_opt;
- else if (HAS_ARCH_FEATURE (Use_dl_runtime_resolve_slow))
- *(ElfW(Addr) *) (got + 2)
- = (ElfW(Addr)) &_dl_runtime_resolve_avx_slow;
- else
- *(ElfW(Addr) *) (got + 2)
- = (ElfW(Addr)) &_dl_runtime_resolve_avx;
- }
+ if (GLRO(dl_x86_cpu_features).xsave_state_size != 0)
+ *(ElfW(Addr) *) (got + 2)
+ = (HAS_ARCH_FEATURE (XSAVEC_Usable)
+ ? (ElfW(Addr)) &_dl_runtime_resolve_xsavec
+ : (ElfW(Addr)) &_dl_runtime_resolve_xsave);
else
- *(ElfW(Addr) *) (got + 2) = (ElfW(Addr)) &_dl_runtime_resolve_sse;
+ *(ElfW(Addr) *) (got + 2)
+ = (ElfW(Addr)) &_dl_runtime_resolve_fxsave;
}
}
Index: glibc-2.26/sysdeps/x86_64/dl-trampoline.S
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/dl-trampoline.S
+++ glibc-2.26/sysdeps/x86_64/dl-trampoline.S
@@ -34,41 +34,24 @@
# define DL_STACK_ALIGNMENT 8
#endif
-#ifndef DL_RUNTIME_UNALIGNED_VEC_SIZE
-/* The maximum size in bytes of unaligned vector load and store in the
- dynamic linker. Since SSE optimized memory/string functions with
- aligned SSE register load and store are used in the dynamic linker,
- we must set this to 8 so that _dl_runtime_resolve_sse will align the
- stack before calling _dl_fixup. */
-# define DL_RUNTIME_UNALIGNED_VEC_SIZE 8
-#endif
-
-/* True if _dl_runtime_resolve should align stack to VEC_SIZE bytes. */
+/* True if _dl_runtime_resolve should align stack for STATE_SAVE or align
+ stack to 16 bytes before calling _dl_fixup. */
#define DL_RUNTIME_RESOLVE_REALIGN_STACK \
- (VEC_SIZE > DL_STACK_ALIGNMENT \
- && VEC_SIZE > DL_RUNTIME_UNALIGNED_VEC_SIZE)
-
-/* Align vector register save area to 16 bytes. */
-#define REGISTER_SAVE_VEC_OFF 0
+ (STATE_SAVE_ALIGNMENT > DL_STACK_ALIGNMENT \
+ || 16 > DL_STACK_ALIGNMENT)
/* Area on stack to save and restore registers used for parameter
passing when calling _dl_fixup. */
#ifdef __ILP32__
-# define REGISTER_SAVE_RAX (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 8)
# define PRESERVE_BND_REGS_PREFIX
#else
-/* Align bound register save area to 16 bytes. */
-# define REGISTER_SAVE_BND0 (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 8)
-# define REGISTER_SAVE_BND1 (REGISTER_SAVE_BND0 + 16)
-# define REGISTER_SAVE_BND2 (REGISTER_SAVE_BND1 + 16)
-# define REGISTER_SAVE_BND3 (REGISTER_SAVE_BND2 + 16)
-# define REGISTER_SAVE_RAX (REGISTER_SAVE_BND3 + 16)
# ifdef HAVE_MPX_SUPPORT
# define PRESERVE_BND_REGS_PREFIX bnd
# else
# define PRESERVE_BND_REGS_PREFIX .byte 0xf2
# endif
#endif
+#define REGISTER_SAVE_RAX 0
#define REGISTER_SAVE_RCX (REGISTER_SAVE_RAX + 8)
#define REGISTER_SAVE_RDX (REGISTER_SAVE_RCX + 8)
#define REGISTER_SAVE_RSI (REGISTER_SAVE_RDX + 8)
@@ -80,68 +63,56 @@
#define VEC_SIZE 64
#define VMOVA vmovdqa64
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT
-# define VMOV vmovdqa64
-#else
-# define VMOV vmovdqu64
-#endif
#define VEC(i) zmm##i
-#define _dl_runtime_resolve _dl_runtime_resolve_avx512
#define _dl_runtime_profile _dl_runtime_profile_avx512
#include "dl-trampoline.h"
-#undef _dl_runtime_resolve
#undef _dl_runtime_profile
#undef VEC
-#undef VMOV
#undef VMOVA
#undef VEC_SIZE
#define VEC_SIZE 32
#define VMOVA vmovdqa
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT
-# define VMOV vmovdqa
-#else
-# define VMOV vmovdqu
-#endif
#define VEC(i) ymm##i
-#define _dl_runtime_resolve _dl_runtime_resolve_avx
-#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx_opt
#define _dl_runtime_profile _dl_runtime_profile_avx
#include "dl-trampoline.h"
-#undef _dl_runtime_resolve
-#undef _dl_runtime_resolve_opt
#undef _dl_runtime_profile
#undef VEC
-#undef VMOV
#undef VMOVA
#undef VEC_SIZE
/* movaps/movups is 1-byte shorter. */
#define VEC_SIZE 16
#define VMOVA movaps
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT
-# define VMOV movaps
-#else
-# define VMOV movups
-#endif
#define VEC(i) xmm##i
-#define _dl_runtime_resolve _dl_runtime_resolve_sse
#define _dl_runtime_profile _dl_runtime_profile_sse
#undef RESTORE_AVX
#include "dl-trampoline.h"
-#undef _dl_runtime_resolve
#undef _dl_runtime_profile
-#undef VMOV
+#undef VEC
#undef VMOVA
+#undef VEC_SIZE
-/* Used by _dl_runtime_resolve_avx_opt/_dl_runtime_resolve_avx512_opt
- to preserve the full vector registers with zero upper bits. */
-#define VMOVA vmovdqa
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK || VEC_SIZE <= DL_STACK_ALIGNMENT
-# define VMOV vmovdqa
-#else
-# define VMOV vmovdqu
-#endif
-#define _dl_runtime_resolve _dl_runtime_resolve_sse_vex
-#define _dl_runtime_resolve_opt _dl_runtime_resolve_avx512_opt
+#define USE_FXSAVE
+#define STATE_SAVE_ALIGNMENT 16
+#define _dl_runtime_resolve _dl_runtime_resolve_fxsave
+#include "dl-trampoline.h"
+#undef _dl_runtime_resolve
+#undef USE_FXSAVE
+#undef STATE_SAVE_ALIGNMENT
+
+#define USE_XSAVE
+#define STATE_SAVE_ALIGNMENT 64
+#define _dl_runtime_resolve _dl_runtime_resolve_xsave
+#include "dl-trampoline.h"
+#undef _dl_runtime_resolve
+#undef USE_XSAVE
+#undef STATE_SAVE_ALIGNMENT
+
+#define USE_XSAVEC
+#define STATE_SAVE_ALIGNMENT 64
+#define _dl_runtime_resolve _dl_runtime_resolve_xsavec
#include "dl-trampoline.h"
+#undef _dl_runtime_resolve
+#undef USE_XSAVEC
+#undef STATE_SAVE_ALIGNMENT
Index: glibc-2.26/sysdeps/x86_64/dl-trampoline.h
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/dl-trampoline.h
+++ glibc-2.26/sysdeps/x86_64/dl-trampoline.h
@@ -16,140 +16,47 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#undef REGISTER_SAVE_AREA_RAW
-#ifdef __ILP32__
-/* X32 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as VEC0 to
- VEC7. */
-# define REGISTER_SAVE_AREA_RAW (8 * 7 + VEC_SIZE * 8)
-#else
-/* X86-64 saves RCX, RDX, RSI, RDI, R8 and R9 plus RAX as well as
- BND0, BND1, BND2, BND3 and VEC0 to VEC7. */
-# define REGISTER_SAVE_AREA_RAW (8 * 7 + 16 * 4 + VEC_SIZE * 8)
-#endif
+ .text
+#ifdef _dl_runtime_resolve
-#undef REGISTER_SAVE_AREA
-#undef LOCAL_STORAGE_AREA
-#undef BASE
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK
-# define REGISTER_SAVE_AREA (REGISTER_SAVE_AREA_RAW + 8)
-/* Local stack area before jumping to function address: RBX. */
-# define LOCAL_STORAGE_AREA 8
-# define BASE rbx
-# if (REGISTER_SAVE_AREA % VEC_SIZE) != 0
-# error REGISTER_SAVE_AREA must be multples of VEC_SIZE
-# endif
-#else
-# define REGISTER_SAVE_AREA REGISTER_SAVE_AREA_RAW
-/* Local stack area before jumping to function address: All saved
- registers. */
-# define LOCAL_STORAGE_AREA REGISTER_SAVE_AREA
-# define BASE rsp
-# if (REGISTER_SAVE_AREA % 16) != 8
-# error REGISTER_SAVE_AREA must be odd multples of 8
-# endif
-#endif
+# undef REGISTER_SAVE_AREA
+# undef LOCAL_STORAGE_AREA
+# undef BASE
- .text
-#ifdef _dl_runtime_resolve_opt
-/* Use the smallest vector registers to preserve the full YMM/ZMM
- registers to avoid SSE transition penalty. */
+# if (STATE_SAVE_ALIGNMENT % 16) != 0
+# error STATE_SAVE_ALIGNMENT must be multples of 16
+# endif
-# if VEC_SIZE == 32
-/* Check if the upper 128 bits in %ymm0 - %ymm7 registers are non-zero
- and preserve %xmm0 - %xmm7 registers with the zero upper bits. Since
- there is no SSE transition penalty on AVX512 processors which don't
- support XGETBV with ECX == 1, _dl_runtime_resolve_avx512_slow isn't
- provided. */
- .globl _dl_runtime_resolve_avx_slow
- .hidden _dl_runtime_resolve_avx_slow
- .type _dl_runtime_resolve_avx_slow, @function
- .align 16
-_dl_runtime_resolve_avx_slow:
- cfi_startproc
- cfi_adjust_cfa_offset(16) # Incorporate PLT
- vorpd %ymm0, %ymm1, %ymm8
- vorpd %ymm2, %ymm3, %ymm9
- vorpd %ymm4, %ymm5, %ymm10
- vorpd %ymm6, %ymm7, %ymm11
- vorpd %ymm8, %ymm9, %ymm9
- vorpd %ymm10, %ymm11, %ymm10
- vpcmpeqd %xmm8, %xmm8, %xmm8
- vorpd %ymm9, %ymm10, %ymm10
- vptest %ymm10, %ymm8
- # Preserve %ymm0 - %ymm7 registers if the upper 128 bits of any
- # %ymm0 - %ymm7 registers aren't zero.
- PRESERVE_BND_REGS_PREFIX
- jnc _dl_runtime_resolve_avx
- # Use vzeroupper to avoid SSE transition penalty.
- vzeroupper
- # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits
- # when the upper 128 bits of %ymm0 - %ymm7 registers are zero.
- PRESERVE_BND_REGS_PREFIX
- jmp _dl_runtime_resolve_sse_vex
- cfi_adjust_cfa_offset(-16) # Restore PLT adjustment
- cfi_endproc
- .size _dl_runtime_resolve_avx_slow, .-_dl_runtime_resolve_avx_slow
+# if (STATE_SAVE_OFFSET % STATE_SAVE_ALIGNMENT) != 0
+# error STATE_SAVE_OFFSET must be multples of STATE_SAVE_ALIGNMENT
# endif
-/* Use XGETBV with ECX == 1 to check which bits in vector registers are
- non-zero and only preserve the non-zero lower bits with zero upper
- bits. */
- .globl _dl_runtime_resolve_opt
- .hidden _dl_runtime_resolve_opt
- .type _dl_runtime_resolve_opt, @function
- .align 16
-_dl_runtime_resolve_opt:
- cfi_startproc
- cfi_adjust_cfa_offset(16) # Incorporate PLT
- pushq %rax
- cfi_adjust_cfa_offset(8)
- cfi_rel_offset(%rax, 0)
- pushq %rcx
- cfi_adjust_cfa_offset(8)
- cfi_rel_offset(%rcx, 0)
- pushq %rdx
- cfi_adjust_cfa_offset(8)
- cfi_rel_offset(%rdx, 0)
- movl $1, %ecx
- xgetbv
- movl %eax, %r11d
- popq %rdx
- cfi_adjust_cfa_offset(-8)
- cfi_restore (%rdx)
- popq %rcx
- cfi_adjust_cfa_offset(-8)
- cfi_restore (%rcx)
- popq %rax
- cfi_adjust_cfa_offset(-8)
- cfi_restore (%rax)
-# if VEC_SIZE == 32
- # For YMM registers, check if YMM state is in use.
- andl $bit_YMM_state, %r11d
- # Preserve %xmm0 - %xmm7 registers with the zero upper 128 bits if
- # YMM state isn't in use.
- PRESERVE_BND_REGS_PREFIX
- jz _dl_runtime_resolve_sse_vex
-# elif VEC_SIZE == 16
- # For ZMM registers, check if YMM state and ZMM state are in
- # use.
- andl $(bit_YMM_state | bit_ZMM0_15_state), %r11d
- cmpl $bit_YMM_state, %r11d
- # Preserve %zmm0 - %zmm7 registers if ZMM state is in use.
- PRESERVE_BND_REGS_PREFIX
- jg _dl_runtime_resolve_avx512
- # Preserve %ymm0 - %ymm7 registers with the zero upper 256 bits if
- # ZMM state isn't in use.
- PRESERVE_BND_REGS_PREFIX
- je _dl_runtime_resolve_avx
- # Preserve %xmm0 - %xmm7 registers with the zero upper 384 bits if
- # neither YMM state nor ZMM state are in use.
+# if DL_RUNTIME_RESOLVE_REALIGN_STACK
+/* Local stack area before jumping to function address: RBX. */
+# define LOCAL_STORAGE_AREA 8
+# define BASE rbx
+# ifdef USE_FXSAVE
+/* Use fxsave to save XMM registers. */
+# define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET)
+# if (REGISTER_SAVE_AREA % 16) != 0
+# error REGISTER_SAVE_AREA must be multples of 16
+# endif
+# endif
# else
-# error Unsupported VEC_SIZE!
+# ifndef USE_FXSAVE
+# error USE_FXSAVE must be defined
+# endif
+/* Use fxsave to save XMM registers. */
+# define REGISTER_SAVE_AREA (512 + STATE_SAVE_OFFSET + 8)
+/* Local stack area before jumping to function address: All saved
+ registers. */
+# define LOCAL_STORAGE_AREA REGISTER_SAVE_AREA
+# define BASE rsp
+# if (REGISTER_SAVE_AREA % 16) != 8
+# error REGISTER_SAVE_AREA must be odd multples of 8
+# endif
# endif
- cfi_adjust_cfa_offset(-16) # Restore PLT adjustment
- cfi_endproc
- .size _dl_runtime_resolve_opt, .-_dl_runtime_resolve_opt
-#endif
+
.globl _dl_runtime_resolve
.hidden _dl_runtime_resolve
.type _dl_runtime_resolve, @function
@@ -157,21 +64,30 @@ _dl_runtime_resolve_opt:
cfi_startproc
_dl_runtime_resolve:
cfi_adjust_cfa_offset(16) # Incorporate PLT
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK
-# if LOCAL_STORAGE_AREA != 8
-# error LOCAL_STORAGE_AREA must be 8
-# endif
+# if DL_RUNTIME_RESOLVE_REALIGN_STACK
+# if LOCAL_STORAGE_AREA != 8
+# error LOCAL_STORAGE_AREA must be 8
+# endif
pushq %rbx # push subtracts stack by 8.
cfi_adjust_cfa_offset(8)
cfi_rel_offset(%rbx, 0)
mov %RSP_LP, %RBX_LP
cfi_def_cfa_register(%rbx)
- and $-VEC_SIZE, %RSP_LP
-#endif
+ and $-STATE_SAVE_ALIGNMENT, %RSP_LP
+# endif
+# ifdef REGISTER_SAVE_AREA
sub $REGISTER_SAVE_AREA, %RSP_LP
-#if !DL_RUNTIME_RESOLVE_REALIGN_STACK
+# if !DL_RUNTIME_RESOLVE_REALIGN_STACK
cfi_adjust_cfa_offset(REGISTER_SAVE_AREA)
-#endif
+# endif
+# else
+ # Allocate stack space of the required size to save the state.
+# if IS_IN (rtld)
+ sub _rtld_local_ro+RTLD_GLOBAL_RO_DL_X86_CPU_FEATURES_OFFSET+XSAVE_STATE_SIZE_OFFSET(%rip), %RSP_LP
+# else
+ sub _dl_x86_cpu_features+XSAVE_STATE_SIZE_OFFSET(%rip), %RSP_LP
+# endif
+# endif
# Preserve registers otherwise clobbered.
movq %rax, REGISTER_SAVE_RAX(%rsp)
movq %rcx, REGISTER_SAVE_RCX(%rsp)
@@ -180,59 +96,42 @@ _dl_runtime_resolve:
movq %rdi, REGISTER_SAVE_RDI(%rsp)
movq %r8, REGISTER_SAVE_R8(%rsp)
movq %r9, REGISTER_SAVE_R9(%rsp)
- VMOV %VEC(0), (REGISTER_SAVE_VEC_OFF)(%rsp)
- VMOV %VEC(1), (REGISTER_SAVE_VEC_OFF + VEC_SIZE)(%rsp)
- VMOV %VEC(2), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 2)(%rsp)
- VMOV %VEC(3), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 3)(%rsp)
- VMOV %VEC(4), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 4)(%rsp)
- VMOV %VEC(5), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 5)(%rsp)
- VMOV %VEC(6), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 6)(%rsp)
- VMOV %VEC(7), (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 7)(%rsp)
-#ifndef __ILP32__
- # We also have to preserve bound registers. These are nops if
- # Intel MPX isn't available or disabled.
-# ifdef HAVE_MPX_SUPPORT
- bndmov %bnd0, REGISTER_SAVE_BND0(%rsp)
- bndmov %bnd1, REGISTER_SAVE_BND1(%rsp)
- bndmov %bnd2, REGISTER_SAVE_BND2(%rsp)
- bndmov %bnd3, REGISTER_SAVE_BND3(%rsp)
+# ifdef USE_FXSAVE
+ fxsave STATE_SAVE_OFFSET(%rsp)
# else
-# if REGISTER_SAVE_BND0 == 0
- .byte 0x66,0x0f,0x1b,0x04,0x24
+ movl $STATE_SAVE_MASK, %eax
+ xorl %edx, %edx
+ # Clear the XSAVE Header.
+# ifdef USE_XSAVE
+ movq %rdx, (STATE_SAVE_OFFSET + 512)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8)(%rsp)
+# endif
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 2)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 3)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 4)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 5)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 6)(%rsp)
+ movq %rdx, (STATE_SAVE_OFFSET + 512 + 8 * 7)(%rsp)
+# ifdef USE_XSAVE
+ xsave STATE_SAVE_OFFSET(%rsp)
# else
- .byte 0x66,0x0f,0x1b,0x44,0x24,REGISTER_SAVE_BND0
+ xsavec STATE_SAVE_OFFSET(%rsp)
# endif
- .byte 0x66,0x0f,0x1b,0x4c,0x24,REGISTER_SAVE_BND1
- .byte 0x66,0x0f,0x1b,0x54,0x24,REGISTER_SAVE_BND2
- .byte 0x66,0x0f,0x1b,0x5c,0x24,REGISTER_SAVE_BND3
# endif
-#endif
# Copy args pushed by PLT in register.
# %rdi: link_map, %rsi: reloc_index
mov (LOCAL_STORAGE_AREA + 8)(%BASE), %RSI_LP
mov LOCAL_STORAGE_AREA(%BASE), %RDI_LP
call _dl_fixup # Call resolver.
mov %RAX_LP, %R11_LP # Save return value
-#ifndef __ILP32__
- # Restore bound registers. These are nops if Intel MPX isn't
- # avaiable or disabled.
-# ifdef HAVE_MPX_SUPPORT
- bndmov REGISTER_SAVE_BND3(%rsp), %bnd3
- bndmov REGISTER_SAVE_BND2(%rsp), %bnd2
- bndmov REGISTER_SAVE_BND1(%rsp), %bnd1
- bndmov REGISTER_SAVE_BND0(%rsp), %bnd0
+ # Get register content back.
+# ifdef USE_FXSAVE
+ fxrstor STATE_SAVE_OFFSET(%rsp)
# else
- .byte 0x66,0x0f,0x1a,0x5c,0x24,REGISTER_SAVE_BND3
- .byte 0x66,0x0f,0x1a,0x54,0x24,REGISTER_SAVE_BND2
- .byte 0x66,0x0f,0x1a,0x4c,0x24,REGISTER_SAVE_BND1
-# if REGISTER_SAVE_BND0 == 0
- .byte 0x66,0x0f,0x1a,0x04,0x24
-# else
- .byte 0x66,0x0f,0x1a,0x44,0x24,REGISTER_SAVE_BND0
-# endif
+ movl $STATE_SAVE_MASK, %eax
+ xorl %edx, %edx
+ xrstor STATE_SAVE_OFFSET(%rsp)
# endif
-#endif
- # Get register content back.
movq REGISTER_SAVE_R9(%rsp), %r9
movq REGISTER_SAVE_R8(%rsp), %r8
movq REGISTER_SAVE_RDI(%rsp), %rdi
@@ -240,20 +139,12 @@ _dl_runtime_resolve:
movq REGISTER_SAVE_RDX(%rsp), %rdx
movq REGISTER_SAVE_RCX(%rsp), %rcx
movq REGISTER_SAVE_RAX(%rsp), %rax
- VMOV (REGISTER_SAVE_VEC_OFF)(%rsp), %VEC(0)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE)(%rsp), %VEC(1)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 2)(%rsp), %VEC(2)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 3)(%rsp), %VEC(3)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 4)(%rsp), %VEC(4)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 5)(%rsp), %VEC(5)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 6)(%rsp), %VEC(6)
- VMOV (REGISTER_SAVE_VEC_OFF + VEC_SIZE * 7)(%rsp), %VEC(7)
-#if DL_RUNTIME_RESOLVE_REALIGN_STACK
+# if DL_RUNTIME_RESOLVE_REALIGN_STACK
mov %RBX_LP, %RSP_LP
cfi_def_cfa_register(%rsp)
movq (%rsp), %rbx
cfi_restore(%rbx)
-#endif
+# endif
# Adjust stack(PLT did 2 pushes)
add $(LOCAL_STORAGE_AREA + 16), %RSP_LP
cfi_adjust_cfa_offset(-(LOCAL_STORAGE_AREA + 16))
@@ -262,11 +153,9 @@ _dl_runtime_resolve:
jmp *%r11 # Jump to function address.
cfi_endproc
.size _dl_runtime_resolve, .-_dl_runtime_resolve
+#endif
-/* To preserve %xmm0 - %xmm7 registers, dl-trampoline.h is included
- twice, for _dl_runtime_resolve_sse and _dl_runtime_resolve_sse_vex.
- But we don't need another _dl_runtime_profile for XMM registers. */
#if !defined PROF && defined _dl_runtime_profile
# if (LR_VECTOR_OFFSET % VEC_SIZE) != 0
# error LR_VECTOR_OFFSET must be multples of VEC_SIZE

View File

@ -1,127 +0,0 @@
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

@ -1,31 +0,0 @@
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

View File

@ -1,573 +0,0 @@
2017-10-10 Siddhesh Poyarekar <siddhesh@sourceware.org>
* sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add
memmove_falkor.
* sysdeps/aarch64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Likewise.
* sysdeps/aarch64/multiarch/memmove.c: Likewise.
* sysdeps/aarch64/multiarch/memmove_falkor.S: New file.
* benchtests/bench-memmove-walk.c: New file.
* benchtests/Makefile (string-benchset): Add it.
* benchtests/bench-memset-walk.c: New file.
* benchtests/Makefile (string-benchset): Add it.
* benchtests/bench-memcpy-walk.c: New file.
* benchtests/Makefile (string-benchset): Add it.
2017-10-10 Siddhesh Poyarekar <siddhesh@sourceware.org>
* manual/tunables.texi (Tunable glibc.tune.cpu): Add falkor.
* sysdeps/aarch64/multiarch/Makefile (sysdep_routines): Add
memcpy_falkor.
* sysdeps/aarch64/multiarch/ifunc-impl-list.c (MAX_IFUNC):
Bump.
(__libc_ifunc_impl_list): Add __memcpy_falkor.
* sysdeps/aarch64/multiarch/memcpy.c: Likewise.
* sysdeps/aarch64/multiarch/memcpy_falkor.S: New file.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.c (cpu_list):
Add falkor.
* sysdeps/unix/sysv/linux/aarch64/cpu-features.h (IS_FALKOR):
New macro.
Index: glibc-2.26/manual/tunables.texi
===================================================================
--- glibc-2.26.orig/manual/tunables.texi
+++ glibc-2.26/manual/tunables.texi
@@ -267,7 +267,7 @@ This tunable is specific to i386 and x86
@deftp Tunable glibc.tune.cpu
The @code{glibc.tune.cpu=xxx} tunable allows the user to tell @theglibc{} to
assume that the CPU is @code{xxx} where xxx may have one of these values:
-@code{generic}, @code{thunderxt88}.
+@code{generic}, @code{falkor}, @code{thunderxt88}.
This tunable is specific to aarch64.
@end deftp
Index: glibc-2.26/sysdeps/aarch64/multiarch/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/aarch64/multiarch/Makefile
+++ glibc-2.26/sysdeps/aarch64/multiarch/Makefile
@@ -1,3 +1,4 @@
ifeq ($(subdir),string)
-sysdep_routines += memcpy_generic memcpy_thunderx
+sysdep_routines += memcpy_generic memcpy_thunderx memcpy_falkor \
+ memmove_falkor
endif
Index: glibc-2.26/sysdeps/aarch64/multiarch/ifunc-impl-list.c
===================================================================
--- glibc-2.26.orig/sysdeps/aarch64/multiarch/ifunc-impl-list.c
+++ glibc-2.26/sysdeps/aarch64/multiarch/ifunc-impl-list.c
@@ -25,7 +25,7 @@
#include <stdio.h>
/* Maximum number of IFUNC implementations. */
-#define MAX_IFUNC 2
+#define MAX_IFUNC 3
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
@@ -40,9 +40,11 @@ __libc_ifunc_impl_list (const char *name
/* Support sysdeps/aarch64/multiarch/memcpy.c and memmove.c. */
IFUNC_IMPL (i, name, memcpy,
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx)
+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_falkor)
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_generic))
IFUNC_IMPL (i, name, memmove,
IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_thunderx)
+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_falkor)
IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_generic))
return i;
Index: glibc-2.26/sysdeps/aarch64/multiarch/memcpy.c
===================================================================
--- glibc-2.26.orig/sysdeps/aarch64/multiarch/memcpy.c
+++ glibc-2.26/sysdeps/aarch64/multiarch/memcpy.c
@@ -30,9 +30,14 @@ extern __typeof (__redirect_memcpy) __li
extern __typeof (__redirect_memcpy) __memcpy_generic attribute_hidden;
extern __typeof (__redirect_memcpy) __memcpy_thunderx attribute_hidden;
+extern __typeof (__redirect_memcpy) __memcpy_falkor attribute_hidden;
libc_ifunc (__libc_memcpy,
- IS_THUNDERX (midr) ? __memcpy_thunderx : __memcpy_generic);
+ (IS_THUNDERX (midr)
+ ? __memcpy_thunderx
+ : (IS_FALKOR (midr)
+ ? __memcpy_falkor
+ : __memcpy_generic)));
# undef memcpy
strong_alias (__libc_memcpy, memcpy);
Index: glibc-2.26/sysdeps/aarch64/multiarch/memcpy_falkor.S
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/aarch64/multiarch/memcpy_falkor.S
@@ -0,0 +1,184 @@
+/* Optimized memcpy for Qualcomm Falkor processor.
+ 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 <sysdep.h>
+
+/* Assumptions:
+
+ ARMv8-a, AArch64, falkor, unaligned accesses. */
+
+#define dstin x0
+#define src x1
+#define count x2
+#define dst x3
+#define srcend x4
+#define dstend x5
+#define A_l x6
+#define A_lw w6
+#define A_h x7
+#define A_hw w7
+#define tmp1 x14
+
+/* Copies are split into 3 main cases:
+
+ 1. Small copies of up to 32 bytes
+ 2. Medium copies of 33..128 bytes which are fully unrolled
+ 3. Large copies of more than 128 bytes.
+
+ Large copies align the sourceto a quad word and use an unrolled loop
+ processing 64 bytes per iteration.
+
+ FALKOR-SPECIFIC DESIGN:
+
+ The smallest copies (32 bytes or less) focus on optimal pipeline usage,
+ which is why the redundant copies of 0-3 bytes have been replaced with
+ conditionals, since the former would unnecessarily break across multiple
+ issue groups. The medium copy group has been enlarged to 128 bytes since
+ bumping up the small copies up to 32 bytes allows us to do that without
+ cost and also allows us to reduce the size of the prep code before loop64.
+
+ All copies are done only via two registers r6 and r7. This is to ensure
+ that all loads hit a single hardware prefetcher which can get correctly
+ trained to prefetch a single stream.
+
+ The non-temporal stores help optimize cache utilization. */
+
+#if IS_IN (libc)
+ENTRY_ALIGN (__memcpy_falkor, 6)
+
+ cmp count, 32
+ add srcend, src, count
+ add dstend, dstin, count
+ b.ls L(copy32)
+ ldp A_l, A_h, [src]
+ cmp count, 128
+ stp A_l, A_h, [dstin]
+ b.hi L(copy_long)
+
+ /* Medium copies: 33..128 bytes. */
+ sub tmp1, count, 1
+ ldp A_l, A_h, [src, 16]
+ stp A_l, A_h, [dstin, 16]
+ tbz tmp1, 6, 1f
+ ldp A_l, A_h, [src, 32]
+ stp A_l, A_h, [dstin, 32]
+ ldp A_l, A_h, [src, 48]
+ stp A_l, A_h, [dstin, 48]
+ ldp A_l, A_h, [srcend, -64]
+ stp A_l, A_h, [dstend, -64]
+ ldp A_l, A_h, [srcend, -48]
+ stp A_l, A_h, [dstend, -48]
+1:
+ ldp A_l, A_h, [srcend, -32]
+ stp A_l, A_h, [dstend, -32]
+ ldp A_l, A_h, [srcend, -16]
+ stp A_l, A_h, [dstend, -16]
+ ret
+
+ .p2align 4
+ /* Small copies: 0..32 bytes. */
+L(copy32):
+ /* 16-32 */
+ cmp count, 16
+ b.lo 1f
+ ldp A_l, A_h, [src]
+ stp A_l, A_h, [dstin]
+ ldp A_l, A_h, [srcend, -16]
+ stp A_l, A_h, [dstend, -16]
+ ret
+ .p2align 4
+1:
+ /* 8-15 */
+ tbz count, 3, 1f
+ ldr A_l, [src]
+ str A_l, [dstin]
+ ldr A_l, [srcend, -8]
+ str A_l, [dstend, -8]
+ ret
+ .p2align 4
+1:
+ /* 4-7 */
+ tbz count, 2, 1f
+ ldr A_lw, [src]
+ str A_lw, [dstin]
+ ldr A_lw, [srcend, -4]
+ str A_lw, [dstend, -4]
+ ret
+ .p2align 4
+1:
+ /* 2-3 */
+ tbz count, 1, 1f
+ ldrh A_lw, [src]
+ strh A_lw, [dstin]
+ ldrh A_lw, [srcend, -2]
+ strh A_lw, [dstend, -2]
+ ret
+ .p2align 4
+1:
+ /* 0-1 */
+ tbz count, 0, 1f
+ ldrb A_lw, [src]
+ strb A_lw, [dstin]
+1:
+ ret
+
+ /* Align SRC to 16 bytes and copy; that way at least one of the
+ accesses is aligned throughout the copy sequence.
+
+ The count is off by 0 to 15 bytes, but this is OK because we trim
+ off the last 64 bytes to copy off from the end. Due to this the
+ loop never runs out of bounds. */
+ .p2align 6
+L(copy_long):
+ sub count, count, 64 + 16
+ and tmp1, src, 15
+ bic src, src, 15
+ sub dst, dstin, tmp1
+ add count, count, tmp1
+
+L(loop64):
+ ldp A_l, A_h, [src, 16]!
+ stnp A_l, A_h, [dst, 16]
+ ldp A_l, A_h, [src, 16]!
+ subs count, count, 64
+ stnp A_l, A_h, [dst, 32]
+ ldp A_l, A_h, [src, 16]!
+ stnp A_l, A_h, [dst, 48]
+ ldp A_l, A_h, [src, 16]!
+ stnp A_l, A_h, [dst, 64]
+ add dst, dst, 64
+ b.hi L(loop64)
+
+ /* Write the last full set of 64 bytes. The remainder is at most 64
+ bytes, so it is safe to always copy 64 bytes from the end even if
+ there is just 1 byte left. */
+L(last64):
+ ldp A_l, A_h, [srcend, -64]
+ stnp A_l, A_h, [dstend, -64]
+ ldp A_l, A_h, [srcend, -48]
+ stnp A_l, A_h, [dstend, -48]
+ ldp A_l, A_h, [srcend, -32]
+ stnp A_l, A_h, [dstend, -32]
+ ldp A_l, A_h, [srcend, -16]
+ stnp A_l, A_h, [dstend, -16]
+ ret
+
+END (__memcpy_falkor)
+libc_hidden_builtin_def (__memcpy_falkor)
+#endif
Index: glibc-2.26/sysdeps/aarch64/multiarch/memmove.c
===================================================================
--- glibc-2.26.orig/sysdeps/aarch64/multiarch/memmove.c
+++ glibc-2.26/sysdeps/aarch64/multiarch/memmove.c
@@ -30,9 +30,14 @@ extern __typeof (__redirect_memmove) __l
extern __typeof (__redirect_memmove) __memmove_generic attribute_hidden;
extern __typeof (__redirect_memmove) __memmove_thunderx attribute_hidden;
+extern __typeof (__redirect_memmove) __memmove_falkor attribute_hidden;
libc_ifunc (__libc_memmove,
- IS_THUNDERX (midr) ? __memmove_thunderx : __memmove_generic);
+ (IS_THUNDERX (midr)
+ ? __memmove_thunderx
+ : (IS_FALKOR (midr)
+ ? __memmove_falkor
+ : __memmove_generic)));
# undef memmove
strong_alias (__libc_memmove, memmove);
Index: glibc-2.26/sysdeps/aarch64/multiarch/memmove_falkor.S
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/aarch64/multiarch/memmove_falkor.S
@@ -0,0 +1,232 @@
+/* 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 <sysdep.h>
+
+/* Assumptions: ARMv8-a, AArch64, falkor, unaligned accesses. */
+
+#define dstin x0
+#define src x1
+#define count x2
+#define dstlen x3
+#define dst x3
+#define srcend x4
+#define dstend x5
+#define A_l x6
+#define A_lw w6
+#define A_h x7
+#define A_hw w7
+#define B_l x8
+#define B_lw w8
+#define B_h x9
+#define C_l x10
+#define C_h x11
+#define D_l x12
+#define D_h x13
+#define E_l src
+#define E_h count
+#define F_l srcend
+#define F_h dst
+#define tmp1 x14
+
+/* Alias with A_l and A_h to train the prefetcher. */
+#define Q_l x22
+#define Q_h x23
+
+/* RATIONALE:
+
+ The copy has 4 distinct parts:
+ * Small copies of 16 bytes and under
+ * Medium sized copies of 17-96 bytes
+ * Large copies where the source address is higher than the destination
+ (forward copies)
+ * Large copies where the destination address is higher than the source
+ (copy backward, or move).
+
+ We use only two registerpairs x6,x7 and x22,x23 for the copies and copy 32
+ bytes at a time to correctly train the hardware prefetcher for better
+ throughput. */
+ENTRY_ALIGN (__memmove_falkor, 6)
+
+ sub tmp1, dstin, src
+ add srcend, src, count
+ add dstend, dstin, count
+ cmp count, 96
+ ccmp tmp1, count, 2, hi
+ b.lo L(move_long)
+
+ cmp count, 16
+ b.ls L(copy16)
+ cmp count, 96
+ b.hi L(copy_long)
+
+ /* Medium copies: 17..96 bytes. */
+ sub tmp1, count, 1
+ ldp A_l, A_h, [src]
+ tbnz tmp1, 6, L(copy96)
+ ldp D_l, D_h, [srcend, -16]
+ tbz tmp1, 5, 1f
+ ldp B_l, B_h, [src, 16]
+ ldp C_l, C_h, [srcend, -32]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstend, -32]
+1:
+ stp A_l, A_h, [dstin]
+ stp D_l, D_h, [dstend, -16]
+ ret
+
+ .p2align 4
+ /* Small copies: 0..16 bytes. */
+L(copy16):
+ cmp count, 8
+ b.lo 1f
+ ldr A_l, [src]
+ ldr A_h, [srcend, -8]
+ str A_l, [dstin]
+ str A_h, [dstend, -8]
+ ret
+ .p2align 4
+1:
+ /* 4-7 */
+ tbz count, 2, 1f
+ ldr A_lw, [src]
+ ldr A_hw, [srcend, -4]
+ str A_lw, [dstin]
+ str A_hw, [dstend, -4]
+ ret
+ .p2align 4
+1:
+ /* 2-3 */
+ tbz count, 1, 1f
+ ldrh A_lw, [src]
+ ldrh A_hw, [srcend, -2]
+ strh A_lw, [dstin]
+ strh A_hw, [dstend, -2]
+ ret
+ .p2align 4
+1:
+ /* 0-1 */
+ tbz count, 0, 1f
+ ldrb A_lw, [src]
+ strb A_lw, [dstin]
+1: ret
+
+ .p2align 4
+ /* Copy 64..96 bytes. Copy 64 bytes from the start and
+ 32 bytes from the end. */
+L(copy96):
+ ldp B_l, B_h, [src, 16]
+ ldp C_l, C_h, [src, 32]
+ ldp D_l, D_h, [src, 48]
+ ldp E_l, E_h, [srcend, -32]
+ ldp F_l, F_h, [srcend, -16]
+ stp A_l, A_h, [dstin]
+ stp B_l, B_h, [dstin, 16]
+ stp C_l, C_h, [dstin, 32]
+ stp D_l, D_h, [dstin, 48]
+ stp E_l, E_h, [dstend, -32]
+ stp F_l, F_h, [dstend, -16]
+ ret
+
+ /* Align SRC to 16 byte alignment so that we don't cross cache line
+ boundaries on both loads and stores. There are at least 96 bytes
+ to copy, so copy 16 bytes unaligned and then align. The loop
+ copies 32 bytes per iteration and prefetches one iteration ahead. */
+
+ .p2align 4
+L(copy_long):
+ sub count, count, 64 + 16 /* Test and readjust count. */
+ mov B_l, Q_l
+ mov B_h, Q_h
+ ldp A_l, A_h, [src]
+ and tmp1, src, 15
+ bic src, src, 15
+ sub dst, dstin, tmp1
+ add count, count, tmp1 /* Count is now 16 too large. */
+ ldp Q_l, Q_h, [src, 16]!
+ stp A_l, A_h, [dstin]
+ ldp A_l, A_h, [src, 16]!
+
+L(loop64):
+ subs count, count, 32
+ stp Q_l, Q_h, [dst, 16]
+ ldp Q_l, Q_h, [src, 16]!
+ stp A_l, A_h, [dst, 32]!
+ ldp A_l, A_h, [src, 16]!
+ b.hi L(loop64)
+
+ /* Write the last full set of 32 bytes. The remainder is at most 32
+ bytes, so it is safe to always copy 32 bytes from the end even if
+ there is just 1 byte left. */
+L(last64):
+ ldp C_l, C_h, [srcend, -32]
+ stp Q_l, Q_h, [dst, 16]
+ ldp Q_l, Q_h, [srcend, -16]
+ stp A_l, A_h, [dst, 32]
+ stp C_l, C_h, [dstend, -32]
+ stp Q_l, Q_h, [dstend, -16]
+ mov Q_l, B_l
+ mov Q_h, B_h
+ ret
+
+ .p2align 4
+L(move_long):
+ cbz tmp1, 3f
+
+ mov B_l, Q_l
+ mov B_h, Q_h
+
+ /* Align SRCEND to 16 byte alignment so that we don't cross cache line
+ boundaries on both loads and stores. There are at least 96 bytes
+ to copy, so copy 16 bytes unaligned and then align. The loop
+ copies 32 bytes per iteration and prefetches one iteration ahead. */
+
+ ldp A_l, A_h, [srcend, -16]
+ and tmp1, srcend, 15
+ sub srcend, srcend, tmp1
+ ldp Q_l, Q_h, [srcend, -16]!
+ stp A_l, A_h, [dstend, -16]
+ sub count, count, tmp1
+ ldp A_l, A_h, [srcend, -16]!
+ sub dstend, dstend, tmp1
+ sub count, count, 64
+
+1:
+ subs count, count, 32
+ stp Q_l, Q_h, [dstend, -16]
+ ldp Q_l, Q_h, [srcend, -16]!
+ stp A_l, A_h, [dstend, -32]!
+ ldp A_l, A_h, [srcend, -16]!
+ b.hi 1b
+
+ /* Write the last full set of 32 bytes. The remainder is at most 32
+ bytes, so it is safe to always copy 32 bytes from the start even if
+ there is just 1 byte left. */
+2:
+ ldp C_l, C_h, [src, 16]
+ stp Q_l, Q_h, [dstend, -16]
+ ldp Q_l, Q_h, [src]
+ stp A_l, A_h, [dstend, -32]
+ stp C_l, C_h, [dstin, 16]
+ stp Q_l, Q_h, [dstin]
+ mov Q_l, B_l
+ mov Q_h, B_h
+3: ret
+
+END (__memmove_falkor)
+libc_hidden_builtin_def (__memmove_falkor)
Index: glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
+++ glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.c
@@ -28,6 +28,7 @@ struct cpu_list
};
static struct cpu_list cpu_list[] = {
+ {"falkor", 0x510FC000},
{"thunderxt88", 0x430F0A10},
{"generic", 0x0}
};
Index: glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
+++ glibc-2.26/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
@@ -41,6 +41,9 @@
#define IS_THUNDERX(midr) (MIDR_IMPLEMENTOR(midr) == 'C' \
&& MIDR_PARTNUM(midr) == 0x0a1)
+#define IS_FALKOR(midr) (MIDR_IMPLEMENTOR(midr) == 'Q' \
+ && MIDR_PARTNUM(midr) == 0xc00)
+
struct cpu_features
{
uint64_t midr_el1;

View File

@ -1,88 +0,0 @@
2017-12-30 Aurelien Jarno <aurelien@aurel32.net>
Dmitry V. Levin <ldv@altlinux.org>
[BZ #22625]
* elf/dl-load.c (fillin_rpath): Check for empty tokens before dynamic
string token expansion. Check for NULL pointer or empty string possibly
returned by expand_dynamic_string_token.
(decompose_rpath): Check for empty path after dynamic string
token expansion.
Index: glibc-2.26/elf/dl-load.c
===================================================================
--- glibc-2.26.orig/elf/dl-load.c
+++ glibc-2.26/elf/dl-load.c
@@ -435,32 +435,41 @@ fillin_rpath (char *rpath, struct r_sear
{
char *cp;
size_t nelems = 0;
- char *to_free;
while ((cp = __strsep (&rpath, sep)) != NULL)
{
struct r_search_path_elem *dirp;
+ char *to_free = NULL;
+ size_t len = 0;
- to_free = cp = expand_dynamic_string_token (l, cp, 1);
+ /* `strsep' can pass an empty string. */
+ if (*cp != '\0')
+ {
+ to_free = cp = expand_dynamic_string_token (l, cp, 1);
- size_t len = strlen (cp);
+ /* expand_dynamic_string_token can return NULL in case of empty
+ path or memory allocation failure. */
+ if (cp == NULL)
+ continue;
+
+ /* Compute the length after dynamic string token expansion and
+ ignore empty paths. */
+ len = strlen (cp);
+ if (len == 0)
+ {
+ free (to_free);
+ continue;
+ }
- /* `strsep' can pass an empty string. This has to be
- interpreted as `use the current directory'. */
- if (len == 0)
- {
- static const char curwd[] = "./";
- cp = (char *) curwd;
+ /* Remove trailing slashes (except for "/"). */
+ while (len > 1 && cp[len - 1] == '/')
+ --len;
+
+ /* Now add one if there is none so far. */
+ if (len > 0 && cp[len - 1] != '/')
+ cp[len++] = '/';
}
- /* Remove trailing slashes (except for "/"). */
- while (len > 1 && cp[len - 1] == '/')
- --len;
-
- /* Now add one if there is none so far. */
- if (len > 0 && cp[len - 1] != '/')
- cp[len++] = '/';
-
/* Make sure we don't use untrusted directories if we run SUID. */
if (__glibc_unlikely (check_trusted) && !is_trusted_path (cp, len))
{
@@ -623,6 +632,14 @@ decompose_rpath (struct r_search_path_st
necessary. */
free (copy);
+ /* There is no path after expansion. */
+ if (result[0] == NULL)
+ {
+ free (result);
+ sps->dirs = (struct r_search_path_elem **) -1;
+ return false;
+ }
+
sps->dirs = result;
/* The caller will change this value if we haven't used a real malloc. */
sps->malloced = 1;

View File

@ -1,87 +1,70 @@
Always do locking when accessing streams Always do locking when accessing streams (bug 15142)
During exit, skip files that are currently locked to avoid deadlock.
[BZ #15142] [BZ #15142]
* libio/genops.c (_IO_list_all_stamp): Delete. All uses removed. * include/bits/libio.h (_IO_ftrylockfile) [_IO_MTSAVE_IO]: Define.
(_IO_flush_all_all_lockp): Delete. * libio/genops.c (_IO_flush_all_lockp): Make static. Rename
(_IO_flush_all): Replace with body of _IO_flush_all_all_lockp. argument to skip_locked, callers changed. Skip files that are
Always do locking. locked if skip_locked.
(_IO_unbuffer_all): Always do locking. (_IO_unbuffer_all): Lock files before access, but skip locked
(_IO_cleanup): Call _IO_flush_all instead of _IO_flush_all_lockp. files.
* libio/libioP.h (_IO_flush_all_all_lockp): Remove declaration. * libio/libioP.h (_IO_flush_all_lockp): Don't declare.
diff --git a/libio/genops.c b/libio/genops.c Index: glibc-2.27/include/bits/libio.h
index e0ce8cc..9def1d4 100644 ===================================================================
--- a/libio/genops.c --- glibc-2.27.orig/include/bits/libio.h
+++ b/libio/genops.c +++ glibc-2.27/include/bits/libio.h
@@ -38,10 +38,6 @@ @@ -33,11 +33,15 @@ libc_hidden_proto (_IO_vfscanf)
static _IO_lock_t list_all_lock = _IO_lock_initializer; if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock)
# define _IO_funlockfile(_fp) \
if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_unlock (*(_fp)->_lock)
+# define _IO_ftrylockfile(_fp) \
+ (((_fp)->_flags & _IO_USER_LOCK) == 0 ? _IO_lock_trylock (*(_fp)->_lock) : 0)
# else
# define _IO_flockfile(_fp) \
if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp)
# define _IO_funlockfile(_fp) \
if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp)
+# define _IO_ftrylockfile(_fp) \
+ (((_fp)->_flags & _IO_USER_LOCK) == 0 ? _IO_ftrylockfile (_fp) : 0)
# endif
#endif /* _IO_MTSAFE_IO */
Index: glibc-2.27/libio/genops.c
===================================================================
--- glibc-2.27.orig/libio/genops.c
+++ glibc-2.27/libio/genops.c
@@ -744,8 +744,8 @@ _IO_get_column (_IO_FILE *fp)
#endif #endif
-/* Used to signal modifications to the list of FILE decriptors. */
-static int _IO_list_all_stamp;
-
-
static _IO_FILE *run_fp;
#ifdef _IO_MTSAFE_IO -int
@@ -70,16 +66,12 @@ _IO_un_link (fp)
if (_IO_list_all == NULL)
;
else if (fp == _IO_list_all)
- {
- _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
- ++_IO_list_all_stamp;
- }
+ _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
else
for (f = &_IO_list_all->file._chain; *f; f = &(*f)->_chain)
if (*f == (_IO_FILE *) fp)
{
*f = fp->file._chain;
- ++_IO_list_all_stamp;
break;
}
fp->file._flags &= ~_IO_LINKED;
@@ -108,7 +100,6 @@ _IO_link_in (fp)
#endif
fp->file._chain = (_IO_FILE *) _IO_list_all;
_IO_list_all = fp;
- ++_IO_list_all_stamp;
#ifdef _IO_MTSAFE_IO
_IO_funlockfile ((_IO_FILE *) fp);
run_fp = NULL;
@@ -818,25 +809,20 @@ _IO_get_column (fp)
int
-_IO_flush_all_lockp (int do_lock) -_IO_flush_all_lockp (int do_lock)
+_IO_flush_all (void) +static int
+_IO_flush_all_lockp (bool skip_locked)
{ {
int result = 0; int result = 0;
struct _IO_FILE *fp; struct _IO_FILE *fp;
- int last_stamp; @@ -758,7 +758,16 @@ _IO_flush_all_lockp (int do_lock)
for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
#ifdef _IO_MTSAFE_IO
- __libc_cleanup_region_start (do_lock, flush_cleanup, NULL);
- if (do_lock)
- _IO_lock_lock (list_all_lock);
+ _IO_cleanup_region_start_noarg (flush_cleanup);
+ _IO_lock_lock (list_all_lock);
#endif
- last_stamp = _IO_list_all_stamp;
- fp = (_IO_FILE *) _IO_list_all;
- while (fp != NULL)
+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
{ {
run_fp = fp; run_fp = fp;
- if (do_lock) - if (do_lock)
- _IO_flockfile (fp); + if (skip_locked)
+ _IO_flockfile (fp); + {
+ /* Skip files that are currently locked. */
+ if (_IO_ftrylockfile (fp))
+ {
+ run_fp = NULL;
+ continue;
+ }
+ }
+ else
_IO_flockfile (fp);
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base) if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T @@ -769,8 +778,7 @@ _IO_flush_all_lockp (int do_lock)
@@ -848,52 +834,30 @@ _IO_flush_all_lockp (int do_lock)
&& _IO_OVERFLOW (fp, EOF) == EOF) && _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF; result = EOF;
@ -89,88 +72,34 @@ index e0ce8cc..9def1d4 100644
- _IO_funlockfile (fp); - _IO_funlockfile (fp);
+ _IO_funlockfile (fp); + _IO_funlockfile (fp);
run_fp = NULL; run_fp = NULL;
-
- if (last_stamp != _IO_list_all_stamp)
- {
- /* Something was added to the list. Start all over again. */
- fp = (_IO_FILE *) _IO_list_all;
- last_stamp = _IO_list_all_stamp;
- }
- else
- fp = fp->_chain;
} }
#ifdef _IO_MTSAFE_IO @@ -787,7 +795,7 @@ int
- if (do_lock) _IO_flush_all (void)
- _IO_lock_unlock (list_all_lock); {
- __libc_cleanup_region_end (0); /* We want locking. */
+ _IO_lock_unlock (list_all_lock);
+ _IO_cleanup_region_end (0);
#endif
return result;
}
-
-
-int
-_IO_flush_all (void)
-{
- /* We want locking. */
- return _IO_flush_all_lockp (1); - return _IO_flush_all_lockp (1);
-} + return _IO_flush_all_lockp (false);
}
libc_hidden_def (_IO_flush_all) libc_hidden_def (_IO_flush_all)
void @@ -852,22 +860,18 @@ _IO_unbuffer_all (void)
_IO_flush_all_linebuffered (void)
{
struct _IO_FILE *fp;
- int last_stamp;
#ifdef _IO_MTSAFE_IO
_IO_cleanup_region_start_noarg (flush_cleanup);
_IO_lock_lock (list_all_lock);
#endif
- last_stamp = _IO_list_all_stamp;
- fp = (_IO_FILE *) _IO_list_all;
- while (fp != NULL)
+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
{
run_fp = fp;
_IO_flockfile (fp);
@@ -903,15 +867,6 @@ _IO_flush_all_linebuffered (void)
_IO_funlockfile (fp);
run_fp = NULL;
-
- if (last_stamp != _IO_list_all_stamp)
- {
- /* Something was added to the list. Start all over again. */
- fp = (_IO_FILE *) _IO_list_all;
- last_stamp = _IO_list_all_stamp;
- }
- else
- fp = fp->_chain;
}
#ifdef _IO_MTSAFE_IO
@@ -947,6 +902,12 @@ static void
_IO_unbuffer_all (void)
{
struct _IO_FILE *fp;
+
+#ifdef _IO_MTSAFE_IO
+ _IO_cleanup_region_start_noarg (flush_cleanup);
+ _IO_lock_lock (list_all_lock);
+#endif
+
for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain) for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
{ {
+ run_fp = fp;
+ /* Skip files that are currently locked. */
+ if (_IO_ftrylockfile (fp))
+ {
+ run_fp = NULL;
+ continue;
+ }
+
if (! (fp->_flags & _IO_UNBUFFERED) if (! (fp->_flags & _IO_UNBUFFERED)
@@ -956,15 +917,8 @@ _IO_unbuffer_write (void) /* Iff stream is un-orientated, it wasn't used. */
&& fp->_mode != 0) && fp->_mode != 0)
{ {
#ifdef _IO_MTSAFE_IO -#ifdef _IO_MTSAFE_IO
- int cnt; - int cnt;
-#define MAXTRIES 2 -#define MAXTRIES 2
- for (cnt = 0; cnt < MAXTRIES; ++cnt) - for (cnt = 0; cnt < MAXTRIES; ++cnt)
@ -180,50 +109,49 @@ index e0ce8cc..9def1d4 100644
- /* Give the other thread time to finish up its use of the - /* Give the other thread time to finish up its use of the
- stream. */ - stream. */
- __sched_yield (); - __sched_yield ();
+ run_fp = fp; -#endif
+ _IO_flockfile (fp); -
#endif
if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF)) if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
@@ -980,8 +934,8 @@ _IO_unbuffer_write (void) {
_IO_wsetb (fp, NULL, NULL, 0); fp->_flags |= _IO_USER_BUF;
@@ -881,16 +885,14 @@ _IO_unbuffer_all (void)
#ifdef _IO_MTSAFE_IO if (fp->_mode > 0)
_IO_wsetb (fp, NULL, NULL, 0);
-
-#ifdef _IO_MTSAFE_IO
- if (cnt < MAXTRIES && fp->_lock != NULL) - if (cnt < MAXTRIES && fp->_lock != NULL)
- _IO_lock_unlock (*fp->_lock); - _IO_lock_unlock (*fp->_lock);
+ _IO_funlockfile (fp); -#endif
+ run_fp = NULL;
#endif
} }
@@ -989,6 +943,11 @@ _IO_unbuffer_write (void) /* Make sure that never again the wide char functions can be
used. */ used. */
fp->_mode = -1; fp->_mode = -1;
}
+ +
+#ifdef _IO_MTSAFE_IO + _IO_funlockfile (fp);
+ _IO_lock_unlock (list_all_lock); + run_fp = NULL;
+ _IO_cleanup_region_end (0); }
+#endif
}
#ifdef _IO_MTSAFE_IO
@@ -1008,9 +967,7 @@ libc_freeres_fn (buffer_free) @@ -916,9 +918,9 @@ libc_freeres_fn (buffer_free)
int int
_IO_cleanup (void) _IO_cleanup (void)
{ {
- /* We do *not* want locking. Some threads might use streams but - /* We do *not* want locking. Some threads might use streams but
- that is their problem, we flush them underneath them. */ - that is their problem, we flush them underneath them. */
- int result = _IO_flush_all_lockp (0); - int result = _IO_flush_all_lockp (0);
+ int result = _IO_flush_all (); + /* We want to skip locked streams. Some threads might use streams but
+ that is their problem, we don't flush those. */
+ int result = _IO_flush_all_lockp (true);
/* We currently don't have a reliable mechanism for making sure that /* We currently don't have a reliable mechanism for making sure that
C++ static destructors are executed in the correct order. C++ static destructors are executed in the correct order.
diff --git a/libio/libioP.h b/libio/libioP.h Index: glibc-2.27/libio/libioP.h
index 8a7b85b..3e3a724 100644 ===================================================================
--- a/libio/libioP.h --- glibc-2.27.orig/libio/libioP.h
+++ b/libio/libioP.h +++ glibc-2.27/libio/libioP.h
@@ -488,7 +488,6 @@ extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t); @@ -486,7 +486,6 @@ extern int _IO_new_do_write (_IO_FILE *,
extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t); extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t);
extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t); extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t);
libc_hidden_proto (_IO_wdo_write) libc_hidden_proto (_IO_wdo_write)
@ -231,6 +159,3 @@ index 8a7b85b..3e3a724 100644
extern int _IO_flush_all (void); extern int _IO_flush_all (void);
libc_hidden_proto (_IO_flush_all) libc_hidden_proto (_IO_flush_all)
extern int _IO_cleanup (void); extern int _IO_cleanup (void);
--
1.9.1

View File

@ -10,22 +10,22 @@ Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
* posix/tst-fnmatch4.c: New file. * posix/tst-fnmatch4.c: New file.
* posix/tst-fnmatch5.c: New file. * posix/tst-fnmatch5.c: New file.
Index: glibc-2.26/posix/Makefile Index: glibc-2.27/posix/Makefile
=================================================================== ===================================================================
--- glibc-2.26.orig/posix/Makefile --- glibc-2.27.orig/posix/Makefile
+++ glibc-2.26/posix/Makefile +++ glibc-2.27/posix/Makefile
@@ -91,6 +91,7 @@ tests := test-errno tstgetopt testfnm r @@ -92,6 +92,7 @@ tests := test-errno tstgetopt testfnm r
bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
tst-pathconf tst-getaddrinfo4 tst-rxspencer-no-utf8 \ tst-pathconf tst-rxspencer-no-utf8 \
tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \ tst-fnmatch3 bug-regex36 \
+ tst-fnmatch4 tst-fnmatch5 \ + tst-fnmatch4 tst-fnmatch5 \
tst-posix_spawn-fd tst-posix_spawn-setsid \ tst-posix_spawn-fd tst-posix_spawn-setsid \
tst-posix_fadvise tst-posix_fadvise64 \ tst-posix_fadvise tst-posix_fadvise64 \
tst-sysconf-empty-chroot tst-glob-tilde tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
Index: glibc-2.26/posix/fnmatch.c Index: glibc-2.27/posix/fnmatch.c
=================================================================== ===================================================================
--- glibc-2.26.orig/posix/fnmatch.c --- glibc-2.27.orig/posix/fnmatch.c
+++ glibc-2.26/posix/fnmatch.c +++ glibc-2.27/posix/fnmatch.c
@@ -53,7 +53,6 @@ @@ -53,7 +53,6 @@
we support a correct implementation only in glibc. */ we support a correct implementation only in glibc. */
#ifdef _LIBC #ifdef _LIBC
@ -34,11 +34,11 @@ Index: glibc-2.26/posix/fnmatch.c
# include "../locale/coll-lookup.h" # include "../locale/coll-lookup.h"
# include <shlib-compat.h> # include <shlib-compat.h>
Index: glibc-2.26/posix/fnmatch_loop.c Index: glibc-2.27/posix/fnmatch_loop.c
=================================================================== ===================================================================
--- glibc-2.26.orig/posix/fnmatch_loop.c --- glibc-2.27.orig/posix/fnmatch_loop.c
+++ glibc-2.26/posix/fnmatch_loop.c +++ glibc-2.27/posix/fnmatch_loop.c
@@ -497,26 +497,12 @@ FCT (const CHAR *pattern, const CHAR *st @@ -494,26 +494,12 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
int32_t table_size; int32_t table_size;
const int32_t *symb_table; const int32_t *symb_table;
@ -67,7 +67,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
table_size = table_size =
_NL_CURRENT_WORD (LC_COLLATE, _NL_CURRENT_WORD (LC_COLLATE,
@@ -528,71 +514,55 @@ FCT (const CHAR *pattern, const CHAR *st @@ -525,71 +511,55 @@ FCT (const CHAR *pattern, const CHAR *st
_NL_CURRENT (LC_COLLATE, _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB); _NL_COLLATE_SYMB_EXTRAMB);
@ -180,7 +180,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
} }
/* Get the collation sequence value. */ /* Get the collation sequence value. */
@@ -600,9 +570,9 @@ FCT (const CHAR *pattern, const CHAR *st @@ -597,9 +567,9 @@ FCT (const CHAR *pattern, const CHAR *st
# if WIDE_CHAR_VERSION # if WIDE_CHAR_VERSION
cold = wextra[1 + wextra[idx]]; cold = wextra[1 + wextra[idx]];
# else # else
@ -192,7 +192,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
cold = *((int32_t *) &extra[idx]); cold = *((int32_t *) &extra[idx]);
# endif # endif
@@ -612,10 +582,10 @@ FCT (const CHAR *pattern, const CHAR *st @@ -609,10 +579,10 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
/* No valid character. Match it as a /* No valid character. Match it as a
single byte. */ single byte. */
@ -205,7 +205,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
c = *p++; c = *p++;
} }
else else
@@ -623,7 +593,6 @@ FCT (const CHAR *pattern, const CHAR *st @@ -620,7 +590,6 @@ FCT (const CHAR *pattern, const CHAR *st
} }
} }
else else
@ -213,7 +213,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
#endif #endif
{ {
c = FOLD (c); c = FOLD (c);
@@ -715,25 +684,11 @@ FCT (const CHAR *pattern, const CHAR *st @@ -712,25 +681,11 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
int32_t table_size; int32_t table_size;
const int32_t *symb_table; const int32_t *symb_table;
@ -240,7 +240,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
# endif # endif
table_size = table_size =
@@ -746,51 +701,44 @@ FCT (const CHAR *pattern, const CHAR *st @@ -743,51 +698,44 @@ FCT (const CHAR *pattern, const CHAR *st
_NL_CURRENT (LC_COLLATE, _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB); _NL_COLLATE_SYMB_EXTRAMB);
@ -328,7 +328,7 @@ Index: glibc-2.26/posix/fnmatch_loop.c
/* Get the collation sequence value. */ /* Get the collation sequence value. */
is_seqval = 1; is_seqval = 1;
# if WIDE_CHAR_VERSION # if WIDE_CHAR_VERSION
@@ -798,19 +746,18 @@ FCT (const CHAR *pattern, const CHAR *st @@ -795,19 +743,18 @@ FCT (const CHAR *pattern, const CHAR *st
# else # else
/* Adjust for the alignment. */ /* Adjust for the alignment. */
idx += 1 + extra[idx]; idx += 1 + extra[idx];
@ -351,10 +351,10 @@ Index: glibc-2.26/posix/fnmatch_loop.c
} }
else else
{ {
Index: glibc-2.26/posix/tst-fnmatch4.c Index: glibc-2.27/posix/tst-fnmatch4.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.26/posix/tst-fnmatch4.c +++ glibc-2.27/posix/tst-fnmatch4.c
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
+/* Test for fnmatch handling of collating elements +/* Test for fnmatch handling of collating elements
+ Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2015 Free Software Foundation, Inc.
@ -407,10 +407,10 @@ Index: glibc-2.26/posix/tst-fnmatch4.c
+ +
+#define TEST_FUNCTION do_test () +#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c" +#include "../test-skeleton.c"
Index: glibc-2.26/posix/tst-fnmatch5.c Index: glibc-2.27/posix/tst-fnmatch5.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.26/posix/tst-fnmatch5.c +++ glibc-2.27/posix/tst-fnmatch5.c
@@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
+/* Test for fnmatch handling of collating elements +/* Test for fnmatch handling of collating elements
+ Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2015 Free Software Foundation, Inc.

View File

@ -1,649 +0,0 @@
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,34 +0,0 @@
2018-01-12 Dmitry V. Levin <ldv@altlinux.org>
[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
Index: glibc-2.26/sysdeps/unix/sysv/linux/getcwd.c
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/getcwd.c
+++ glibc-2.26/sysdeps/unix/sysv/linux/getcwd.c
@@ -76,7 +76,7 @@ __getcwd (char *buf, size_t size)
int retval;
retval = INLINE_SYSCALL (getcwd, 2, path, alloc_size);
- if (retval >= 0)
+ if (retval > 0 && path[0] == '/')
{
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
@@ -92,10 +92,10 @@ __getcwd (char *buf, size_t size)
return buf;
}
- /* The system call cannot handle paths longer than a page.
- Neither can the magic symlink in /proc/self. Just use the
+ /* The system call either cannot handle paths longer than a page
+ or can succeed without returning an absolute path. Just use the
generic implementation right away. */
- if (errno == ENAMETOOLONG)
+ if (retval >= 0 || errno == ENAMETOOLONG)
{
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)

View File

@ -1,7 +1,7 @@
Index: glibc-2.25/crypt/Makefile Index: glibc-2.27/crypt/Makefile
=================================================================== ===================================================================
--- glibc-2.25.orig/crypt/Makefile --- glibc-2.27.orig/crypt/Makefile
+++ glibc-2.25/crypt/Makefile +++ glibc-2.27/crypt/Makefile
@@ -23,14 +23,18 @@ subdir := crypt @@ -23,14 +23,18 @@ subdir := crypt
include ../Makeconfig include ../Makeconfig
@ -23,10 +23,10 @@ Index: glibc-2.25/crypt/Makefile
ifeq ($(crypt-in-libc),yes) ifeq ($(crypt-in-libc),yes)
routines += $(libcrypt-routines) routines += $(libcrypt-routines)
Index: glibc-2.25/crypt/Versions Index: glibc-2.27/crypt/Versions
=================================================================== ===================================================================
--- glibc-2.25.orig/crypt/Versions --- glibc-2.27.orig/crypt/Versions
+++ glibc-2.25/crypt/Versions +++ glibc-2.27/crypt/Versions
@@ -3,3 +3,8 @@ libcrypt { @@ -3,3 +3,8 @@ libcrypt {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r; crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
} }
@ -36,10 +36,10 @@ Index: glibc-2.25/crypt/Versions
+ crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra; + crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;
+ } + }
+} +}
Index: glibc-2.25/crypt/crypt-entry.c Index: glibc-2.27/crypt/crypt-entry.c
=================================================================== ===================================================================
--- glibc-2.25.orig/crypt/crypt-entry.c --- glibc-2.27.orig/crypt/crypt-entry.c
+++ glibc-2.25/crypt/crypt-entry.c +++ glibc-2.27/crypt/crypt-entry.c
@@ -71,7 +71,7 @@ extern struct crypt_data _ufc_foobar; @@ -71,7 +71,7 @@ extern struct crypt_data _ufc_foobar;
*/ */
@ -62,10 +62,10 @@ Index: glibc-2.25/crypt/crypt-entry.c
} }
#endif #endif
+#endif +#endif
Index: glibc-2.25/crypt/crypt-private.h Index: glibc-2.27/crypt/crypt-private.h
=================================================================== ===================================================================
--- glibc-2.25.orig/crypt/crypt-private.h --- glibc-2.27.orig/crypt/crypt-private.h
+++ glibc-2.25/crypt/crypt-private.h +++ glibc-2.27/crypt/crypt-private.h
@@ -65,7 +65,7 @@ extern void __encrypt_r (char * __restri @@ -65,7 +65,7 @@ extern void __encrypt_r (char * __restri
struct crypt_data * __restrict __data); struct crypt_data * __restrict __data);
@ -75,11 +75,11 @@ Index: glibc-2.25/crypt/crypt-private.h
struct crypt_data * __restrict __data); struct crypt_data * __restrict __data);
extern char *fcrypt (const char *key, const char *salt); extern char *fcrypt (const char *key, const char *salt);
Index: glibc-2.25/shlib-versions Index: glibc-2.27/shlib-versions
=================================================================== ===================================================================
--- glibc-2.25.orig/shlib-versions --- glibc-2.27.orig/shlib-versions
+++ glibc-2.25/shlib-versions +++ glibc-2.27/shlib-versions
@@ -58,6 +58,7 @@ libnsl=1 @@ -59,6 +59,7 @@ libnsl=1
# This defines the shared library version numbers we will install. # This defines the shared library version numbers we will install.
libcrypt=1 libcrypt=1
@ -87,10 +87,10 @@ Index: glibc-2.25/shlib-versions
# The gross patch for programs assuming broken locale implementations. # The gross patch for programs assuming broken locale implementations.
libBrokenLocale=1 libBrokenLocale=1
Index: glibc-2.25/sysdeps/unix/sysv/linux/libowcrypt.abilist Index: glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.25/sysdeps/unix/sysv/linux/libowcrypt.abilist +++ glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist
@@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
+OW_CRYPT_1.0 OW_CRYPT_1.0 A +OW_CRYPT_1.0 OW_CRYPT_1.0 A
+OW_CRYPT_1.0 crypt_gensalt F +OW_CRYPT_1.0 crypt_gensalt F

View File

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

View File

@ -1,10 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJZgduLAAoJEHnEPfvxzyGHDesH/itf17ZUWSWNIRp2cC0RK1et
jtR7ufFMpSHfMFJQXkli162s+iFMAxuOus52rma/h3PP8BXVbEKB7M3N0dvqPbmC
AIC6YtAYU/I4M3V+6T1pi4ras19i2VgNY+iag0xw5o0ah4yZmZwB5eFR2xIz10ZD
SGffJyCD/8EFwn/SPx38JS55ENwGj5PT1m2TsEnlLeHg7sCH7ksb5Pqq/ZEwIw0v
E56a4hSliDUhurc0gUQmFxm/FhFSdTzns0vShfgou4D2tNSYaUjrf/17ebj0ehUF
XkNH5jvwHoxiKzEVnD7dS9NLbvOPAG4AlFnWejgqvX0JB/M5TknOcmJYpzZYiGE=
=XObH
-----END PGP SIGNATURE-----

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

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

16
glibc-2.27.tar.xz.sig Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJac3pRAAoJEBZ5K06iU0D42ScP/1a2BmqiRw3vt2vtjRpZAeE+
UcJ44FFbgRfybe2e0hSI9/Yl3aMRp3ntdUyrZrUKdDiiaBvWt6Ye7UWDHe0iraxM
1PvQsVu1HmfXGgsAyMlk9XtfqvDqBXcFWE99HbTbuybT+W+JXP+751ioN73MTgp5
ZECrYy3o5FUPHHb2MBA1zqY4sryWR+27vY+CP2BMSvLNIUpYKVe2xOMvayi2Asxr
rTB6dlpcxwZaoErkqeOl4vgNO744WFMRj0RaMVN6/HkGfvuf1gzqcLjlsJ5AFpA/
GliE9rJn7ogpV0cXgagcjt/+CuL/htvFOw9qTzkDrT41t0n3DBQ0HXwh60oCTN8I
3gbuudLN51+cDWk17TcNh6PDyuYFEiZbIAmU2aRha+lsGGnQaoI8fS/thHfzzGBd
P5jSvpHPfL3lp8PBwjgiuXElEi/hJlGYfjDfJZ5ta4p08362LcfHe1xNCSP49x5a
V/ZV+Ggpsf6MiRmwQBNykA55s3akYgIOtBwDs0polookDcKJ/BzczNnWYNqX0Szv
k4pvIEWsMLMsX9j3qnKbmmtlrcFTIwaQzQ75e3D1OFL3JCup7byoDf1icfRKWr8D
3Y0FWExqQ3NYpR7F7hPsbU55DGqpMlLnVMTZ0wlEn9s1TyO1vWiba1BuVMtCICDJ
fyTjM1MZXfBiFDcP1D4P
=SzqE
-----END PGP SIGNATURE-----

View File

@ -2,11 +2,11 @@ Wed Jun 4 14:29:07 CEST 2003 - kukuk@suse.de
- Make --no-archive default for localedef - Make --no-archive default for localedef
Index: glibc-2.18.90/locale/programs/localedef.c Index: glibc-2.27/locale/programs/localedef.c
=================================================================== ===================================================================
--- glibc-2.18.90.orig/locale/programs/localedef.c --- glibc-2.27.orig/locale/programs/localedef.c
+++ glibc-2.18.90/locale/programs/localedef.c +++ glibc-2.27/locale/programs/localedef.c
@@ -81,7 +81,7 @@ const char *alias_file; @@ -71,7 +71,7 @@ const char *alias_file;
static struct localedef_t *locales; static struct localedef_t *locales;
/* If true don't add locale data to archive. */ /* If true don't add locale data to archive. */
@ -15,24 +15,24 @@ Index: glibc-2.18.90/locale/programs/localedef.c
/* If true add named locales to archive. */ /* If true add named locales to archive. */
static bool add_to_archive; static bool add_to_archive;
@@ -112,6 +112,7 @@ void (*argp_program_version_hook) (FILE @@ -101,6 +101,7 @@ void (*argp_program_version_hook) (FILE
#define OPT_REPLACE 307 #define OPT_REPLACE 307
#define OPT_DELETE_FROM_ARCHIVE 308 #define OPT_DELETE_FROM_ARCHIVE 308
#define OPT_LIST_ARCHIVE 309 #define OPT_LIST_ARCHIVE 309
+#define OPT_ARCHIVE 310 +#define OPT_ARCHIVE 310
#define OPT_LITTLE_ENDIAN 400 #define OPT_LITTLE_ENDIAN 400
#define OPT_BIG_ENDIAN 401 #define OPT_BIG_ENDIAN 401
#define OPT_NO_WARN 402
@@ -133,6 +134,8 @@ static const struct argp_option options[
"supported warnings are: ascii, intcurrsym") },
@@ -136,6 +137,8 @@ static const struct argp_option options[
N_("Suppress warnings and information messages") },
{ "verbose", 'v', NULL, 0, N_("Print more messages") },
{ NULL, 0, NULL, 0, N_("Archive control:") }, { NULL, 0, NULL, 0, N_("Archive control:") },
+ { "archive", OPT_ARCHIVE, NULL, 0, + { "archive", OPT_ARCHIVE, NULL, 0,
+ N_("Add new data to archive") }, + N_("Add new data to archive") },
{ "no-archive", OPT_NO_ARCHIVE, NULL, 0, { "no-archive", OPT_NO_ARCHIVE, NULL, 0,
N_("Don't add new data to archive") }, N_("Don't add new data to archive") },
{ "add-to-archive", OPT_ADD_TO_ARCHIVE, NULL, 0, { "add-to-archive", OPT_ADD_TO_ARCHIVE, NULL, 0,
@@ -317,6 +320,9 @@ parse_opt (int key, char *arg, struct ar @@ -360,6 +363,9 @@ parse_opt (int key, char *arg, struct ar
case OPT_PREFIX: case OPT_PREFIX:
output_prefix = arg; output_prefix = arg;
break; break;

View File

@ -1,8 +1,8 @@
Index: glibc-2.17.90/nscd/nscd.h Index: glibc-2.27/nscd/nscd.h
=================================================================== ===================================================================
--- glibc-2.17.90.orig/nscd/nscd.h --- glibc-2.27.orig/nscd/nscd.h
+++ glibc-2.17.90/nscd/nscd.h +++ glibc-2.27/nscd/nscd.h
@@ -112,11 +112,11 @@ struct database_dyn @@ -161,11 +161,11 @@ struct database_dyn
/* Paths of the file for the persistent storage. */ /* Paths of the file for the persistent storage. */

View File

@ -1,8 +1,8 @@
Index: glibc-2.24/intl/loadmsgcat.c Index: glibc-2.27/intl/loadmsgcat.c
=================================================================== ===================================================================
--- glibc-2.24.orig/intl/loadmsgcat.c --- glibc-2.27.orig/intl/loadmsgcat.c
+++ glibc-2.24/intl/loadmsgcat.c +++ glibc-2.27/intl/loadmsgcat.c
@@ -829,8 +829,47 @@ _nl_load_domain (struct loaded_l10nfile @@ -796,8 +796,47 @@ _nl_load_domain (struct loaded_l10nfile
if (domain_file->filename == NULL) if (domain_file->filename == NULL)
goto out; goto out;

View File

@ -1,17 +1,17 @@
Index: glibc-2.17.90/localedata/locales/zh_TW Index: glibc-2.27/localedata/locales/zh_TW
=================================================================== ===================================================================
--- glibc-2.17.90.orig/localedata/locales/zh_TW --- glibc-2.27.orig/localedata/locales/zh_TW
+++ glibc-2.17.90/localedata/locales/zh_TW +++ glibc-2.27/localedata/locales/zh_TW
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@ escape_char /
% exempt you from the conditions of the license if your use would % exempt you from the conditions of the license if your use would
% otherwise be governed by that license. % otherwise be governed by that license.
-% Chinese language locale for Taiwan R.O.C. -% Chinese language locale for Taiwan R.O.C.
+% Chinese language locale for Taiwan +% Chinese language locale for Taiwan
% charmap: BIG5-CP950
% %
% Original Author: % Original Author:
@@ -24,7 +24,7 @@ escape_char / % Ming-Che Chuang
@@ -23,7 +23,7 @@ escape_char /
% Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf % Reference: http://wwwold.dkuug.dk/JTC1/SC22/WG20/docs/n690.pdf
LC_IDENTIFICATION LC_IDENTIFICATION

View File

@ -1,8 +1,8 @@
Index: glibc-2.18.90/intl/locale.alias Index: glibc-2.27/intl/locale.alias
=================================================================== ===================================================================
--- glibc-2.18.90.orig/intl/locale.alias --- glibc-2.27.orig/intl/locale.alias
+++ glibc-2.18.90/intl/locale.alias +++ glibc-2.27/intl/locale.alias
@@ -56,8 +56,6 @@ korean ko_KR.eucKR @@ -65,8 +65,6 @@ korean ko_KR.eucKR
korean.euc ko_KR.eucKR korean.euc ko_KR.eucKR
ko_KR ko_KR.eucKR ko_KR ko_KR.eucKR
lithuanian lt_LT.ISO-8859-13 lithuanian lt_LT.ISO-8859-13
@ -11,11 +11,11 @@ Index: glibc-2.18.90/intl/locale.alias
norwegian nb_NO.ISO-8859-1 norwegian nb_NO.ISO-8859-1
nynorsk nn_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1
polish pl_PL.ISO-8859-2 polish pl_PL.ISO-8859-2
Index: glibc-2.18.90/localedata/SUPPORTED Index: glibc-2.27/localedata/SUPPORTED
=================================================================== ===================================================================
--- glibc-2.18.90.orig/localedata/SUPPORTED --- glibc-2.27.orig/localedata/SUPPORTED
+++ glibc-2.18.90/localedata/SUPPORTED +++ glibc-2.27/localedata/SUPPORTED
@@ -331,6 +331,8 @@ nl_NL/ISO-8859-1 \ @@ -355,6 +355,8 @@ nl_NL/ISO-8859-1 \
nl_NL@euro/ISO-8859-15 \ nl_NL@euro/ISO-8859-15 \
nn_NO.UTF-8/UTF-8 \ nn_NO.UTF-8/UTF-8 \
nn_NO/ISO-8859-1 \ nn_NO/ISO-8859-1 \
@ -24,10 +24,10 @@ Index: glibc-2.18.90/localedata/SUPPORTED
nr_ZA/UTF-8 \ nr_ZA/UTF-8 \
nso_ZA/UTF-8 \ nso_ZA/UTF-8 \
oc_FR.UTF-8/UTF-8 \ oc_FR.UTF-8/UTF-8 \
Index: glibc-2.18.90/localedata/locales/no_NO Index: glibc-2.27/localedata/locales/no_NO
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.18.90/localedata/locales/no_NO +++ glibc-2.27/localedata/locales/no_NO
@@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
+escape_char / +escape_char /
+comment_char % +comment_char %

View File

@ -1,7 +1,7 @@
Index: glibc-2.17.90/sunrpc/bindrsvprt.c Index: glibc-2.27/sunrpc/bindrsvprt.c
=================================================================== ===================================================================
--- glibc-2.17.90.orig/sunrpc/bindrsvprt.c --- glibc-2.27.orig/sunrpc/bindrsvprt.c
+++ glibc-2.17.90/sunrpc/bindrsvprt.c +++ glibc-2.27/sunrpc/bindrsvprt.c
@@ -29,6 +29,9 @@ @@ -29,6 +29,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */

View File

@ -9,10 +9,10 @@ Subject: [PATCH] Add a C.UTF-8 locale
2 files changed, 239 insertions(+) 2 files changed, 239 insertions(+)
create mode 100644 localedata/locales/C create mode 100644 localedata/locales/C
diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED Index: glibc-2.27/localedata/SUPPORTED
index 8ca023e..2a78391 100644 ===================================================================
--- a/localedata/SUPPORTED --- glibc-2.27.orig/localedata/SUPPORTED
+++ b/localedata/SUPPORTED +++ glibc-2.27/localedata/SUPPORTED
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
# This file names the currently supported and somewhat tested locales. # This file names the currently supported and somewhat tested locales.
# If you have any additions please file a glibc bug report. # If you have any additions please file a glibc bug report.
@ -21,11 +21,10 @@ index 8ca023e..2a78391 100644
aa_DJ.UTF-8/UTF-8 \ aa_DJ.UTF-8/UTF-8 \
aa_DJ/ISO-8859-1 \ aa_DJ/ISO-8859-1 \
aa_ER/UTF-8 \ aa_ER/UTF-8 \
diff --git a/localedata/locales/C b/localedata/locales/C Index: glibc-2.27/localedata/locales/C
new file mode 100644 ===================================================================
index 0000000..fdf460e
--- /dev/null --- /dev/null
+++ b/localedata/locales/C +++ glibc-2.27/localedata/locales/C
@@ -0,0 +1,238 @@ @@ -0,0 +1,238 @@
+escape_char / +escape_char /
+comment_char % +comment_char %

View File

@ -1,8 +1,8 @@
Index: glibc-2.23/intl/dcigettext.c Index: glibc-2.27/intl/dcigettext.c
=================================================================== ===================================================================
--- glibc-2.23.orig/intl/dcigettext.c --- glibc-2.27.orig/intl/dcigettext.c
+++ glibc-2.23/intl/dcigettext.c +++ glibc-2.27/intl/dcigettext.c
@@ -714,6 +714,7 @@ DCIGETTEXT (const char *domainname, cons @@ -695,6 +695,7 @@ DCIGETTEXT (const char *domainname, cons
/* If the current locale value is C (or POSIX) we don't load a /* If the current locale value is C (or POSIX) we don't load a
domain. Return the MSGID. */ domain. Return the MSGID. */
if (strcmp (single_locale, "C") == 0 if (strcmp (single_locale, "C") == 0

View File

@ -7,11 +7,11 @@ Remapping ::1 to 127.0.0.1 is bogus when /etc/hosts is correct.
bnc #684534, #606980 bnc #684534, #606980
http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980 http://sources.redhat.com/bugzilla/show_bug.cgi?id=4980
Index: glibc-2.17.90/nss/nss_files/files-hosts.c Index: glibc-2.27/nss/nss_files/files-hosts.c
=================================================================== ===================================================================
--- glibc-2.17.90.orig/nss/nss_files/files-hosts.c --- glibc-2.27.orig/nss/nss_files/files-hosts.c
+++ glibc-2.17.90/nss/nss_files/files-hosts.c +++ glibc-2.27/nss/nss_files/files-hosts.c
@@ -68,11 +68,6 @@ LINE_PARSER @@ -70,11 +70,6 @@ LINE_PARSER
{ {
if (IN6_IS_ADDR_V4MAPPED (entdata->host_addr)) if (IN6_IS_ADDR_V4MAPPED (entdata->host_addr))
memcpy (entdata->host_addr, entdata->host_addr + 12, INADDRSZ); memcpy (entdata->host_addr, entdata->host_addr + 12, INADDRSZ);

View File

@ -1,47 +0,0 @@
Index: glibc-2.21/nscd/nscd_stat.c
===================================================================
--- glibc-2.21.orig/nscd/nscd_stat.c
+++ glibc-2.21/nscd/nscd_stat.c
@@ -36,8 +36,13 @@
#endif /* HAVE_SELINUX */
-/* We use this to make sure the receiver is the same. */
+/* We use this to make sure the receiver is the same. Capture mtime
+ of this file if possible. */
+#ifdef __TIMESTAMP__
+static const char compilation[21];
+#else
static const char compilation[21] = __DATE__ " " __TIME__;
+#endif
/* Statistic data for one database. */
struct dbstat
@@ -96,7 +101,12 @@ send_stats (int fd, struct database_dyn
memset (&data, 0, sizeof (data));
+#ifdef __TIMESTAMP__
+ /* Skip day of the week. */
+ memcpy (data.version, __TIMESTAMP__ + 4, sizeof (compilation));
+#else
memcpy (data.version, compilation, sizeof (compilation));
+#endif
data.debug_level = debug_level;
data.runtime = time (NULL) - start_time;
data.client_queued = client_queued;
@@ -196,7 +206,13 @@ receive_print_stats (void)
/* Read as much data as we expect. */
if (TEMP_FAILURE_RETRY (read (fd, &data, sizeof (data))) != sizeof (data)
- || (memcmp (data.version, compilation, sizeof (compilation)) != 0
+ || (
+#ifdef __TIMESTAMP__
+ /* Skip day of the week. */
+ memcmp (data.version, __TIMESTAMP__ + 4, sizeof (compilation)) != 0
+#else
+ memcmp (data.version, compilation, sizeof (compilation)) != 0
+#endif
/* Yes, this is an assignment! */
&& (errno = EINVAL)))
{

View File

@ -1,7 +1,7 @@
Index: glibc-2.17.90/nscd/nscd.conf Index: glibc-2.27/nscd/nscd.conf
=================================================================== ===================================================================
--- glibc-2.17.90.orig/nscd/nscd.conf --- glibc-2.27.orig/nscd/nscd.conf
+++ glibc-2.17.90/nscd/nscd.conf +++ glibc-2.27/nscd/nscd.conf
@@ -61,11 +61,11 @@ @@ -61,11 +61,11 @@
auto-propagate group yes auto-propagate group yes

View File

@ -1,8 +1,8 @@
Index: glibc-2.20/resolv/res_hconf.c Index: glibc-2.27/resolv/res_hconf.c
=================================================================== ===================================================================
--- glibc-2.20.orig/resolv/res_hconf.c --- glibc-2.27.orig/resolv/res_hconf.c
+++ glibc-2.20/resolv/res_hconf.c +++ glibc-2.27/resolv/res_hconf.c
@@ -240,9 +240,12 @@ parse_line (const char *fname, int line_ @@ -215,9 +215,12 @@ parse_line (const char *fname, int line_
if (c == NULL) if (c == NULL)
{ {
char *buf; char *buf;

View File

@ -1,18 +1,18 @@
Index: glibc-2.17.90/csu/version.c Index: glibc-2.27/csu/version.c
=================================================================== ===================================================================
--- glibc-2.17.90.orig/csu/version.c --- glibc-2.27.orig/csu/version.c
+++ glibc-2.17.90/csu/version.c +++ glibc-2.27/csu/version.c
@@ -24,11 +24,12 @@ static const char __libc_release[] = REL @@ -24,11 +24,12 @@ static const char __libc_release[] = REL
static const char __libc_version[] = VERSION; static const char __libc_version[] = VERSION;
static const char banner[] = static const char banner[] =
-"GNU C Library "PKGVERSION RELEASE" release version "VERSION", by Roland McGrath et al.\n\ -"GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\
+"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID"), by Roland McGrath et al.\n\ +"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID").\n\
Copyright (C) 2017 Free Software Foundation, Inc.\n\ Copyright (C) 2018 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\ This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n\ PARTICULAR PURPOSE.\n\
+Configured for "CONFHOST".\n\ +Configured for "CONFHOST".\n\
Compiled by GNU CC version "__VERSION__".\n" Compiled by GNU CC version "__VERSION__".\n"
#include "version-info.h"
#ifdef LIBC_ABIS_STRING #ifdef LIBC_ABIS_STRING
LIBC_ABIS_STRING

View File

@ -1,3 +1,110 @@
-------------------------------------------------------------------
Thu Feb 22 15:10:32 UTC 2018 - fvogt@suse.com
- Use %license (boo#1082318)
-------------------------------------------------------------------
Wed Feb 14 12:00:49 UTC 2018 - schwab@suse.de
- Add systemtap-headers to BuildRequires
- Add --enable-systemtap to configure arguments (fate#324969, bsc#1073636)
-------------------------------------------------------------------
Tue Feb 13 10:27:32 UTC 2018 - schwab@suse.de
- riscv-readelflib.patch: Fix parsing flags in ELF64 files on riscv
-------------------------------------------------------------------
Mon Feb 5 08:49:13 UTC 2018 - schwab@suse.de
- Update to glibc 2.27
* Optimized x86-64 asin, atan2, exp, expf, log, pow, atan, sin, cosf,
sinf, sincosf and tan with FMA
* Optimized x86-64 trunc and truncf for processors with SSE4.1
* Optimized generic expf, exp2f, logf, log2f, powf, sinf, cosf and
sincosf
* In order to support faster and safer process termination the malloc API
family of functions will no longer print a failure address and stack
backtrace after detecting heap corruption
* The abort function terminates the process immediately, without flushing
stdio streams
* On platforms where long double has the IEEE binary128 format (aarch64,
alpha, mips64, riscv, s390 and sparc), the math library now implements
_Float128 interfaces for that type, as defined by ISO/IEC TS 18661-3:2015
These are the same interfaces added in version 2.26 for some platforms where
this format is supported but is not the format of long double
* On platforms with support for _Float64x (aarch64, alpha, i386, ia64,
mips64, powerpc64le, riscv, s390, sparc and x86_64), the math library now
implements interfaces for that type, as defined by ISO/IEC TS
18661-3:2015
* The math library now implements interfaces for the _Float32, _Float64 and
_Float32x types, as defined by ISO/IEC TS 18661-3:2015
* glibc now implements the memfd_create and mlock2 functions on Linux
* Support for memory protection keys was added
* The copy_file_range function was added
* The ldconfig utility now processes `include' directives using the C/POSIX
collation ordering
* Support for two grammatical forms of month names has been added
* Support for the RISC-V ISA running on Linux has been added
* Statically compiled applications attempting to load locales compiled for the
GNU C Library version 2.27 will fail and fall back to the builtin C/POSIX
locale
* Support for statically linked applications which call dlopen is deprecated
and will be removed in a future version of glibc
* Support for old programs which use internal stdio data structures and
functions is deprecated
* On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer
defined by <sys/ptrace.h>
* libm no longer supports SVID error handling (calling a user-provided
matherr function on error) or the _LIB_VERSION variable to control error
handling
* The libm functions pow10, pow10f and pow10l are no longer supported for
new programs
* The mcontext_t type is no longer the same as struct sigcontext
* The add-ons mechanism for building additional packages at the same time as
glibc has been removed
* The res_hnok, res_dnok, res_mailok and res_ownok functions now check that
the specified string can be parsed as a domain name
* In the malloc_info output, the <heap> element may contain another <aspace>
element, "subheaps", which contains the number of sub-heaps
* In the malloc_info output, the <heap> element may contain another <aspace>
element, "subheaps", which contains the number of sub-heaps
* The nonstandard header files <libio.h> and <_G_config.h> are deprecated
and will be removed in a future release
* CVE-2018-6485, CVE-2018-6551: The posix_memalign and memalign
functions, when called with an object size near the value of SIZE_MAX,
would return a pointer to a buffer which is too small, instead of NULL
(bsc#1079036)
- Support for Sun RPC is no longer available, use libtirpc instead
- glibc-nodate.patch, powerpc-elision-enable-envvar.patch,
s390-elision-enable-envvar.patch, resolv-context-leak.patch,
dl-runtime-resolve-opt-avx512f.patch, libpthread-compat-wrappers.patch,
math-c++-compat.patch, remove-nss-nis-compat.patch,
eh-frame-zero-terminator.patch, ld-so-hwcap-x86-64.patch,
assert-pedantic.patch, getaddrinfo-errno.patch, resolv-conf-oom.patch,
dynarray-allocation.patch, nearbyint-inexact.patch, nss-compat.patch,
nscd-libnsl.patch, malloc-tcache-leak.patch,
falkor-memcpy-memmove.patch, aarch64-cpu-features.patch,
nss-files-large-buffers.patch. sysconf-uio-maxiov.patch,
glob-tilde-overflow.patch, dl-runtime-resolve-xsave.patch,
spawni-assert.patch, x86-64-dl-platform.patch, glob64-s390.patch,
tst-tlsopt-powerpc.patch, powerpc-hwcap-bits.patch,
malloc-tcache-check-overflow.patch, dl-init-paths-overflow.patch,
fillin-rpath-empty-tokens.patch, getcwd-absolute.patch,
ldd-system-interp.patchabort-no-flush.patch: Removed
- All patches refreshed
-------------------------------------------------------------------
Tue Jan 30 16:42:14 UTC 2018 - schwab@suse.de
- fix-locking-in-_IO_cleanup.patch: Skip locked files during exit
(bsc#1070491, BZ #15142)
-------------------------------------------------------------------
Tue Jan 30 15:04:47 UTC 2018 - schwab@suse.de
- Avoid duplicate source rpm
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jan 22 10:32:36 UTC 2018 - schwab@suse.de Mon Jan 22 10:32:36 UTC 2018 - schwab@suse.de
@ -5667,7 +5774,7 @@ Sat Sep 13 07:01:40 CEST 2003 - kukuk@suse.de
- Add librtkaio, a librt using kernel aio - Add librtkaio, a librt using kernel aio
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 11 16:59:49 CEST 2003 - kukuk@suse.de Thu Sep 11 16:59:50 CEST 2003 - kukuk@suse.de
- Update to current CVS - Update to current CVS
- Remove patches which are merged in CVS - Remove patches which are merged in CVS

View File

@ -1,4 +1,3 @@
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2 Version: GnuPG v2
@ -142,8 +141,6 @@ WtkGoi8buNcby4U=
=AL6o =AL6o
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: PGP Key Server 0.9.6 Version: PGP Key Server 0.9.6
@ -171,7 +168,6 @@ ZthBvjkZUZCOl+wjwbn3k4bpiEYEGBECAAYFAj0n9DwACgkQWDlSU/gp6efSHgCc
DxXIOrZyOO3jtbtsTYR/VrsdK9sAn0lrUm/jZKWyvK6V1CCA3TwXyvLQ DxXIOrZyOO3jtbtsTYR/VrsdK9sAn0lrUm/jZKWyvK6V1CCA3TwXyvLQ
=dSXY =dSXY
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFMAZNMBCACeatEKl6YY9iEVxzS64bPbvJsA1mLE2XFWmKXyYzm58dFqPMa0 mQENBFMAZNMBCACeatEKl6YY9iEVxzS64bPbvJsA1mLE2XFWmKXyYzm58dFqPMa0
@ -625,7 +621,6 @@ N7JGzLVNo+A=
=fZUN =fZUN
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.10 (GNU/Linux) Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

View File

@ -26,10 +26,10 @@
%define flavor @BUILD_FLAVOR@%{nil} %define flavor @BUILD_FLAVOR@%{nil}
%bcond_with all %bcond_with build_all
%define build_main 1 %define build_main 1
%define build_utils %{with all} %define build_utils %{with build_all}
%define build_testsuite %{with all} %define build_testsuite %{with build_all}
%if "%flavor" == "utils" %if "%flavor" == "utils"
%if %{with ringdisabled} %if %{with ringdisabled}
ExclusiveArch: do_not_build ExclusiveArch: do_not_build
@ -47,17 +47,25 @@ ExclusiveArch: do_not_build
%define build_testsuite 1 %define build_testsuite 1
%endif %endif
Name: glibc %if %{build_main}
%define name_suffix %{nil}
%else
%define name_suffix -%{flavor}-src
%endif
Name: glibc%{name_suffix}
Summary: Standard Shared Libraries (from the GNU C Library) Summary: Standard Shared Libraries (from the GNU C Library)
License: LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+ License: LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
Group: System/Libraries Group: System/Libraries
BuildRequires: audit-devel BuildRequires: audit-devel
BuildRequires: bison
BuildRequires: fdupes BuildRequires: fdupes
BuildRequires: libcap-devel BuildRequires: libcap-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: makeinfo BuildRequires: makeinfo
BuildRequires: pwdutils BuildRequires: pwdutils
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: systemtap-headers
BuildRequires: xz BuildRequires: xz
%if %{build_testsuite} %if %{build_testsuite}
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -83,7 +91,7 @@ BuildArch: i686
%define build_locales 1 %define build_locales 1
%define build_html 0 %define build_html 0
%else %else
%if %{with fast_build} || %{build_utils} && %{without all} %if %{with fast_build} || %{build_utils} && %{without build_all}
%define build_profile 0 %define build_profile 0
%define build_locales 0 %define build_locales 0
%define build_html 0 %define build_html 0
@ -134,11 +142,14 @@ BuildArch: i686
%ifarch ia64 %ifarch ia64
%define enablekernel 3.2.18 %define enablekernel 3.2.18
%endif %endif
%ifarch riscv64
%define enablekernel 4.15
%endif
Version: 2.26 Version: 2.27
Release: 0 Release: 0
%if !%{build_snapshot} %if !%{build_snapshot}
%define git_id 1c9a5c270d8b %define git_id 3260f6ce87b7
%define libversion %version %define libversion %version
%else %else
%define git_id %(echo %version | sed 's/.*\.g//') %define git_id %(echo %version | sed 's/.*\.g//')
@ -199,6 +210,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
# since it does not work on other architectures. # since it does not work on other architectures.
NoSource: 0 NoSource: 0
%endif %endif
%if !%{build_main}
NoSource: 0
%endif
# #
### ###
@ -232,8 +246,6 @@ Patch6: glibc-2.3.3-nscd-db-path.diff
Patch7: nss-db-path.patch Patch7: nss-db-path.patch
# PATCH-FIX-OPENSUSE adjust nscd.conf # PATCH-FIX-OPENSUSE adjust nscd.conf
Patch8: glibc-nscd.conf.patch Patch8: glibc-nscd.conf.patch
# PATCH-FIX-OPENSUSE do not use compile time in binaries
Patch9: glibc-nodate.patch
# PATCH-FIX-OPENSUSE -- add some extra information to version output - kukuk@suse.de # PATCH-FIX-OPENSUSE -- add some extra information to version output - kukuk@suse.de
Patch10: glibc-version.diff Patch10: glibc-version.diff
# PATCH-FIX-OPENSUSE -- Make --no-archive default for localedef - kukuk@suse.de # PATCH-FIX-OPENSUSE -- Make --no-archive default for localedef - kukuk@suse.de
@ -244,10 +256,6 @@ Patch14: glibc-bindresvport-blacklist.diff
Patch15: glibc-2.3.90-langpackdir.diff Patch15: glibc-2.3.90-langpackdir.diff
# PATCH-FEATURE-SLE Use nscd user for nscd # PATCH-FEATURE-SLE Use nscd user for nscd
Patch19: nscd-server-user.patch Patch19: nscd-server-user.patch
# PATCH-FEATURE-SLE powerpc: enable TLE only if GLIBC_ELISION_ENABLE=yes is defined
Patch21: powerpc-elision-enable-envvar.patch
# PATCH-FEATURE-SLE s390: enable TLE only if GLIBC_ELISION_ENABLE=yes is defined
Patch22: s390-elision-enable-envvar.patch
### Locale related patches ### Locale related patches
# PATCH-FIX-OPENSUSE Add additional locales # PATCH-FIX-OPENSUSE Add additional locales
@ -272,76 +280,14 @@ Patch306: glibc-fix-double-loopback.diff
### ###
# Patches from upstream # Patches from upstream
### ###
# PATCH-FIX-UPSTREAM Fix leaks of resolver contexts (BZ #21885, BZ #21932) # PATCH-FIX-UPSTREAM Fix parsing flags in ELF64 files (BZ #22827)
Patch1000: resolv-context-leak.patch Patch1000: riscv-readelflib.patch
# PATCH-FIX-UPSTREAM Use _dl_runtime_resolve_opt only with AVX512F (BZ #21871)
Patch1001: dl-runtime-resolve-opt-avx512f.patch
# PATCH-FIX-UPSTREAM Don't use IFUNC resolver for longjmp or system in libpthread (BZ #21041)
Patch1002: libpthread-compat-wrappers.patch
# PATCH-FIX-UPSTREAM Do not use __builtin_types_compatible_p in C++ mode (BZ #21930, BZ #22146, BZ #22235, BZ #22296)
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
# PATCH-FIX-UPSTREAM Remove reference to libnsl from nscd
Patch1013: nscd-libnsl.patch
# PATCH-FIX-UPSTREAM malloc: Fix tcache leak after thread destruction (BZ #22111)
Patch1014: malloc-tcache-leak.patch
# PATCH-FIX-UPSTREAM aarch64: Optimized implementation of memcpy/memmove for Qualcomm Falkor
Patch1015: falkor-memcpy-memmove.patch
# PATCH-FIX-UPSTREAM aarch64: Fix glibc.tune.cpu tunable handling
Patch1016: aarch64-cpu-features.patch
# PATCH-FIX-UPSTREAM nss_files: Avoid large buffers with many host addresses (BZ #22078)
Patch1017: nss-files-large-buffers.patch
# PATCH-FIX-UPSTREAM sysconf: Fix missing definition of UIO_MAXIOV on Linux (BZ #22321)
Patch1018: sysconf-uio-maxiov.patch
# PATCH-FIX-UPSTREAM glob: Fix buffer overflows (CVE-2017-15670, CVE-2017-15671, CVE-2017-15804, BZ #22320, BZ #22325, BZ #22332)
Patch1019: glob-tilde-overflow.patch
# PATCH-FIX-UPSTREAM x86-64: Use fxsave/xsave/xsavec in _dl_runtime_resolve (BZ #21265)
Patch1020: dl-runtime-resolve-xsave.patch
# PATCH-FIX-UPSTREAM posix: Fix improper assert in Linux posix_spawn (BZ #22273)
Patch1021: spawni-assert.patch
# PATCH-FIX-UPSTREAM x86-64: Don't set GLRO(dl_platform) to NULL (BZ #22299)
Patch1022: x86-64-dl-platform.patch
# PATCH-FIX-UPSTREAM no compat glob64 on s390
Patch1023: glob64-s390.patch
# PATCH-FIX-UPSTREAM tst-tlsopt-powerpc as a shared lib
Patch1024: tst-tlsopt-powerpc.patch
# PATCH-FIX-UPSTREAM Update HWCAP for powerpc
Patch1025: powerpc-hwcap-bits.patch
# PATCH-FIX-UPSTREAM Fix integer overflow in malloc when tcache is enabled (CVE-2017-17426, BZ #22375)
Patch1026: malloc-tcache-check-overflow.patch
# PATCH-FIX-UPSTREAM Count components of the expanded path in _dl_init_path (CVE-2017-1000408, CVE-2017-1000409, bsc#1071319, BZ #22607, BZ #22627)
Patch1027: dl-init-paths-overflow.patch
# PATCH-FIX-UPSTREAM Check for empty tokens before dynamic string token expansion (CVE-2017-16997, bsc#1073231, BZ #22625)
Patch1028: fillin-rpath-empty-tokens.patch
# PATCH-FIX-UPSTREAM make getcwd(3) fail if it cannot obtain an absolute path (CVE-2018-1000001, BZ #22679)
Patch1029: getcwd-absolute.patch
### ###
# Patches awaiting upstream approval # Patches awaiting upstream approval
### ###
# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142) # PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142)
Patch2000: fix-locking-in-_IO_cleanup.patch Patch2000: fix-locking-in-_IO_cleanup.patch
# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750)
Patch2001: ldd-system-interp.patch
# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436)
Patch2002: abort-no-flush.patch
# PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) # PATCH-FIX-UPSTREAM Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
Patch2004: fnmatch-collating-elements.patch Patch2004: fnmatch-collating-elements.patch
# PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991) # PATCH-FIX-UPSTREAM Properly reread entry after failure in nss_files getent function (BZ #18991)
@ -359,31 +305,31 @@ by nearly all programs: the standard C library, the standard math
library, and the POSIX thread library. A system is not functional library, and the POSIX thread library. A system is not functional
without these libraries. without these libraries.
%package utils %package -n glibc-utils
Summary: Development utilities from the GNU C Library Summary: Development utilities from the GNU C Library
License: LGPL-2.1+ License: LGPL-2.1-or-later
Group: Development/Languages/C and C++ Group: Development/Languages/C and C++
Requires: glibc = %{version} Requires: glibc = %{version}
%description utils %description -n glibc-utils
The glibc-utils package contains mtrace, a memory leak tracer and The glibc-utils package contains mtrace, a memory leak tracer and
xtrace, a function call tracer which can be helpful during program xtrace, a function call tracer which can be helpful during program
debugging. debugging.
If you are unsure if you need this, do not install this package. If you are unsure if you need this, do not install this package.
%package testsuite %package -n glibc-testsuite
Summary: Testsuite results from the GNU C Library Summary: Testsuite results from the GNU C Library
License: LGPL-2.1+ License: LGPL-2.1-or-later
Group: Development/Languages/C and C++ Group: Development/Languages/C and C++
%description testsuite %description -n glibc-testsuite
This package contains the testsuite results from the GNU C Library. This package contains the testsuite results from the GNU C Library.
%if %{build_main} %if %{build_main}
%package info %package info
Summary: Info Files for the GNU C Library Summary: Info Files for the GNU C Library
License: GFDL-1.1 License: GFDL-1.1-only
Group: Documentation/Other Group: Documentation/Other
Requires(post): %{install_info_prereq} Requires(post): %{install_info_prereq}
Requires(preun): %{install_info_prereq} Requires(preun): %{install_info_prereq}
@ -396,7 +342,7 @@ complete and is partially out of date.
%package html %package html
Summary: HTML Documentation for the GNU C Library Summary: HTML Documentation for the GNU C Library
License: GFDL-1.1 License: GFDL-1.1-only
Group: Documentation/HTML Group: Documentation/HTML
BuildArch: noarch BuildArch: noarch
@ -407,7 +353,7 @@ partially out of date.
%package i18ndata %package i18ndata
Summary: Database Sources for 'locale' Summary: Database Sources for 'locale'
License: GPL-2.0+ AND MIT License: GPL-2.0-or-later AND MIT
Group: System/Libraries Group: System/Libraries
BuildArch: noarch BuildArch: noarch
@ -419,7 +365,7 @@ created.
%package locale %package locale
Summary: Locale Data for Localized Programs Summary: Locale Data for Localized Programs
License: GPL-2.0+ AND MIT AND LGPL-2.1+ License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later
Group: System/Libraries Group: System/Libraries
Requires(post): /bin/cat Requires(post): /bin/cat
Requires: glibc = %{version} Requires: glibc = %{version}
@ -436,7 +382,7 @@ Locale data for the internationalisation features of the GNU C library.
%package -n nscd %package -n nscd
Summary: Name Service Caching Daemon Summary: Name Service Caching Daemon
License: GPL-2.0+ License: GPL-2.0-or-later
Group: System/Daemons Group: System/Daemons
Provides: glibc:/usr/sbin/nscd Provides: glibc:/usr/sbin/nscd
Requires: glibc = %{version} Requires: glibc = %{version}
@ -450,7 +396,7 @@ performance with NIS, NIS+, and LDAP.
%package profile %package profile
Summary: Libc Profiling and Debugging Versions Summary: Libc Profiling and Debugging Versions
License: LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+ License: LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: glibc = %{version} Requires: glibc = %{version}
# bug437293 # bug437293
@ -467,7 +413,7 @@ necessary for profiling and debugging.
%package devel %package devel
Summary: Include Files and Libraries Mandatory for Development Summary: Include Files and Libraries Mandatory for Development
License: BSD-3-Clause AND LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+ License: BSD-3-Clause AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Obsoletes: epoll = 1.0 Obsoletes: epoll = 1.0
Provides: epoll < 1.0 Provides: epoll < 1.0
@ -487,7 +433,7 @@ library.
%package devel-static %package devel-static
Summary: C library static libraries for -static linking Summary: C library static libraries for -static linking
License: BSD-3-Clause AND LGPL-2.1+ AND SUSE-LGPL-2.1+-with-GCC-exception AND GPL-2.0+ License: BSD-3-Clause AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version} Requires: %{name}-devel = %{version}
# Provide Fedora name for package to make packaging easier # Provide Fedora name for package to make packaging easier
@ -502,7 +448,7 @@ which is highly discouraged.
# package so that glibc does not require libselinux. # package so that glibc does not require libselinux.
%package extra %package extra
Summary: Extra binaries from GNU C Library Summary: Extra binaries from GNU C Library
License: LGPL-2.1+ License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: glibc = %{version} Requires: glibc = %{version}
@ -530,19 +476,11 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
# avoid changing nscd_stat.c mtime to avoid code generation
# differences on each rebuild
touch -r nscd/nscd_stat.c nscd/s-stamp
%patch9 -p1
touch -r nscd/s-stamp nscd/nscd_stat.c
rm nscd/s-stamp
%patch10 -p1 %patch10 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch15 -p1 %patch15 -p1
%patch19 -p1 %patch19 -p1
%patch21 -p1
%patch22 -p1
%patch100 -p1 %patch100 -p1
%patch102 -p1 %patch102 -p1
@ -554,39 +492,8 @@ rm nscd/s-stamp
%patch306 -p1 %patch306 -p1
%patch1000 -p1 %patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch1020 -p1
%patch1021 -p1
%patch1022 -p1
%patch1023 -p1
%patch1024 -p1
%patch1025 -p1
%patch1026 -p1
%patch1027 -p1
%patch1028 -p1
%patch1029 -p1
%patch2000 -p1 %patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2004 -p1 %patch2004 -p1
%patch2005 -p1 %patch2005 -p1
%patch2006 -p1 %patch2006 -p1
@ -716,17 +623,13 @@ configure_and_build_glibc() {
profile="--enable-profile" profile="--enable-profile"
fi fi
%endif %endif
elision=--enable-lock-elision
if [ "$dirname" = "noelision" ]; then
elision=--disable-lock-elision
fi
../configure \ ../configure \
CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \ CFLAGS="$conf_cflags" BUILD_CFLAGS="$conf_cflags" \
CC="$BuildCC" CXX="$BuildCCplus" \ CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \ --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
--enable-add-ons=$add_ons \ --enable-add-ons=$add_ons \
$profile $elision \ $profile \
"$@" \ "$@" \
--build=%{target} --host=%{target} \ --build=%{target} --host=%{target} \
%ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x %ifarch armv7hl ppc ppc64 ppc64le i686 x86_64 sparc sparc64 s390 s390x
@ -746,9 +649,8 @@ configure_and_build_glibc() {
--enable-kernel=%{enablekernel} \ --enable-kernel=%{enablekernel} \
--with-bugurl=http://bugs.opensuse.org \ --with-bugurl=http://bugs.opensuse.org \
--enable-bind-now \ --enable-bind-now \
--enable-obsolete-rpc \ --enable-systemtap \
--disable-timezone-tools --disable-timezone-tools
# Should we enable --enable-systemtap?
# Should we enable --enable-nss-crypt to build use freebl3 hash functions? # Should we enable --enable-nss-crypt to build use freebl3 hash functions?
# explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags"
@ -798,12 +700,6 @@ configure_and_build_glibc() {
%endif # %{build_variants} %endif # %{build_variants}
%endif # optimize_power %endif # optimize_power
%if %{build_variants}
%ifarch i686 x86_64
configure_and_build_glibc noelision "$BuildFlags"
%endif
%endif
# #
# Build html documentation # Build html documentation
# #
@ -875,6 +771,15 @@ make %{?_smp_mflags} -C cc-base check-abi
%endif %endif
%install %install
%if !%{build_testsuite}
%ifarch riscv64
mkdir -p %{buildroot}%{_libdir}
ln -s . %{buildroot}%{_libdir}/lp64d
mkdir -p %{buildroot}/%{_lib}
ln -s . %{buildroot}/%{_lib}/lp64d
%endif
%endif
%if %{build_main} %if %{build_main}
# We don't want to strip the .symtab from our libraries in find-debuginfo.sh, # We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
# certainly not from libpthread.so.* because it is used by libthread_db to find # certainly not from libpthread.so.* because it is used by libthread_db to find
@ -947,15 +852,6 @@ cc-base/elf/ldconfig -vn $destdir
%endif %endif
%endif # optimize_power %endif # optimize_power
%ifarch i686 x86_64
cd cc-noelision
destdir=$RPM_BUILD_ROOT/%{_lib}/noelision
mkdir -p $destdir
install -m 755 nptl/libpthread.so $destdir/libpthread-%{libversion}.so
cd ..
cc-base/elf/ldconfig -vn $destdir
%endif
# Install locales # Install locales
%if %{build_locales} %if %{build_locales}
# XXX Do not install locales in parallel! # XXX Do not install locales in parallel!
@ -973,11 +869,6 @@ cc-base/elf/ldconfig -vn $destdir
# Create file list for glibc-locale package # Create file list for glibc-locale package
%{find_lang} libc %{find_lang} libc
# remove nsl compat library
rm -f %{buildroot}%{_libdir}/libnsl*
# part of libnsl-devel
rm -f %{buildroot}%{_includedir}/rpcsvc/yppasswd.*
# Miscelanna: # Miscelanna:
install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir}
@ -1118,6 +1009,9 @@ rm -f %{buildroot}%{_libdir}/lib*
rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof} rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof}
rm -rf %{buildroot}%{_mandir}/man* rm -rf %{buildroot}%{_mandir}/man*
rm -rf %{buildroot}/sbin %{buildroot}%{_includedir} rm -rf %{buildroot}/sbin %{buildroot}%{_includedir}
%ifarch riscv64
rm %{buildroot}/%{_lib}/lp64d %{buildroot}%{_libdir}/lp64d
%endif
%endif # utils %endif # utils
@ -1167,7 +1061,7 @@ exit 0
%files %files
# glibc # glibc
%defattr(-,root,root) %defattr(-,root,root)
%doc LICENSES %license LICENSES
%config(noreplace) /etc/bindresvport.blacklist %config(noreplace) /etc/bindresvport.blacklist
%config /etc/ld.so.conf %config /etc/ld.so.conf
%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /etc/ld.so.cache
@ -1216,6 +1110,12 @@ exit 0
/lib/ld-linux-aarch64.so.1 /lib/ld-linux-aarch64.so.1
/%{_lib}/ld-linux-aarch64.so.1 /%{_lib}/ld-linux-aarch64.so.1
%endif %endif
%ifarch riscv64
/lib/ld-linux-riscv64-lp64d.so.1
/%{_lib}/ld-linux-riscv64-lp64d.so.1
/%{_lib}/lp64d
%{_libdir}/lp64d
%endif
%ifarch %ix86 x86_64 ppc ppc64 s390 s390x %ifarch %ix86 x86_64 ppc ppc64 s390 s390x
# LSB # LSB
/%{_lib}/*-lsb*.so.3 /%{_lib}/*-lsb*.so.3
@ -1292,9 +1192,6 @@ exit 0
%{optimized_libs ppc-cell-be} %{optimized_libs ppc-cell-be}
%endif %endif
%endif # optimize_power %endif # optimize_power
%ifarch i686 x86_64
/%{_lib}/noelision
%endif
%dir %attr(0700,root,root) /var/cache/ldconfig %dir %attr(0700,root,root) /var/cache/ldconfig
/sbin/ldconfig /sbin/ldconfig
%{_bindir}/gencat %{_bindir}/gencat
@ -1322,12 +1219,10 @@ exit 0
%files devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE %doc COPYING COPYING.LIB NEWS README
%doc %{_mandir}/man1/catchsegv.1.gz %doc %{_mandir}/man1/catchsegv.1.gz
%doc %{_mandir}/man1/rpcgen.1.gz
%doc %{_mandir}/man3/* %doc %{_mandir}/man3/*
%{_bindir}/catchsegv %{_bindir}/catchsegv
%{_bindir}/rpcgen
%{_bindir}/sprof %{_bindir}/sprof
%{_includedir}/* %{_includedir}/*
%{_libdir}/*.o %{_libdir}/*.o
@ -1335,7 +1230,6 @@ exit 0
# These static libraries are needed even for shared builds # These static libraries are needed even for shared builds
%{_libdir}/libc_nonshared.a %{_libdir}/libc_nonshared.a
%{_libdir}/libg.a %{_libdir}/libg.a
%{_libdir}/libieee.a
%ifarch ppc ppc64 ppc64le s390 s390x sparc sparcv8 sparcv9 sparcv9v %ifarch ppc ppc64 ppc64le s390 s390x sparc sparcv8 sparcv9 sparcv9v
# This is not built on sparc64. # This is not built on sparc64.
%{_libdir}/libnldbl_nonshared.a %{_libdir}/libnldbl_nonshared.a
@ -1345,7 +1239,6 @@ exit 0
%{_libdir}/libmvec_nonshared.a %{_libdir}/libmvec_nonshared.a
%endif %endif
%{_libdir}/libpthread_nonshared.a %{_libdir}/libpthread_nonshared.a
%{_libdir}/librpcsvc.a
%files devel-static %files devel-static
%defattr(-,root,root) %defattr(-,root,root)
@ -1416,7 +1309,6 @@ exit 0
%{_libdir}/libpthread_p.a %{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a %{_libdir}/libresolv_p.a
%{_libdir}/librt_p.a %{_libdir}/librt_p.a
%{_libdir}/librpcsvc_p.a
%{_libdir}/libutil_p.a %{_libdir}/libutil_p.a
%{_libdir}/libdl_p.a %{_libdir}/libdl_p.a
%endif %endif
@ -1431,7 +1323,7 @@ exit 0
%endif # main %endif # main
%if %{build_utils} %if %{build_utils}
%files utils %files -n glibc-utils
%defattr(-,root,root) %defattr(-,root,root)
/%{_lib}/libmemusage.so /%{_lib}/libmemusage.so
/%{_lib}/libpcprofile.so /%{_lib}/libpcprofile.so

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
Index: glibc-2.26/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/unix/sysv/linux/s390/s390-32/oldglob.c
@@ -0,0 +1 @@
+/* No compat glob64 on s390. */

View File

@ -13,13 +13,13 @@ Fix iconv buffer handling with IGNORE error handler (bug #18830)
* iconv/Makefile (tests): Add tst-iconv7. * iconv/Makefile (tests): Add tst-iconv7.
* iconv/tst-iconv7.c: New file. * iconv/tst-iconv7.c: New file.
Index: glibc-2.22/iconv/Makefile Index: glibc-2.27/iconv/Makefile
=================================================================== ===================================================================
--- glibc-2.22.orig/iconv/Makefile --- glibc-2.27.orig/iconv/Makefile
+++ glibc-2.22/iconv/Makefile +++ glibc-2.27/iconv/Makefile
@@ -42,7 +42,8 @@ CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i1 @@ -43,7 +43,8 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i
CFLAGS-linereader.c = -DNO_TRANSLITERATION CFLAGS-linereader.c += -DNO_TRANSLITERATION
CFLAGS-simple-hash.c = -I../locale CFLAGS-simple-hash.c += -I../locale
-tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 -tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6
+tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \ +tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \
@ -27,10 +27,10 @@ Index: glibc-2.22/iconv/Makefile
others = iconv_prog iconvconfig others = iconv_prog iconvconfig
install-others-programs = $(inst_bindir)/iconv install-others-programs = $(inst_bindir)/iconv
Index: glibc-2.22/iconv/gconv_simple.c Index: glibc-2.27/iconv/gconv_simple.c
=================================================================== ===================================================================
--- glibc-2.22.orig/iconv/gconv_simple.c --- glibc-2.27.orig/iconv/gconv_simple.c
+++ glibc-2.22/iconv/gconv_simple.c +++ glibc-2.27/iconv/gconv_simple.c
@@ -76,7 +76,7 @@ __attribute ((always_inline)) @@ -76,7 +76,7 @@ __attribute ((always_inline))
internal_ucs4_loop (struct __gconv_step *step, internal_ucs4_loop (struct __gconv_step *step,
struct __gconv_step_data *step_data, struct __gconv_step_data *step_data,
@ -147,10 +147,10 @@ Index: glibc-2.22/iconv/gconv_simple.c
size_t *irreversible) size_t *irreversible)
{ {
mbstate_t *state = step_data->__statep; mbstate_t *state = step_data->__statep;
Index: glibc-2.22/iconv/skeleton.c Index: glibc-2.27/iconv/skeleton.c
=================================================================== ===================================================================
--- glibc-2.22.orig/iconv/skeleton.c --- glibc-2.27.orig/iconv/skeleton.c
+++ glibc-2.22/iconv/skeleton.c +++ glibc-2.27/iconv/skeleton.c
@@ -597,6 +597,10 @@ FUNCTION_NAME (struct __gconv_step *step @@ -597,6 +597,10 @@ FUNCTION_NAME (struct __gconv_step *step
inptr = *inptrp; inptr = *inptrp;
/* The outbuf buffer is empty. */ /* The outbuf buffer is empty. */
@ -224,10 +224,10 @@ Index: glibc-2.22/iconv/skeleton.c
/* Change the status. */ /* Change the status. */
status = result; status = result;
} }
Index: glibc-2.22/iconv/tst-iconv7.c Index: glibc-2.27/iconv/tst-iconv7.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.22/iconv/tst-iconv7.c +++ glibc-2.27/iconv/tst-iconv7.c
@@ -0,0 +1,68 @@ @@ -0,0 +1,68 @@
+/* Test iconv buffer handling with the IGNORE error handler. +/* Test iconv buffer handling with the IGNORE error handler.
+ Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2015 Free Software Foundation, Inc.
@ -297,10 +297,10 @@ Index: glibc-2.22/iconv/tst-iconv7.c
+ +
+#define TEST_FUNCTION do_test () +#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c" +#include "../test-skeleton.c"
Index: glibc-2.23.90/sysdeps/s390/multiarch/gconv_simple.c Index: glibc-2.27/sysdeps/s390/multiarch/gconv_simple.c
=================================================================== ===================================================================
--- glibc-2.23.90.orig/sysdeps/s390/multiarch/gconv_simple.c --- glibc-2.27.orig/sysdeps/s390/multiarch/gconv_simple.c
+++ glibc-2.23.90/sysdeps/s390/multiarch/gconv_simple.c +++ glibc-2.27/sysdeps/s390/multiarch/gconv_simple.c
@@ -403,7 +403,7 @@ ICONV_VX_NAME (internal_ucs4le_loop) (st @@ -403,7 +403,7 @@ ICONV_VX_NAME (internal_ucs4le_loop) (st
const unsigned char **inptrp, const unsigned char **inptrp,
const unsigned char *inend, const unsigned char *inend,

View File

@ -1,190 +0,0 @@
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,41 +0,0 @@
Never try to execute the file in ldd
Executing a random file is never a good idea. Treat all arguments as if
they are invoked with __libc_enable_secure, and run them through the known
good dynamic linker.
* elf/ldd.bash.in: Always run through the dynamic linker, even if
the file has its own interpreter.
Index: glibc-2.19/elf/ldd.bash.in
===================================================================
--- glibc-2.19.orig/elf/ldd.bash.in
+++ glibc-2.19/elf/ldd.bash.in
@@ -164,18 +164,6 @@ warning: you do not have execution permi
fi
done
case $ret in
- 0)
- # If the program exits with exit code 5, it means the process has been
- # invoked with __libc_enable_secure. Fall back to running it through
- # the dynamic linker.
- try_trace "$file"
- rc=$?
- if [ $rc = 5 ]; then
- try_trace "$RTLD" "$file"
- rc=$?
- fi
- [ $rc = 0 ] || result=1
- ;;
1)
# This can be a non-ELF binary or no binary at all.
nonelf "$file" || {
@@ -183,7 +171,7 @@ warning: you do not have execution permi
result=1
}
;;
- 2)
+ [02])
try_trace "$RTLD" "$file" || result=1
;;
*)

View File

@ -1,120 +0,0 @@
2017-08-09 Andreas Schwab <schwab@suse.de>
[BZ #21041]
* sysdeps/unix/sysv/linux/s390/pt-longjmp.c: Update reference to
renamed alias.
2017-08-08 Andreas Schwab <schwab@suse.de>
[BZ #21041]
* nptl/pt-longjmp.c (longjmp, siglongjmp): Don't use IFUNC resolver.
* nptl/pt-system.c (system): Likewise.
Index: glibc-2.26/nptl/pt-longjmp.c
===================================================================
--- glibc-2.26.orig/nptl/pt-longjmp.c
+++ glibc-2.26/nptl/pt-longjmp.c
@@ -25,21 +25,14 @@
symbol in libpthread, but the historical ABI requires it. For static
linking, there is no need to provide anything here--the libc version
will be linked in. For shared library ABI compatibility, there must be
- longjmp and siglongjmp symbols in libpthread.so; so we define them using
- IFUNC to redirect to the libc function. */
+ longjmp and siglongjmp symbols in libpthread.so.
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-# undef INIT_ARCH
-# define INIT_ARCH()
-# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp)
-
-extern __typeof(longjmp) longjmp_ifunc;
-extern __typeof(siglongjmp) siglongjmp_ifunc;
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_longjmp symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */
-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
static void __attribute__ ((noreturn, used))
longjmp_compat (jmp_buf env, int val)
@@ -47,14 +40,10 @@ longjmp_compat (jmp_buf env, int val)
__libc_longjmp (env, val);
}
-# define DEFINE_LONGJMP(name) strong_alias (longjmp_compat, name)
-
-# endif /* HAVE_IFUNC */
-
-DEFINE_LONGJMP (longjmp_ifunc)
-compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0);
+strong_alias (longjmp_compat, longjmp_alias)
+compat_symbol (libpthread, longjmp_alias, longjmp, GLIBC_2_0);
-strong_alias (longjmp_ifunc, siglongjmp_ifunc)
-compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0);
+strong_alias (longjmp_alias, siglongjmp_alias)
+compat_symbol (libpthread, siglongjmp_alias, siglongjmp, GLIBC_2_0);
#endif
Index: glibc-2.26/nptl/pt-system.c
===================================================================
--- glibc-2.26.orig/nptl/pt-system.c
+++ glibc-2.26/nptl/pt-system.c
@@ -25,29 +25,21 @@
libpthread, but the historical ABI requires it. For static linking,
there is no need to provide anything here--the libc version will be
linked in. For shared library ABI compatibility, there must be a
- 'system' symbol in libpthread.so; so we define it using IFUNC to
- redirect to the libc function. */
+ 'system' symbol in libpthread.so.
-#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
-
-# if HAVE_IFUNC
-
-extern __typeof(system) system_ifunc;
-# undef INIT_ARCH
-# define INIT_ARCH()
-libc_ifunc (system_ifunc, &__libc_system)
+ With an IFUNC resolver, it would be possible to avoid the indirection,
+ but the IFUNC resolver might run before the __libc_system symbol has
+ been relocated, in which case the IFUNC resolver would not be able to
+ provide the correct address. */
-# else /* !HAVE_IFUNC */
+#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_22)
static int __attribute__ ((used))
system_compat (const char *line)
{
return __libc_system (line);
}
-strong_alias (system_compat, system_ifunc)
-
-# endif /* HAVE_IFUNC */
-
-compat_symbol (libpthread, system_ifunc, system, GLIBC_2_0);
+strong_alias (system_compat, system_alias)
+compat_symbol (libpthread, system_alias, system, GLIBC_2_0);
#endif
Index: glibc-2.26/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
+++ glibc-2.26/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
@@ -26,8 +26,8 @@
/* In glibc release 2.19 new versions of longjmp-functions were introduced,
but were reverted before 2.20. Thus both versions are the same function. */
-strong_alias (longjmp_ifunc, __v2longjmp)
+strong_alias (longjmp_alias, __v2longjmp)
compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19);
-strong_alias (siglongjmp_ifunc, __v2siglongjmp)
+strong_alias (siglongjmp_alias, __v2siglongjmp)
compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19);
#endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20)) */

View File

@ -1,21 +0,0 @@
2017-11-30 Arjun Shankar <arjun@redhat.com>
[BZ #22375]
CVE-2017-17426
* malloc/malloc.c (__libc_malloc): Use checked_request2size
instead of request2size.
Index: glibc-2.26/malloc/malloc.c
===================================================================
--- glibc-2.26.orig/malloc/malloc.c
+++ glibc-2.26/malloc/malloc.c
@@ -3052,7 +3052,8 @@ __libc_malloc (size_t bytes)
return (*hook)(bytes, RETURN_ADDRESS (0));
#if USE_TCACHE
/* int_free also calls request2size, be careful to not pad twice. */
- size_t tbytes = request2size (bytes);
+ size_t tbytes;
+ checked_request2size (bytes, tbytes);
size_t tc_idx = csize2tidx (tbytes);
MAYBE_INIT_TCACHE ();

View File

@ -1,179 +0,0 @@
2017-10-06 Carlos O'Donell <carlos@redhat.com>
[BZ #22111]
* malloc/malloc.c (tcache_shutting_down): Use bool type.
(tcache_thread_freeres): Set tcache_shutting_down before
freeing the tcache.
* malloc/Makefile (tests): Add tst-malloc-tcache-leak.
* malloc/tst-malloc-tcache-leak.c: New file.
Index: glibc-2.26/malloc/Makefile
===================================================================
--- glibc-2.26.orig/malloc/Makefile
+++ glibc-2.26/malloc/Makefile
@@ -34,6 +34,7 @@ tests := mallocbug tst-malloc tst-valloc
tst-interpose-nothread \
tst-interpose-thread \
tst-alloc_buffer \
+ tst-malloc-tcache-leak \
tests-static := \
tst-interpose-static-nothread \
@@ -242,3 +243,5 @@ tst-dynarray-fail-ENV = MALLOC_TRACE=$(o
$(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-dynarray-fail.mtrace > $@; \
$(evaluate-test)
+
+$(objpfx)tst-malloc-tcache-leak: $(shared-thread-library)
Index: glibc-2.26/malloc/malloc.c
===================================================================
--- glibc-2.26.orig/malloc/malloc.c
+++ glibc-2.26/malloc/malloc.c
@@ -2940,7 +2940,7 @@ typedef struct tcache_perthread_struct
tcache_entry *entries[TCACHE_MAX_BINS];
} tcache_perthread_struct;
-static __thread char tcache_shutting_down = 0;
+static __thread bool tcache_shutting_down = false;
static __thread tcache_perthread_struct *tcache = NULL;
/* Caller must ensure that we know tc_idx is valid and there's room
@@ -2977,8 +2977,12 @@ tcache_thread_freeres (void)
if (!tcache)
return;
+ /* Disable the tcache and prevent it from being reinitialized. */
tcache = NULL;
+ tcache_shutting_down = true;
+ /* Free all of the entries and the tcache itself back to the arena
+ heap for coalescing. */
for (i = 0; i < TCACHE_MAX_BINS; ++i)
{
while (tcache_tmp->entries[i])
@@ -2990,8 +2994,6 @@ tcache_thread_freeres (void)
}
__libc_free (tcache_tmp);
-
- tcache_shutting_down = 1;
}
text_set_element (__libc_thread_subfreeres, tcache_thread_freeres);
Index: glibc-2.26/malloc/tst-malloc-tcache-leak.c
===================================================================
--- /dev/null
+++ glibc-2.26/malloc/tst-malloc-tcache-leak.c
@@ -0,0 +1,112 @@
+/* Bug 22111: Test that threads do not leak their per thread cache.
+ Copyright (C) 2015-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/>. */
+
+/* The point of this test is to start and exit a large number of
+ threads, while at the same time looking to see if the used
+ memory grows with each round of threads run. If the memory
+ grows above some linear bound we declare the test failed and
+ that the malloc implementation is leaking memory with each
+ thread. This is a good indicator that the thread local cache
+ is leaking chunks. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <pthread.h>
+#include <assert.h>
+
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xthread.h>
+
+void *
+worker (void *data)
+{
+ void *ret;
+ /* Allocate an arbitrary amount of memory that is known to fit into
+ the thread local cache (tcache). If we have at least 64 bins
+ (default e.g. TCACHE_MAX_BINS) we should be able to allocate 32
+ bytes and force malloc to fill the tcache. We are assuming tcahce
+ init happens at the first small alloc, but it might in the future
+ be deferred to some other point. Therefore to future proof this
+ test we include a full alloc/free/alloc cycle for the thread. We
+ need a compiler barrier to avoid the removal of the useless
+ alloc/free. We send some memory back to main to have the memory
+ freed after the thread dies, as just another check that the chunks
+ that were previously in the tcache are still OK to free after
+ thread death. */
+ ret = xmalloc (32);
+ __asm__ volatile ("" ::: "memory");
+ free (ret);
+ return (void *) xmalloc (32);
+}
+
+static int
+do_test (void)
+{
+ pthread_t *thread;
+ struct mallinfo info_before, info_after;
+ void *retval;
+
+ /* This is an arbitrary choice. We choose a total of THREADS
+ threads created and joined. This gives us enough iterations to
+ show a leak. */
+ int threads = 100000;
+
+ /* Avoid there being 0 malloc'd data at this point by allocating the
+ pthread_t required to run the test. */
+ thread = (pthread_t *) xcalloc (1, sizeof (pthread_t));
+
+ info_before = mallinfo ();
+
+ assert (info_before.uordblks != 0);
+
+ printf ("INFO: %d (bytes) are in use before starting threads.\n",
+ info_before.uordblks);
+
+ for (int loop = 0; loop < threads; loop++)
+ {
+ *thread = xpthread_create (NULL, worker, NULL);
+ retval = xpthread_join (*thread);
+ free (retval);
+ }
+
+ info_after = mallinfo ();
+ printf ("INFO: %d (bytes) are in use after all threads joined.\n",
+ info_after.uordblks);
+
+ /* We need to compare the memory in use before and the memory in use
+ after starting and joining THREADS threads. We almost always grow
+ memory slightly, but not much. Consider that if even 1-byte leaked
+ per thread we'd have THREADS bytes of additional memory, and in
+ general the in-use at the start of main is quite low. We will
+ always leak a full malloc chunk, and never just 1-byte, therefore
+ anything above "+ threads" from the start (constant offset) is a
+ leak. Obviously this assumes no thread-related malloc'd internal
+ libc data structures persist beyond the thread death, and any that
+ did would limit the number of times you could call pthread_create,
+ which is a QoI we'd want to detect and fix. */
+ if (info_after.uordblks > (info_before.uordblks + threads))
+ FAIL_EXIT1 ("Memory usage after threads is too high.\n");
+
+ /* Did not detect excessive memory usage. */
+ free (thread);
+ exit (0);
+}
+
+#include <support/test-driver.c>

BIN
manpages.tar.bz2 (Stored with Git LFS)

Binary file not shown.

View File

@ -1,271 +0,0 @@
2017-10-17 Romain Naour <romain.naour@gmail.com> (tiny change)
[BZ #22296]
* math/math.h: Let signbit use the builtin in C++ mode with gcc
< 6.x
2017-10-03 Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
[BZ #22235]
* sysdeps/ieee754/ldbl-96/bits/iscanonical.h (iscanonical):
Provide a C++ implementation based on function overloading,
rather than using __MATH_TG, which uses C-only builtins.
* sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h (iscanonical):
Likewise.
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]
* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
(iszero): New C++ implementation that does not use
fpclassify/__MATH_TG/__builtin_types_compatible_p, when
signaling nans are enabled, since __builtin_types_compatible_p
is a C-only feature.
2017-08-24 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* math/math.h [defined __cplusplus] (issignaling): In the long
double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
is not defined. Call __issignaling, otherwise.
2017-08-22 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
* math/math.h [defined __cplusplus] (issignaling): Provide a C++
definition for issignaling that does not rely on __MATH_TG,
since __MATH_TG uses __builtin_types_compatible_p, which is only
available in C mode.
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
[BZ #21930]
* math/math.h (isinf): Check if in C or C++ mode before using
__builtin_types_compatible_p, since this is a C mode feature.
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
@@ -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
@@ -412,6 +418,15 @@ enum
/* Return nonzero value if sign of X is negative. */
# if __GNUC_PREREQ (6,0)
# define signbit(x) __builtin_signbit (x)
+# elif defined __cplusplus
+ /* In C++ mode, __MATH_TG cannot be used, because it relies on
+ __builtin_types_compatible_p, which is a C-only builtin.
+ The check for __cplusplus allows the use of the builtin instead of
+ __MATH_TG. This is provided for libstdc++, only to let its configure
+ test work. No further use of this definition of signbit is expected
+ in C++ mode, since libstdc++ provides its own version of signbit
+ in cmath (which undefines signbit). */
+# define signbit(x) __builtin_signbitl (x)
# elif __GNUC_PREREQ (4,0)
# define signbit(x) __MATH_TG ((x), __builtin_signbit, (x))
# else
@@ -442,8 +457,12 @@ enum
/* Return nonzero value if X is positive or negative infinity. */
# if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
- && !defined __SUPPORT_SNAN__
- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */
+ && !defined __SUPPORT_SNAN__ && !defined __cplusplus
+ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
+ use the helper function, __isinff128, with older compilers. This is
+ only provided for C mode, because in C++ mode, GCC has no support
+ for __builtin_types_compatible_p (and when in C++ mode, this macro is
+ not used anyway, because libstdc++ headers undefine it). */
# define isinf(x) \
(__builtin_types_compatible_p (__typeof (x), _Float128) \
? __isinff128 (x) : __builtin_isinf_sign (x))
@@ -470,7 +489,32 @@ enum
# include <bits/iscanonical.h>
/* Return nonzero value if X is a signaling NaN. */
-# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
+# ifndef __cplusplus
+# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
+# else
+ /* In C++ mode, __MATH_TG cannot be used, because it relies on
+ __builtin_types_compatible_p, which is a C-only builtin. On the
+ other hand, overloading provides the means to distinguish between
+ the floating-point types. The overloading resolution will match
+ the correct parameter (regardless of type qualifiers (i.e.: const
+ and volatile). */
+extern "C++" {
+inline int issignaling (float __val) { return __issignalingf (__val); }
+inline int issignaling (double __val) { return __issignaling (__val); }
+inline int
+issignaling (long double __val)
+{
+# ifdef __NO_LONG_DOUBLE_MATH
+ return __issignaling (__val);
+# else
+ return __issignalingl (__val);
+# endif
+}
+# if __HAVE_DISTINCT_FLOAT128
+inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }
+# endif
+} /* extern C++ */
+# endif
/* Return nonzero value if X is subnormal. */
# define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
@@ -484,15 +528,40 @@ enum
# endif
# else /* __cplusplus */
extern "C++" {
+# ifdef __SUPPORT_SNAN__
+inline int
+iszero (float __val)
+{
+ return __fpclassifyf (__val) == FP_ZERO;
+}
+inline int
+iszero (double __val)
+{
+ return __fpclassify (__val) == FP_ZERO;
+}
+inline int
+iszero (long double __val)
+{
+# ifdef __NO_LONG_DOUBLE_MATH
+ return __fpclassify (__val) == FP_ZERO;
+# else
+ return __fpclassifyl (__val) == FP_ZERO;
+# endif
+}
+# if __HAVE_DISTINCT_FLOAT128
+inline int
+iszero (_Float128 __val)
+{
+ return __fpclassifyf128 (__val) == FP_ZERO;
+}
+# endif
+# else
template <class __T> inline bool
iszero (__T __val)
{
-# ifdef __SUPPORT_SNAN__
- return fpclassify (__val) == FP_ZERO;
-# else
return __val == 0;
-# endif
}
+# endif
} /* 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
Index: glibc-2.26/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
===================================================================
--- glibc-2.26.orig/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
+++ glibc-2.26/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h
@@ -37,5 +37,22 @@ extern int __iscanonicall (long double _
conversion, before being discarded; in IBM long double, there are
encodings that are not consistently handled as corresponding to any
particular value of the type, and we return 0 for those. */
-# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
-#endif
+# ifndef __cplusplus
+# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
+# else
+/* In C++ mode, __MATH_TG cannot be used, because it relies on
+ __builtin_types_compatible_p, which is a C-only builtin. On the
+ other hand, overloading provides the means to distinguish between
+ the floating-point types. The overloading resolution will match
+ the correct parameter (regardless of type qualifiers (i.e.: const
+ and volatile)). */
+extern "C++" {
+inline int iscanonical (float __val) { return __iscanonicalf (__val); }
+inline int iscanonical (double __val) { return __iscanonical (__val); }
+inline int iscanonical (long double __val) { return __iscanonicall (__val); }
+# if __HAVE_DISTINCT_FLOAT128
+inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); }
+# endif
+}
+# endif /* __cplusplus */
+#endif /* __NO_LONG_DOUBLE_MATH */
Index: glibc-2.26/sysdeps/ieee754/ldbl-96/bits/iscanonical.h
===================================================================
--- glibc-2.26.orig/sysdeps/ieee754/ldbl-96/bits/iscanonical.h
+++ glibc-2.26/sysdeps/ieee754/ldbl-96/bits/iscanonical.h
@@ -34,4 +34,21 @@ extern int __iscanonicall (long double _
conversion, before being discarded; in extended precision, there
are encodings that are not consistently handled as corresponding to
any particular value of the type, and we return 0 for those. */
-#define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
+#ifndef __cplusplus
+# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x))
+#else
+/* In C++ mode, __MATH_TG cannot be used, because it relies on
+ __builtin_types_compatible_p, which is a C-only builtin. On the
+ other hand, overloading provides the means to distinguish between
+ the floating-point types. The overloading resolution will match
+ the correct parameter (regardless of type qualifiers (i.e.: const
+ and volatile)). */
+extern "C++" {
+inline int iscanonical (float __val) { return __iscanonicalf (__val); }
+inline int iscanonical (double __val) { return __iscanonical (__val); }
+inline int iscanonical (long double __val) { return __iscanonicall (__val); }
+# if __HAVE_DISTINCT_FLOAT128
+inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); }
+# endif
+}
+#endif /* __cplusplus */

View File

@ -1,107 +0,0 @@
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);

View File

@ -1,180 +0,0 @@
2017-10-11 Andreas Schwab <schwab@suse.de>
* nis/Makefile (aux): Remove.
* nscd/Makefile (aux): Add nscd_hash.
(nscd-modules): Likewise.
($(objpfx)nscd): Don't depend on libnsl.
* nscd/nscd_hash.c: New file.
* nscd/nscd_hash.h: Likewise.
* nscd/cache.c: Include "nscd_hash.h" instead of <rpcsvc/nis.h>.
(cache_search, cache_add): Use __nscd_hash instead of __nis_hash.
* nscd/nscd_helper.c: Include <sys/param.h> and "nscd_hash.h"
instead of <nis/rpcsvc/nis.h>.
(__nscd_cache_search): Use __nscd_hash instead of __nis_hash.
Index: glibc-2.26/nis/Makefile
===================================================================
--- glibc-2.26.orig/nis/Makefile
+++ glibc-2.26/nis/Makefile
@@ -22,8 +22,6 @@ subdir := nis
include ../Makeconfig
-aux := nis_hash
-
ifeq ($(build-obsolete-nsl),yes)
headers := $(wildcard rpcsvc/*.[hx])
Index: glibc-2.26/nscd/Makefile
===================================================================
--- glibc-2.26.orig/nscd/Makefile
+++ glibc-2.26/nscd/Makefile
@@ -25,7 +25,7 @@ include ../Makeconfig
ifneq ($(use-nscd),no)
routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \
nscd_initgroups nscd_getserv_r nscd_netgroup
-aux := nscd_helper
+aux := nscd_helper nscd_hash
endif
# To find xmalloc.c
@@ -36,7 +36,7 @@ nscd-modules := nscd connections pwdcach
getsrvbynm_r getsrvbypt_r servicescache \
dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
xmalloc xstrdup aicache initgrcache gai res_hconf \
- netgroupcache
+ netgroupcache nscd_hash
ifeq ($(build-nscd)$(have-thread-library),yesyes)
@@ -97,7 +97,7 @@ include $(patsubst %,$(..)libof-iterator
$(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o)
ifeq ($(build-shared),yes)
-$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so
+$(objpfx)nscd: $(shared-thread-library)
else
-$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a
+$(objpfx)nscd: $(static-thread-library)
endif
Index: glibc-2.26/nscd/cache.c
===================================================================
--- glibc-2.26.orig/nscd/cache.c
+++ glibc-2.26/nscd/cache.c
@@ -25,7 +25,6 @@
#include <string.h>
#include <libintl.h>
#include <arpa/inet.h>
-#include <rpcsvc/nis.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
@@ -33,6 +32,7 @@
#include "nscd.h"
#include "dbg_log.h"
+#include "nscd_hash.h"
/* Wrapper functions with error checking for standard functions. */
@@ -74,7 +74,7 @@ struct datahead *
cache_search (request_type type, const void *key, size_t len,
struct database_dyn *table, uid_t owner)
{
- unsigned long int hash = __nis_hash (key, len) % table->head->module;
+ unsigned long int hash = __nscd_hash (key, len) % table->head->module;
unsigned long int nsearched = 0;
struct datahead *result = NULL;
@@ -153,7 +153,7 @@ cache_add (int type, const void *key, si
first ? _(" (first)") : "");
}
- unsigned long int hash = __nis_hash (key, len) % table->head->module;
+ unsigned long int hash = __nscd_hash (key, len) % table->head->module;
struct hashentry *newp;
newp = mempool_alloc (table, sizeof (struct hashentry), 0);
Index: glibc-2.26/nscd/nscd_hash.c
===================================================================
--- /dev/null
+++ glibc-2.26/nscd/nscd_hash.c
@@ -0,0 +1,19 @@
+/* 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/>. */
+
+#define __nis_hash __nscd_hash
+#include <nis/nis_hash.c>
Index: glibc-2.26/nscd/nscd_hash.h
===================================================================
--- /dev/null
+++ glibc-2.26/nscd/nscd_hash.h
@@ -0,0 +1,21 @@
+/* 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 <stdint.h>
+
+extern uint32_t __nscd_hash (const void *__keyarg, size_t __len)
+ attribute_hidden;
Index: glibc-2.26/nscd/nscd_helper.c
===================================================================
--- glibc-2.26.orig/nscd/nscd_helper.c
+++ glibc-2.26/nscd/nscd_helper.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <stdint.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -34,10 +35,10 @@
#include <sys/uio.h>
#include <sys/un.h>
#include <not-cancel.h>
-#include <nis/rpcsvc/nis.h>
#include <kernel-features.h>
#include "nscd-client.h"
+#include "nscd_hash.h"
/* Extra time we wait if the socket is still receiving data. This
@@ -451,7 +452,7 @@ struct datahead *
__nscd_cache_search (request_type type, const char *key, size_t keylen,
const struct mapped_database *mapped, size_t datalen)
{
- unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
+ unsigned long int hash = __nscd_hash (key, keylen) % mapped->head->module;
size_t datasize = mapped->datasize;
ref_t trail = mapped->head->array[hash];

View File

@ -1,7 +1,7 @@
Index: glibc-2.18/nscd/nscd.conf Index: glibc-2.27/nscd/nscd.conf
=================================================================== ===================================================================
--- glibc-2.18.orig/nscd/nscd.conf --- glibc-2.27.orig/nscd/nscd.conf
+++ glibc-2.18/nscd/nscd.conf +++ glibc-2.27/nscd/nscd.conf
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
# logfile /var/log/nscd.log # logfile /var/log/nscd.log
# threads 4 # threads 4

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
Use /var/db for nss_db Use /var/db for nss_db
Index: glibc-2.17.90/Makeconfig Index: glibc-2.27/Makeconfig
=================================================================== ===================================================================
--- glibc-2.17.90.orig/Makeconfig --- glibc-2.27.orig/Makeconfig
+++ glibc-2.17.90/Makeconfig +++ glibc-2.27/Makeconfig
@@ -259,7 +259,7 @@ inst_sysconfdir = $(install_root)$(sysco @@ -245,7 +245,7 @@ inst_sysconfdir = $(install_root)$(sysco
# Directory for the database files and Makefile for nss_db. # Directory for the database files and Makefile for nss_db.
ifndef vardbdir ifndef vardbdir
@ -13,10 +13,10 @@ Index: glibc-2.17.90/Makeconfig
endif endif
inst_vardbdir = $(install_root)$(vardbdir) inst_vardbdir = $(install_root)$(vardbdir)
Index: glibc-2.17.90/nss/db-Makefile Index: glibc-2.27/nss/db-Makefile
=================================================================== ===================================================================
--- glibc-2.17.90.orig/nss/db-Makefile --- glibc-2.27.orig/nss/db-Makefile
+++ glibc-2.17.90/nss/db-Makefile +++ glibc-2.27/nss/db-Makefile
@@ -22,7 +22,7 @@ DATABASES = $(wildcard /etc/passwd /etc/ @@ -22,7 +22,7 @@ DATABASES = $(wildcard /etc/passwd /etc/
/etc/rpc /etc/services /etc/shadow /etc/gshadow \ /etc/rpc /etc/services /etc/shadow /etc/gshadow \
/etc/netgroup) /etc/netgroup)
@ -26,10 +26,10 @@ Index: glibc-2.17.90/nss/db-Makefile
AWK = awk AWK = awk
MAKEDB = makedb --quiet MAKEDB = makedb --quiet
Index: glibc-2.17.90/sysdeps/unix/sysv/linux/paths.h Index: glibc-2.27/sysdeps/unix/sysv/linux/paths.h
=================================================================== ===================================================================
--- glibc-2.17.90.orig/sysdeps/unix/sysv/linux/paths.h --- glibc-2.27.orig/sysdeps/unix/sysv/linux/paths.h
+++ glibc-2.17.90/sysdeps/unix/sysv/linux/paths.h +++ glibc-2.27/sysdeps/unix/sysv/linux/paths.h
@@ -68,7 +68,7 @@ @@ -68,7 +68,7 @@
/* Provide trailing slash, since mostly used for building pathnames. */ /* Provide trailing slash, since mostly used for building pathnames. */
#define _PATH_DEV "/dev/" #define _PATH_DEV "/dev/"

View File

@ -1,831 +0,0 @@
2017-10-11 Florian Weimer <fweimer@redhat.com>
[BZ #22078]
Avoid large NSS buffers with many addresses, aliases.
* nss/nss_files/files-hosts.c (gethostbyname3_multi): Rewrite
using dynarrays and struct alloc_buffer.
* nss/Makefile (tests): Add tst-nss-files-hosts-multi.
(tst-nss-files-hosts-multi): Link with -ldl.
* nss/tst-nss-files-hosts-multi.c: New file.
2017-10-11 Florian Weimer <fweimer@redhat.com>
[BZ #18023]
* nss/nss_files/files-hosts.c (gethostbyname3_multi): Use struct
scratch_buffer. Eliminate gotos.
2017-10-10 Florian Weimer <fweimer@redhat.com>
* nss/nss_files/files-hosts.c (gethostbyname3_multi): New
function.
(_nss_files_gethostbyname3_r): Call it.
Index: glibc-2.26/nss/Makefile
===================================================================
--- glibc-2.26.orig/nss/Makefile
+++ glibc-2.26/nss/Makefile
@@ -61,6 +61,7 @@ xtests = bug-erange
# Tests which need libdl
ifeq (yes,$(build-shared))
tests += tst-nss-files-hosts-erange
+tests += tst-nss-files-hosts-multi
endif
# If we have a thread library then we can test cancellation against
@@ -165,3 +166,4 @@ $(objpfx)tst-cancel-getpwuid_r: $(shared
endif
$(objpfx)tst-nss-files-hosts-erange: $(libdl)
+$(objpfx)tst-nss-files-hosts-multi: $(libdl)
Index: glibc-2.26/nss/nss_files/files-hosts.c
===================================================================
--- glibc-2.26.orig/nss/nss_files/files-hosts.c
+++ glibc-2.26/nss/nss_files/files-hosts.c
@@ -22,6 +22,8 @@
#include <arpa/nameser.h>
#include <netdb.h>
#include <resolv/resolv-internal.h>
+#include <scratch_buffer.h>
+#include <alloc_buffer.h>
/* Get implementation for some internal functions. */
@@ -110,228 +112,250 @@ DB_LOOKUP (hostbyaddr, ,,,
}, const void *addr, socklen_t len, int af)
#undef EXTRA_ARGS_VALUE
-enum nss_status
-_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
- char *buffer, size_t buflen, int *errnop,
- int *herrnop, int32_t *ttlp, char **canonp)
+/* Type of the address and alias arrays. */
+#define DYNARRAY_STRUCT array
+#define DYNARRAY_ELEMENT char *
+#define DYNARRAY_PREFIX array_
+#include <malloc/dynarray-skeleton.c>
+
+static enum nss_status
+gethostbyname3_multi (FILE * stream, const char *name, int af,
+ struct hostent *result, char *buffer, size_t buflen,
+ int *errnop, int *herrnop, int flags)
{
- FILE *stream = NULL;
- uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data);
- buffer += pad;
- buflen = buflen > pad ? buflen - pad : 0;
+ assert (af == AF_INET || af == AF_INET6);
- /* Open file. */
- enum nss_status status = internal_setent (&stream);
+ /* We have to get all host entries from the file. */
+ struct scratch_buffer tmp_buffer;
+ scratch_buffer_init (&tmp_buffer);
+ struct hostent tmp_result_buf;
+ struct array addresses;
+ array_init (&addresses);
+ struct array aliases;
+ array_init (&aliases);
+ enum nss_status status;
+
+ /* Preserve the addresses and aliases encountered so far. */
+ for (size_t i = 0; result->h_addr_list[i] != NULL; ++i)
+ array_add (&addresses, result->h_addr_list[i]);
+ for (size_t i = 0; result->h_aliases[i] != NULL; ++i)
+ array_add (&aliases, result->h_aliases[i]);
+
+ /* The output buffer re-uses now-unused space at the end of the
+ buffer, starting with the aliases array. It comes last in the
+ data produced by internal_getent. (The alias names themselves
+ are still located in the line read in internal_getent, which is
+ stored at the beginning of the buffer.) */
+ struct alloc_buffer outbuf;
+ {
+ char *bufferend = (char *) result->h_aliases;
+ outbuf = alloc_buffer_create (bufferend, buffer + buflen - bufferend);
+ }
- if (status == NSS_STATUS_SUCCESS)
+ while (true)
{
- /* XXX Is using _res to determine whether we want to convert IPv4
- addresses to IPv6 addresses really the right thing to do? */
- int flags = (res_use_inet6 () ? AI_V4MAPPED : 0);
-
- while ((status = internal_getent (stream, result, buffer, buflen, errnop,
- herrnop, af, flags))
- == NSS_STATUS_SUCCESS)
+ status = internal_getent (stream, &tmp_result_buf, tmp_buffer.data,
+ tmp_buffer.length, errnop, herrnop, af,
+ flags);
+ /* Enlarge the buffer if necessary. */
+ if (status == NSS_STATUS_TRYAGAIN && *herrnop == NETDB_INTERNAL
+ && *errnop == ERANGE)
{
- LOOKUP_NAME_CASE (h_name, h_aliases)
+ if (!scratch_buffer_grow (&tmp_buffer))
+ {
+ *errnop = ENOMEM;
+ /* *herrnop and status already have the right value. */
+ break;
+ }
+ /* Loop around and retry with a larger buffer. */
}
-
- if (status == NSS_STATUS_SUCCESS
- && _res_hconf.flags & HCONF_FLAG_MULTI)
+ else if (status == NSS_STATUS_SUCCESS)
{
- /* We have to get all host entries from the file. */
- size_t tmp_buflen = MIN (buflen, 4096);
- char tmp_buffer_stack[tmp_buflen]
- __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));
- char *tmp_buffer = tmp_buffer_stack;
- struct hostent tmp_result_buf;
- int naddrs = 1;
- int naliases = 0;
- char *bufferend;
- bool tmp_buffer_malloced = false;
-
- while (result->h_aliases[naliases] != NULL)
- ++naliases;
-
- bufferend = (char *) &result->h_aliases[naliases + 1];
-
- again:
- while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer,
- tmp_buflen, errnop, herrnop, af,
- flags))
- == NSS_STATUS_SUCCESS)
+ /* A line was read. Check that it matches the search
+ criteria. */
+
+ int matches = 1;
+ struct hostent *old_result = result;
+ result = &tmp_result_buf;
+ /* The following piece is a bit clumsy but we want to use
+ the `LOOKUP_NAME_CASE' value. The optimizer should do
+ its job. */
+ do
{
- int matches = 1;
- struct hostent *old_result = result;
- result = &tmp_result_buf;
- /* The following piece is a bit clumsy but we want to use the
- `LOOKUP_NAME_CASE' value. The optimizer should do its
- job. */
- do
- {
- LOOKUP_NAME_CASE (h_name, h_aliases)
- result = old_result;
- }
- while ((matches = 0));
+ LOOKUP_NAME_CASE (h_name, h_aliases)
+ result = old_result;
+ }
+ while ((matches = 0));
- if (matches)
+ /* If the line matches, we need to copy the addresses and
+ aliases, so that we can reuse tmp_buffer for the next
+ line. */
+ if (matches)
+ {
+ /* Record the addresses. */
+ for (size_t i = 0; tmp_result_buf.h_addr_list[i] != NULL; ++i)
{
- /* We could be very clever and try to recycle a few bytes
- in the buffer instead of generating new arrays. But
- we are not doing this here since it's more work than
- it's worth. Simply let the user provide a bit bigger
- buffer. */
- char **new_h_addr_list;
- char **new_h_aliases;
- int newaliases = 0;
- size_t newstrlen = 0;
- int cnt;
-
- /* Count the new aliases and the length of the strings. */
- while (tmp_result_buf.h_aliases[newaliases] != NULL)
+ /* Allocate the target space in the output buffer,
+ depending on the address family. */
+ void *target;
+ if (af == AF_INET)
{
- char *cp = tmp_result_buf.h_aliases[newaliases];
- ++newaliases;
- newstrlen += strlen (cp) + 1;
+ assert (tmp_result_buf.h_length == 4);
+ target = alloc_buffer_alloc (&outbuf, struct in_addr);
}
- /* If the real name is different add it also to the
- aliases. This means that there is a duplication
- in the alias list but this is really the user's
- problem. */
- if (strcmp (old_result->h_name,
- tmp_result_buf.h_name) != 0)
+ else if (af == AF_INET6)
{
- ++newaliases;
- newstrlen += strlen (tmp_result_buf.h_name) + 1;
+ assert (tmp_result_buf.h_length == 16);
+ target = alloc_buffer_alloc (&outbuf, struct in6_addr);
}
+ else
+ __builtin_unreachable ();
- /* Make sure bufferend is aligned. */
- assert ((bufferend - (char *) 0) % sizeof (char *) == 0);
-
- /* Now we can check whether the buffer is large enough.
- 16 is the maximal size of the IP address. */
- if (bufferend + 16 + (naddrs + 2) * sizeof (char *)
- + roundup (newstrlen, sizeof (char *))
- + (naliases + newaliases + 1) * sizeof (char *)
- >= buffer + buflen)
+ if (target == NULL)
{
+ /* Request a larger output buffer. */
*errnop = ERANGE;
*herrnop = NETDB_INTERNAL;
status = NSS_STATUS_TRYAGAIN;
- goto out;
- }
-
- new_h_addr_list =
- (char **) (bufferend
- + roundup (newstrlen, sizeof (char *))
- + 16);
- new_h_aliases =
- (char **) ((char *) new_h_addr_list
- + (naddrs + 2) * sizeof (char *));
-
- /* Copy the old data in the new arrays. */
- for (cnt = 0; cnt < naddrs; ++cnt)
- new_h_addr_list[cnt] = old_result->h_addr_list[cnt];
-
- for (cnt = 0; cnt < naliases; ++cnt)
- new_h_aliases[cnt] = old_result->h_aliases[cnt];
-
- /* Store the new strings. */
- cnt = 0;
- while (tmp_result_buf.h_aliases[cnt] != NULL)
- {
- new_h_aliases[naliases++] = bufferend;
- bufferend = (__stpcpy (bufferend,
- tmp_result_buf.h_aliases[cnt])
- + 1);
- ++cnt;
+ break;
}
-
- if (cnt < newaliases)
- {
- new_h_aliases[naliases++] = bufferend;
- bufferend = __stpcpy (bufferend,
- tmp_result_buf.h_name) + 1;
- }
-
- /* Final NULL pointer. */
- new_h_aliases[naliases] = NULL;
-
- /* Round up the buffer end address. */
- bufferend += (sizeof (char *)
- - ((bufferend - (char *) 0)
- % sizeof (char *))) % sizeof (char *);
-
- /* Now the new address. */
- new_h_addr_list[naddrs++] =
- memcpy (bufferend, tmp_result_buf.h_addr,
- tmp_result_buf.h_length);
-
- /* Also here a final NULL pointer. */
- new_h_addr_list[naddrs] = NULL;
-
- /* Store the new array pointers. */
- old_result->h_aliases = new_h_aliases;
- old_result->h_addr_list = new_h_addr_list;
-
- /* Compute the new buffer end. */
- bufferend = (char *) &new_h_aliases[naliases + 1];
- assert (bufferend <= buffer + buflen);
-
- result = old_result;
+ memcpy (target, tmp_result_buf.h_addr_list[i],
+ tmp_result_buf.h_length);
+ array_add (&addresses, target);
}
- }
- if (status == NSS_STATUS_TRYAGAIN)
- {
- size_t newsize = 2 * tmp_buflen;
- if (tmp_buffer_malloced)
+ /* Record the aliases. */
+ for (size_t i = 0; tmp_result_buf.h_aliases[i] != NULL; ++i)
{
- char *newp = realloc (tmp_buffer, newsize);
- if (newp != NULL)
- {
- assert ((((uintptr_t) newp)
- & (__alignof__ (struct hostent_data) - 1))
- == 0);
- tmp_buffer = newp;
- tmp_buflen = newsize;
- goto again;
- }
+ char *alias = tmp_result_buf.h_aliases[i];
+ array_add (&aliases,
+ alloc_buffer_copy_string (&outbuf, alias));
}
- else if (!__libc_use_alloca (buflen + newsize))
+
+ /* If the real name is different add, it also to the
+ aliases. This means that there is a duplication in
+ the alias list but this is really the user's
+ problem. */
+ {
+ char *new_name = tmp_result_buf.h_name;
+ if (strcmp (old_result->h_name, new_name) != 0)
+ array_add (&aliases,
+ alloc_buffer_copy_string (&outbuf, new_name));
+ }
+
+ /* Report memory allocation failures during the
+ expansion of the temporary arrays. */
+ if (array_has_failed (&addresses) || array_has_failed (&aliases))
{
- tmp_buffer = malloc (newsize);
- if (tmp_buffer != NULL)
- {
- assert ((((uintptr_t) tmp_buffer)
- & (__alignof__ (struct hostent_data) - 1))
- == 0);
- tmp_buffer_malloced = true;
- tmp_buflen = newsize;
- goto again;
- }
+ *errnop = ENOMEM;
+ *herrnop = NETDB_INTERNAL;
+ status = NSS_STATUS_UNAVAIL;
+ break;
}
- else
+
+ /* Request a larger output buffer if we ran out of room. */
+ if (alloc_buffer_has_failed (&outbuf))
{
- tmp_buffer
- = extend_alloca (tmp_buffer, tmp_buflen,
- newsize
- + __alignof__ (struct hostent_data));
- tmp_buffer = (char *) (((uintptr_t) tmp_buffer
- + __alignof__ (struct hostent_data)
- - 1)
- & ~(__alignof__ (struct hostent_data)
- - 1));
- goto again;
+ *errnop = ERANGE;
+ *herrnop = NETDB_INTERNAL;
+ status = NSS_STATUS_TRYAGAIN;
+ break;
}
- }
- else
- status = NSS_STATUS_SUCCESS;
- out:
- if (tmp_buffer_malloced)
- free (tmp_buffer);
+
+ result = old_result;
+ } /* If match was found. */
+
+ /* If no match is found, loop around and fetch another
+ line. */
+
+ } /* status == NSS_STATUS_SUCCESS. */
+ else
+ /* internal_getent returned an error. */
+ break;
+ } /* while (true) */
+
+ /* Propagate the NSS_STATUS_TRYAGAIN error to the caller. It means
+ that we may not have loaded the complete result.
+ NSS_STATUS_NOTFOUND, however, means that we reached the end of
+ the file successfully. */
+ if (status != NSS_STATUS_TRYAGAIN)
+ status = NSS_STATUS_SUCCESS;
+
+ if (status == NSS_STATUS_SUCCESS)
+ {
+ /* Copy the address and alias arrays into the output buffer and
+ add NULL terminators. The pointed-to elements were directly
+ written into the output buffer above and do not need to be
+ copied again. */
+ size_t addresses_count = array_size (&addresses);
+ size_t aliases_count = array_size (&aliases);
+ char **out_addresses = alloc_buffer_alloc_array
+ (&outbuf, char *, addresses_count + 1);
+ char **out_aliases = alloc_buffer_alloc_array
+ (&outbuf, char *, aliases_count + 1);
+ if (out_addresses == NULL || out_aliases == NULL)
+ {
+ /* The output buffer is not large enough. */
+ *errnop = ERANGE;
+ *herrnop = NETDB_INTERNAL;
+ status = NSS_STATUS_TRYAGAIN;
+ /* Fall through to function exit. */
+ }
+ else
+ {
+ /* Everything is allocated in place. Make the copies and
+ adjust the array pointers. */
+ memcpy (out_addresses, array_begin (&addresses),
+ addresses_count * sizeof (char *));
+ out_addresses[addresses_count] = NULL;
+ memcpy (out_aliases, array_begin (&aliases),
+ aliases_count * sizeof (char *));
+ out_aliases[aliases_count] = NULL;
+
+ result->h_addr_list = out_addresses;
+ result->h_aliases = out_aliases;
+
+ status = NSS_STATUS_SUCCESS;
+ }
+ }
+
+ scratch_buffer_free (&tmp_buffer);
+ array_free (&addresses);
+ array_free (&aliases);
+ return status;
+}
+
+enum nss_status
+_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen, int *errnop,
+ int *herrnop, int32_t *ttlp, char **canonp)
+{
+ FILE *stream = NULL;
+ uintptr_t pad = -(uintptr_t) buffer % __alignof__ (struct hostent_data);
+ buffer += pad;
+ buflen = buflen > pad ? buflen - pad : 0;
+
+ /* Open file. */
+ enum nss_status status = internal_setent (&stream);
+
+ if (status == NSS_STATUS_SUCCESS)
+ {
+ /* XXX Is using _res to determine whether we want to convert IPv4
+ addresses to IPv6 addresses really the right thing to do? */
+ int flags = (res_use_inet6 () ? AI_V4MAPPED : 0);
+
+ while ((status = internal_getent (stream, result, buffer, buflen, errnop,
+ herrnop, af, flags))
+ == NSS_STATUS_SUCCESS)
+ {
+ LOOKUP_NAME_CASE (h_name, h_aliases)
}
+ if (status == NSS_STATUS_SUCCESS
+ && _res_hconf.flags & HCONF_FLAG_MULTI)
+ status = gethostbyname3_multi
+ (stream, name, af, result, buffer, buflen, errnop, herrnop, flags);
+
internal_endent (&stream);
}
Index: glibc-2.26/nss/tst-nss-files-hosts-multi.c
===================================================================
--- /dev/null
+++ glibc-2.26/nss/tst-nss-files-hosts-multi.c
@@ -0,0 +1,331 @@
+/* Parse /etc/hosts in multi mode with many addresses/aliases.
+ 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 <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/check_nss.h>
+#include <support/namespace.h>
+#include <support/support.h>
+#include <support/test-driver.h>
+#include <support/test-driver.h>
+#include <support/xmemstream.h>
+#include <support/xstdio.h>
+#include <support/xunistd.h>
+#include <sys/resource.h>
+
+struct support_chroot *chroot_env;
+
+static void
+prepare (int argc, char **argv)
+{
+ chroot_env = support_chroot_create
+ ((struct support_chroot_configuration)
+ {
+ .resolv_conf = "",
+ .hosts = "", /* See write_hosts below. */
+ .host_conf = "multi on\n",
+ });
+}
+
+/* Create the /etc/hosts file from outside the chroot. */
+static void
+write_hosts (int count)
+{
+ TEST_VERIFY (count > 0 && count <= 65535);
+ FILE *fp = xfopen (chroot_env->path_hosts, "w");
+ fputs ("127.0.0.1 localhost localhost.localdomain\n"
+ "::1 localhost localhost.localdomain\n",
+ fp);
+ for (int i = 0; i < count; ++i)
+ {
+ fprintf (fp, "10.4.%d.%d www4.example.com\n",
+ (i / 256) & 0xff, i & 0xff);
+ fprintf (fp, "10.46.%d.%d www.example.com\n",
+ (i / 256) & 0xff, i & 0xff);
+ fprintf (fp, "192.0.2.1 alias.example.com v4-%d.example.com\n", i);
+ fprintf (fp, "2001:db8::6:%x www6.example.com\n", i);
+ fprintf (fp, "2001:db8::46:%x www.example.com\n", i);
+ fprintf (fp, "2001:db8::1 alias.example.com v6-%d.example.com\n", i);
+ }
+ xfclose (fp);
+}
+
+/* Parameters of a single test. */
+struct test_params
+{
+ const char *name; /* Name to query. */
+ const char *marker; /* Address marker for the name. */
+ int count; /* Number of addresses/aliases. */
+ int family; /* AF_INET, AF_INET_6 or AF_UNSPEC. */
+ bool canonname; /* True if AI_CANONNAME should be enabled. */
+};
+
+/* Expected result of gethostbyname/gethostbyname2. */
+static char *
+expected_ghbn (const struct test_params *params)
+{
+ TEST_VERIFY (params->family == AF_INET || params->family == AF_INET6);
+
+ struct xmemstream expected;
+ xopen_memstream (&expected);
+ if (strcmp (params->name, "alias.example.com") == 0)
+ {
+ fprintf (expected.out, "name: %s\n", params->name);
+ char af;
+ if (params->family == AF_INET)
+ af = '4';
+ else
+ af = '6';
+ for (int i = 0; i < params->count; ++i)
+ fprintf (expected.out, "alias: v%c-%d.example.com\n", af, i);
+
+ for (int i = 0; i < params->count; ++i)
+ if (params->family == AF_INET)
+ fputs ("address: 192.0.2.1\n", expected.out);
+ else
+ fputs ("address: 2001:db8::1\n", expected.out);
+ }
+ else /* www/www4/www6 name. */
+ {
+ bool do_ipv4 = params->family == AF_INET
+ && strncmp (params->name, "www6", 4) != 0;
+ bool do_ipv6 = params->family == AF_INET6
+ && strncmp (params->name, "www4", 4) != 0;
+ if (do_ipv4 || do_ipv6)
+ {
+ fprintf (expected.out, "name: %s\n", params->name);
+ if (do_ipv4)
+ for (int i = 0; i < params->count; ++i)
+ fprintf (expected.out, "address: 10.%s.%d.%d\n",
+ params->marker, i / 256, i % 256);
+ if (do_ipv6)
+ for (int i = 0; i < params->count; ++i)
+ fprintf (expected.out, "address: 2001:db8::%s:%x\n",
+ params->marker, i);
+ }
+ else
+ fputs ("error: HOST_NOT_FOUND\n", expected.out);
+ }
+ xfclose_memstream (&expected);
+ return expected.buffer;
+}
+
+/* Expected result of getaddrinfo. */
+static char *
+expected_gai (const struct test_params *params)
+{
+ bool do_ipv4 = false;
+ bool do_ipv6 = false;
+ if (params->family == AF_UNSPEC)
+ do_ipv4 = do_ipv6 = true;
+ else if (params->family == AF_INET)
+ do_ipv4 = true;
+ else if (params->family == AF_INET6)
+ do_ipv6 = true;
+
+ struct xmemstream expected;
+ xopen_memstream (&expected);
+ if (strcmp (params->name, "alias.example.com") == 0)
+ {
+ if (params->canonname)
+ fprintf (expected.out,
+ "flags: AI_CANONNAME\n"
+ "canonname: %s\n",
+ params->name);
+
+ if (do_ipv4)
+ for (int i = 0; i < params->count; ++i)
+ fputs ("address: STREAM/TCP 192.0.2.1 80\n", expected.out);
+ if (do_ipv6)
+ for (int i = 0; i < params->count; ++i)
+ fputs ("address: STREAM/TCP 2001:db8::1 80\n", expected.out);
+ }
+ else /* www/www4/www6 name. */
+ {
+ if (strncmp (params->name, "www4", 4) == 0)
+ do_ipv6 = false;
+ else if (strncmp (params->name, "www6", 4) == 0)
+ do_ipv4 = false;
+ /* Otherwise, we have www as the name, so we do both. */
+
+ if (do_ipv4 || do_ipv6)
+ {
+ if (params->canonname)
+ fprintf (expected.out,
+ "flags: AI_CANONNAME\n"
+ "canonname: %s\n",
+ params->name);
+
+ if (do_ipv4)
+ for (int i = 0; i < params->count; ++i)
+ fprintf (expected.out, "address: STREAM/TCP 10.%s.%d.%d 80\n",
+ params->marker, i / 256, i % 256);
+ if (do_ipv6)
+ for (int i = 0; i < params->count; ++i)
+ fprintf (expected.out,
+ "address: STREAM/TCP 2001:db8::%s:%x 80\n",
+ params->marker, i);
+ }
+ else
+ fputs ("error: Name or service not known\n", expected.out);
+ }
+ xfclose_memstream (&expected);
+ return expected.buffer;
+}
+
+static void
+run_gbhn_gai (struct test_params *params)
+{
+ char *ctx = xasprintf ("name=%s marker=%s count=%d family=%d",
+ params->name, params->marker, params->count,
+ params->family);
+ if (test_verbose > 0)
+ printf ("info: %s\n", ctx);
+
+ /* Check gethostbyname, gethostbyname2. */
+ if (params->family == AF_INET)
+ {
+ char *expected = expected_ghbn (params);
+ check_hostent (ctx, gethostbyname (params->name), expected);
+ free (expected);
+ }
+ if (params->family != AF_UNSPEC)
+ {
+ char *expected = expected_ghbn (params);
+ check_hostent (ctx, gethostbyname2 (params->name, params->family),
+ expected);
+ free (expected);
+ }
+
+ /* Check getaddrinfo. */
+ for (int do_canonical = 0; do_canonical < 2; ++do_canonical)
+ {
+ params->canonname = do_canonical;
+ char *expected = expected_gai (params);
+ struct addrinfo hints =
+ {
+ .ai_family = params->family,
+ .ai_socktype = SOCK_STREAM,
+ .ai_protocol = IPPROTO_TCP,
+ };
+ if (do_canonical)
+ hints.ai_flags |= AI_CANONNAME;
+ struct addrinfo *ai;
+ int ret = getaddrinfo (params->name, "80", &hints, &ai);
+ check_addrinfo (ctx, ai, ret, expected);
+ if (ret == 0)
+ freeaddrinfo (ai);
+ free (expected);
+ }
+
+ free (ctx);
+}
+
+/* Callback for the subprocess which runs the test in a chroot. */
+static void
+subprocess (void *closure)
+{
+ struct test_params *params = closure;
+
+ xchroot (chroot_env->path_chroot);
+
+ static const int families[] = { AF_INET, AF_INET6, AF_UNSPEC, -1 };
+ static const char *const names[] =
+ {
+ "www.example.com", "www4.example.com", "www6.example.com",
+ "alias.example.com",
+ NULL
+ };
+ static const char *const names_marker[] = { "46", "4", "6", "" };
+
+ for (int family_idx = 0; families[family_idx] >= 0; ++family_idx)
+ {
+ params->family = families[family_idx];
+ for (int names_idx = 0; names[names_idx] != NULL; ++names_idx)
+ {
+ params->name = names[names_idx];
+ params->marker = names_marker[names_idx];
+ run_gbhn_gai (params);
+ }
+ }
+}
+
+/* Run the test for a specific number of addresses/aliases. */
+static void
+run_test (int count)
+{
+ write_hosts (count);
+
+ struct test_params params =
+ {
+ .count = count,
+ };
+
+ support_isolate_in_subprocess (subprocess, &params);
+}
+
+static int
+do_test (void)
+{
+ support_become_root ();
+ if (!support_can_chroot ())
+ return EXIT_UNSUPPORTED;
+
+ /* This test should not use gigabytes of memory. */
+ {
+ struct rlimit limit;
+ if (getrlimit (RLIMIT_AS, &limit) != 0)
+ {
+ printf ("getrlimit (RLIMIT_AS) failed: %m\n");
+ return 1;
+ }
+ long target = 200 * 1024 * 1024;
+ if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target)
+ {
+ limit.rlim_cur = target;
+ if (setrlimit (RLIMIT_AS, &limit) != 0)
+ {
+ printf ("setrlimit (RLIMIT_AS) failed: %m\n");
+ return 1;
+ }
+ }
+ }
+
+ __nss_configure_lookup ("hosts", "files");
+ if (dlopen (LIBNSS_FILES_SO, RTLD_LAZY) == NULL)
+ FAIL_EXIT1 ("could not load " LIBNSS_DNS_SO ": %s", dlerror ());
+
+ /* Run the tests with a few different address/alias counts. */
+ for (int count = 1; count <= 111; ++count)
+ run_test (count);
+ run_test (1111);
+ run_test (22222);
+
+ support_chroot_free (chroot_env);
+ return 0;
+}
+
+#define PREPARE prepare
+#include <support/test-driver.c>

View File

@ -11,10 +11,10 @@ Properly reread entry after failure in nss_files getent function (bug 18991)
(_nss_files_getaliasent_r): Likewise. Reposition stream if last (_nss_files_getaliasent_r): Likewise. Reposition stream if last
call was uncessful. call was uncessful.
Index: glibc-2.19/nss/nss_files/files-XXX.c Index: glibc-2.27/nss/nss_files/files-XXX.c
=================================================================== ===================================================================
--- glibc-2.19.orig/nss/nss_files/files-XXX.c --- glibc-2.27.orig/nss/nss_files/files-XXX.c
+++ glibc-2.19/nss/nss_files/files-XXX.c +++ glibc-2.27/nss/nss_files/files-XXX.c
@@ -65,6 +65,10 @@ __libc_lock_define_initialized (static, @@ -65,6 +65,10 @@ __libc_lock_define_initialized (static,
getXXbyYY operations all use their own stream. */ getXXbyYY operations all use their own stream. */
@ -26,7 +26,7 @@ Index: glibc-2.19/nss/nss_files/files-XXX.c
/* Open database file if not already opened. */ /* Open database file if not already opened. */
static enum nss_status static enum nss_status
@@ -131,6 +135,15 @@ CONCAT(_nss_files_set,ENTNAME) (int stay @@ -96,6 +100,15 @@ CONCAT(_nss_files_set,ENTNAME) (int stay
status = internal_setent (&stream); status = internal_setent (&stream);
@ -42,7 +42,7 @@ Index: glibc-2.19/nss/nss_files/files-XXX.c
__libc_lock_unlock (lock); __libc_lock_unlock (lock);
return status; return status;
@@ -286,11 +299,42 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct @@ -251,11 +264,42 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct
status = internal_setent (&stream); status = internal_setent (&stream);
__set_errno (save_errno); __set_errno (save_errno);
@ -54,11 +54,9 @@ Index: glibc-2.19/nss/nss_files/files-XXX.c
+ status = NSS_STATUS_UNAVAIL; + status = NSS_STATUS_UNAVAIL;
+ } + }
+ need_reread = false; + need_reread = false;
} + }
+
if (status == NSS_STATUS_SUCCESS) + if (status == NSS_STATUS_SUCCESS)
- status = internal_getent (stream, result, buffer, buflen, errnop
- H_ERRNO_ARG EXTRA_ARGS_VALUE);
+ { + {
+ /* Reposition the stream if the last call was unsucessful. */ + /* Reposition the stream if the last call was unsucessful. */
+ if (need_reread) + if (need_reread)
@ -68,9 +66,11 @@ Index: glibc-2.19/nss/nss_files/files-XXX.c
+ else + else
+ need_reread = false; + need_reread = false;
+ } + }
+ } }
+
+ if (status == NSS_STATUS_SUCCESS) if (status == NSS_STATUS_SUCCESS)
- status = internal_getent (stream, result, buffer, buflen, errnop
- H_ERRNO_ARG EXTRA_ARGS_VALUE);
+ { + {
+ status = internal_getent (stream, result, buffer, buflen, errnop + status = internal_getent (stream, result, buffer, buflen, errnop
+ H_ERRNO_ARG EXTRA_ARGS_VALUE); + H_ERRNO_ARG EXTRA_ARGS_VALUE);
@ -87,10 +87,10 @@ Index: glibc-2.19/nss/nss_files/files-XXX.c
__libc_lock_unlock (lock); __libc_lock_unlock (lock);
Index: glibc-2.19/nss/nss_files/files-alias.c Index: glibc-2.27/nss/nss_files/files-alias.c
=================================================================== ===================================================================
--- glibc-2.19.orig/nss/nss_files/files-alias.c --- glibc-2.27.orig/nss/nss_files/files-alias.c
+++ glibc-2.19/nss/nss_files/files-alias.c +++ glibc-2.27/nss/nss_files/files-alias.c
@@ -38,6 +38,10 @@ __libc_lock_define_initialized (static, @@ -38,6 +38,10 @@ __libc_lock_define_initialized (static,
getXXbyYY operations all use their own stream. */ getXXbyYY operations all use their own stream. */
@ -102,7 +102,7 @@ Index: glibc-2.19/nss/nss_files/files-alias.c
static enum nss_status static enum nss_status
@@ -104,6 +108,15 @@ _nss_files_setaliasent (void) @@ -69,6 +73,15 @@ _nss_files_setaliasent (void)
status = internal_setent (&stream); status = internal_setent (&stream);
@ -118,7 +118,7 @@ Index: glibc-2.19/nss/nss_files/files-alias.c
__libc_lock_unlock (lock); __libc_lock_unlock (lock);
return status; return status;
@@ -388,7 +401,29 @@ _nss_files_getaliasent_r (struct aliasen @@ -353,7 +366,29 @@ _nss_files_getaliasent_r (struct aliasen
/* Be prepared that the set*ent function was not called before. */ /* Be prepared that the set*ent function was not called before. */
if (stream == NULL) if (stream == NULL)
@ -149,7 +149,7 @@ Index: glibc-2.19/nss/nss_files/files-alias.c
if (status == NSS_STATUS_SUCCESS) if (status == NSS_STATUS_SUCCESS)
{ {
@@ -398,6 +433,12 @@ _nss_files_getaliasent_r (struct aliasen @@ -363,6 +398,12 @@ _nss_files_getaliasent_r (struct aliasen
do do
status = get_next_alias (stream, NULL, result, buffer, buflen, errnop); status = get_next_alias (stream, NULL, result, buffer, buflen, errnop);
while (status == NSS_STATUS_RETURN); while (status == NSS_STATUS_RETURN);

View File

@ -1,41 +0,0 @@
2016-02-11 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/elision-conf.c
(elision_init): Further restrict enablement based
on whether GLIBC_ELISION_ENABLE=yes is in the env.
---
sysdeps/unix/sysv/linux/powerpc/elision-conf.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
Index: glibc-2.22/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
===================================================================
--- glibc-2.22.orig/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
+++ glibc-2.22/sysdeps/unix/sysv/linux/powerpc/elision-conf.c
@@ -21,6 +21,7 @@
#include <elision-conf.h>
#include <unistd.h>
#include <dl-procinfo.h>
+#include <string.h>
/* Reasonable initial tuning values, may be revised in the future.
This is a conservative initial value. */
@@ -61,7 +62,18 @@ elision_init (int argc __attribute__ ((u
{
#ifdef ENABLE_LOCK_ELISION
int elision_available = (GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_HTM) ? 1 : 0;
- __pthread_force_elision = __libc_enable_secure ? 0 : elision_available;
+
+ /* Scan the environment and conditionally enable TLE. */
+ if (elision_available != 0 && __libc_enable_secure == 0)
+ {
+ for ( ; *environ != NULL; environ++)
+ if (**environ == 'G' &&
+ strcmp (*environ,"GLIBC_ELISION_ENABLE=yes") == 0)
+ {
+ __pthread_force_elision = elision_available;
+ break;
+ }
+ }
#endif
if (!__pthread_force_elision)
/* Disable elision on rwlocks. */

View File

@ -1,15 +0,0 @@
2017-11-17 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* sysdeps/powerpc/bits/hwcap.h (PPC_FEATURE2_HTM_NO_SUSPEND): New
macro.
Index: glibc-2.26/sysdeps/powerpc/bits/hwcap.h
===================================================================
--- glibc-2.26.orig/sysdeps/powerpc/bits/hwcap.h
+++ glibc-2.26/sysdeps/powerpc/bits/hwcap.h
@@ -72,3 +72,5 @@
128-bit */
#define PPC_FEATURE2_DARN 0x00200000 /* darn instruction. */
#define PPC_FEATURE2_SCV 0x00100000 /* scv syscall. */
+#define PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended
+ state. */

View File

@ -1,207 +0,0 @@
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"

View File

@ -1,44 +0,0 @@
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;

View File

@ -1,53 +0,0 @@
2017-08-09 Florian Weimer <fweimer@redhat.com>
[BZ #21932]
* nss/getXXbyYY_r.c (REENTRANT_NAME): Call __resolv_context_put
before early return.
2017-08-03 Florian Weimer <fweimer@redhat.com>
[BZ #21885]
* sysdeps/posix/getaddrinfo.c (gethosts): Release resolver context
on memory allocation failure.
Index: glibc-2.26/nss/getXXbyYY_r.c
===================================================================
--- glibc-2.26.orig/nss/getXXbyYY_r.c
+++ glibc-2.26/nss/getXXbyYY_r.c
@@ -234,6 +234,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L
H_ERRNO_VAR_P))
{
case -1:
+# ifdef NEED__RES
+ __resolv_context_put (res_ctx);
+# endif
return errno;
case 1:
#ifdef NEED_H_ERRNO
@@ -253,7 +256,12 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, L
nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
H_ERRNO_VAR);
if (nscd_status >= 0)
- return nscd_status;
+ {
+# ifdef NEED__RES
+ __resolv_context_put (res_ctx);
+# endif
+ return nscd_status;
+ }
}
#endif
Index: glibc-2.26/sysdeps/posix/getaddrinfo.c
===================================================================
--- glibc-2.26.orig/sysdeps/posix/getaddrinfo.c
+++ glibc-2.26/sysdeps/posix/getaddrinfo.c
@@ -255,6 +255,8 @@ convert_hostent_to_gaih_addrtuple (const
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; \
} \

27
riscv-readelflib.patch Normal file
View File

@ -0,0 +1,27 @@
2018-02-09 DJ Delorie <dj@redhat.com>
[BZ #22827]
* sysdeps/unix/sysv/linux/riscv/readelflib.c (process_elf_file): Use
64-bit ELF type for 64-bit ELF objects.
Index: glibc-2.27/sysdeps/unix/sysv/linux/riscv/readelflib.c
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/riscv/readelflib.c
+++ glibc-2.27/sysdeps/unix/sysv/linux/riscv/readelflib.c
@@ -43,6 +43,7 @@ process_elf_file (const char *file_name,
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
+ Elf64_Ehdr *elf64_header = (Elf64_Ehdr *) elf_header;
int ret;
long flags;
@@ -59,7 +60,7 @@ process_elf_file (const char *file_name,
{
ret = process_elf64_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
- flags = elf32_header->e_flags;
+ flags = elf64_header->e_flags;
}
/* RISC-V linkers encode the floating point ABI as part of the ELF headers. */

View File

@ -1,31 +0,0 @@
Index: glibc-2.25/sysdeps/unix/sysv/linux/s390/elision-conf.c
===================================================================
--- glibc-2.25.orig/sysdeps/unix/sysv/linux/s390/elision-conf.c
+++ glibc-2.25/sysdeps/unix/sysv/linux/s390/elision-conf.c
@@ -21,6 +21,7 @@
#include <elision-conf.h>
#include <unistd.h>
#include <dl-procinfo.h>
+#include <string.h>
/* Reasonable initial tuning values, may be revised in the future.
This is a conservative initial value. */
@@ -64,7 +65,17 @@ elision_init (int argc __attribute__ ((u
When false elision is never attempted. */
int elision_available = (GLRO (dl_hwcap) & HWCAP_S390_TE) ? 1 : 0;
- __pthread_force_elision = __libc_enable_secure ? 0 : elision_available;
+ /* Scan the environment and conditionally enable TLE. */
+ if (elision_available != 0 && __libc_enable_secure == 0)
+ {
+ for ( ; *environ != NULL; environ++)
+ if (**environ == 'G'
+ && strcmp (*environ, "GLIBC_ELISION_ENABLE=yes") == 0)
+ {
+ __pthread_force_elision = elision_available;
+ break;
+ }
+ }
}
#ifdef SHARED

View File

@ -1,71 +0,0 @@
2017-10-23 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Use 0 instead of
WNOHANG in waitpid call.
2017-10-20 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #22273]
* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Handle the case where
the auxiliary process is terminated by a signal before calling _exit
or execve.
Index: glibc-2.26/sysdeps/unix/sysv/linux/spawni.c
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/spawni.c
+++ glibc-2.26/sysdeps/unix/sysv/linux/spawni.c
@@ -17,7 +17,6 @@
<http://www.gnu.org/licenses/>. */
#include <spawn.h>
-#include <assert.h>
#include <fcntl.h>
#include <paths.h>
#include <string.h>
@@ -268,7 +267,6 @@ __spawni_child (void *arguments)
__sigprocmask (SIG_SETMASK, (attr->__flags & POSIX_SPAWN_SETSIGMASK)
? &attr->__ss : &args->oldmask, 0);
- args->err = 0;
args->exec (args->file, args->argv, args->envp);
/* This is compatibility function required to enable posix_spawn run
@@ -339,7 +337,7 @@ __spawnix (pid_t * pid, const char *file
/* Child must set args.err to something non-negative - we rely on
the parent and child sharing VM. */
- args.err = -1;
+ args.err = 0;
args.file = file;
args.exec = exec;
args.fa = file_actions;
@@ -362,12 +360,26 @@ __spawnix (pid_t * pid, const char *file
new_pid = CLONE (__spawni_child, STACK (stack, stack_size), stack_size,
CLONE_VM | CLONE_VFORK | SIGCHLD, &args);
+ /* It needs to collect the case where the auxiliary process was created
+ but failed to execute the file (due either any preparation step or
+ for execve itself). */
if (new_pid > 0)
{
+ /* Also, it handles the unlikely case where the auxiliary process was
+ terminated before calling execve as if it was successfully. The
+ args.err is set to 0 as default and changed to a positive value
+ only in case of failure, so in case of premature termination
+ due a signal args.err will remain zeroed and it will be up to
+ caller to actually collect it. */
ec = args.err;
- assert (ec >= 0);
- if (ec != 0)
- __waitpid (new_pid, NULL, 0);
+ if (ec > 0)
+ /* There still an unlikely case where the child is cancelled after
+ setting args.err, due to a positive error value. Also there is
+ possible pid reuse race (where the kernel allocated the same pid
+ to an unrelated process). Unfortunately due synchronization
+ issues where the kernel might not have the process collected
+ the waitpid below can not use WNOHANG. */
+ __waitpid (new_pid, NULL, 0);
}
else
ec = -new_pid;

View File

@ -1,125 +0,0 @@
2017-10-20 Florian Weimer <fweimer@redhat.com>
[BZ #22321]
sysconf: Fix missing definition of UIO_MAXIOV on Linux.
* sysdeps/posix/sysconf.c: Include <sys/uio.h>.
* sysdeps/unix/sysv/linux/Makefile (tests): Add tst-sysconf-iov_max.
(tst-sysconf-iov_max): Link with tst-sysconf-iov_max-uapi.o.
* sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c: New file.
* sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c: Likewise.
Index: glibc-2.26/sysdeps/posix/sysconf.c
===================================================================
--- glibc-2.26.orig/sysdeps/posix/sysconf.c
+++ glibc-2.26/sysdeps/posix/sysconf.c
@@ -29,6 +29,7 @@
#include <sys/stat.h>
#include <sys/sysinfo.h>
#include <sys/types.h>
+#include <sys/uio.h>
#include <regex.h>
#define NEED_SPEC_ARRAY 0
Index: glibc-2.26/sysdeps/unix/sysv/linux/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/unix/sysv/linux/Makefile
+++ glibc-2.26/sysdeps/unix/sysv/linux/Makefile
@@ -50,7 +50,7 @@ sysdep_headers += sys/mount.h sys/acct.h
bits/siginfo-arch.h bits/siginfo-consts-arch.h
tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
- tst-quota tst-sync_file_range test-errno-linux
+ tst-quota tst-sync_file_range test-errno-linux tst-sysconf-iov_max
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
@@ -120,7 +120,11 @@ ifndef no_deps
-include $(objpfx)bits/syscall.d
endif
generated += bits/syscall.h bits/syscall.d
-endif
+
+# Separate object file for access to the constant from the UAPI header.
+$(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
+
+endif # $(subdir) == misc
ifeq ($(subdir),time)
sysdep_headers += sys/timex.h bits/timex.h
Index: glibc-2.26/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/unix/sysv/linux/tst-sysconf-iov_max-uapi.c
@@ -0,0 +1,27 @@
+/* Check IOV_MAX definition: Helper function to capture UAPI header value.
+ 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/>. */
+
+/* Use a separate function to avoid header compatibility issues. */
+
+#include <linux/uio.h>
+
+long
+uio_maxiov_value (void)
+{
+ return UIO_MAXIOV;
+}
Index: glibc-2.26/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/unix/sysv/linux/tst-sysconf-iov_max.c
@@ -0,0 +1,40 @@
+/* Check IOV_MAX definition for consistency (bug 22321).
+ 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/>. */
+
+/* Defined in tst-sysconf-iov_max-uapi.c. */
+long uio_maxiov_value (void);
+
+
+#include <limits.h>
+#include <support/check.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+ TEST_VERIFY (_XOPEN_IOV_MAX == 16); /* Value required by POSIX. */
+ TEST_VERIFY (uio_maxiov_value () >= _XOPEN_IOV_MAX);
+ TEST_VERIFY (IOV_MAX == uio_maxiov_value ());
+ TEST_VERIFY (UIO_MAXIOV == uio_maxiov_value ());
+ TEST_VERIFY (sysconf (_SC_UIO_MAXIOV) == uio_maxiov_value ());
+ TEST_VERIFY (sysconf (_SC_IOV_MAX) == uio_maxiov_value ());
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -1,171 +0,0 @@
2017-08-03 Alan Modra <amodra@gmail.com>
* sysdeps/powerpc/mod-tlsopt-powerpc.c: Extract from
tst-tlsopt-powerpc.c with function name change and no test harness.
* sysdeps/powerpc/tst-tlsopt-powerpc.c: Remove body of test.
Call tls_get_addr_opt_test.
* sysdeps/powerpc/Makefile (LDFLAGS-tst-tlsopt-powerpc): Don't define.
(modules-names): Add mod-tlsopt-powerpc.
(mod-tlsopt-powerpc.so-no-z-defs): Define.
(tst-tlsopt-powerpc): Depend on .so.
* sysdeps/powerpc/powerpc64/tls-macros.h (__TLS_GET_ADDR): Don't
define. Expand use in TLS_GD and TLS_LD.
Index: glibc-2.26/sysdeps/powerpc/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/powerpc/Makefile
+++ glibc-2.26/sysdeps/powerpc/Makefile
@@ -8,9 +8,11 @@ sysdep-dl-routines += dl-machine hwcapin
sysdep_routines += dl-machine hwcapinfo
# extra shared linker files to link only into dl-allobjs.so
sysdep-rtld-routines += dl-machine hwcapinfo
-# Don't optimize GD tls sequence to LE.
-LDFLAGS-tst-tlsopt-powerpc += -Wl,--no-tls-optimize
+
+modules-names += mod-tlsopt-powerpc
+mod-tlsopt-powerpc.so-no-z-defs = yes
tests += tst-tlsopt-powerpc
+$(objpfx)tst-tlsopt-powerpc: $(objpfx)mod-tlsopt-powerpc.so
ifneq (no,$(multi-arch))
tests-static += tst-tlsifunc-static
Index: glibc-2.26/sysdeps/powerpc/mod-tlsopt-powerpc.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/powerpc/mod-tlsopt-powerpc.c
@@ -0,0 +1,49 @@
+/* shared library to test for __tls_get_addr optimization. */
+#include <stdio.h>
+
+#include "../../elf/tls-macros.h"
+#include "dl-tls.h"
+
+/* common 'int' variable in TLS. */
+COMMON_INT_DEF(foo);
+
+
+int
+tls_get_addr_opt_test (void)
+{
+ int result = 0;
+
+ /* Get variable using general dynamic model. */
+ int *ap = TLS_GD (foo);
+ if (*ap != 0)
+ {
+ printf ("foo = %d\n", *ap);
+ result = 1;
+ }
+
+ tls_index *tls_arg;
+#ifdef __powerpc64__
+ register unsigned long thread_pointer __asm__ ("r13");
+ asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
+#else
+ register unsigned long thread_pointer __asm__ ("r2");
+ asm ("bcl 20,31,1f\n1:\t"
+ "mflr %0\n\t"
+ "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"
+ "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"
+ "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg));
+#endif
+
+ if (tls_arg->ti_module != 0)
+ {
+ printf ("tls_index not optimized, binutils too old?\n");
+ result = 1;
+ }
+ else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap)
+ {
+ printf ("tls_index->ti_offset wrong value\n");
+ result = 1;
+ }
+
+ return result;
+}
Index: glibc-2.26/sysdeps/powerpc/powerpc64/tls-macros.h
===================================================================
--- glibc-2.26.orig/sysdeps/powerpc/powerpc64/tls-macros.h
+++ glibc-2.26/sysdeps/powerpc/powerpc64/tls-macros.h
@@ -18,13 +18,11 @@
__result; \
})
-#define __TLS_GET_ADDR "__tls_get_addr"
-
/* PowerPC64 Local Dynamic TLS access. */
#define TLS_LD(x) \
({ int * __result; \
asm ("addi 3,2," #x "@got@tlsld\n\t" \
- "bl " __TLS_GET_ADDR "\n\t" \
+ "bl __tls_get_addr\n\t" \
"nop \n\t" \
"addis %0,3," #x "@dtprel@ha\n\t" \
"addi %0,%0," #x "@dtprel@l" \
@@ -36,7 +34,7 @@
#define TLS_GD(x) \
({ register int *__result __asm__ ("r3"); \
asm ("addi 3,2," #x "@got@tlsgd\n\t" \
- "bl " __TLS_GET_ADDR "\n\t" \
+ "bl __tls_get_addr\n\t" \
"nop " \
: "=r" (__result) : \
: __TLS_CALL_CLOBBERS); \
Index: glibc-2.26/sysdeps/powerpc/tst-tlsopt-powerpc.c
===================================================================
--- glibc-2.26.orig/sysdeps/powerpc/tst-tlsopt-powerpc.c
+++ glibc-2.26/sysdeps/powerpc/tst-tlsopt-powerpc.c
@@ -1,51 +1,11 @@
/* glibc test for __tls_get_addr optimization. */
-#include <stdio.h>
-
-#include "../../elf/tls-macros.h"
-#include "dl-tls.h"
-
-/* common 'int' variable in TLS. */
-COMMON_INT_DEF(foo);
-
static int
do_test (void)
{
- int result = 0;
-
- /* Get variable using general dynamic model. */
- int *ap = TLS_GD (foo);
- if (*ap != 0)
- {
- printf ("foo = %d\n", *ap);
- result = 1;
- }
-
- tls_index *tls_arg;
-#ifdef __powerpc64__
- register unsigned long thread_pointer __asm__ ("r13");
- asm ("addi %0,2,foo@got@tlsgd" : "=r" (tls_arg));
-#else
- register unsigned long thread_pointer __asm__ ("r2");
- asm ("bcl 20,31,1f\n1:\t"
- "mflr %0\n\t"
- "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t"
- "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t"
- "addi %0,%0,foo@got@tlsgd" : "=b" (tls_arg));
-#endif
-
- if (tls_arg->ti_module != 0)
- {
- printf ("tls_index not optimized, binutils too old?\n");
- result = 1;
- }
- else if (tls_arg->ti_offset + thread_pointer != (unsigned long) ap)
- {
- printf ("tls_index->ti_offset wrong value\n");
- result = 1;
- }
+ extern int tls_get_addr_opt_test (void);
- return result;
+ return tls_get_addr_opt_test ();
}
#include <support/test-driver.c>

View File

@ -1,196 +0,0 @@
2017-10-26 Valery Reznic <valery_reznic@yahoo.com>
H.J. Lu <hongjiu.lu@intel.com>
[BZ #22299]
* sysdeps/x86/cpu-features.c (init_cpu_features): Don't set
GLRO(dl_platform) to NULL.
* sysdeps/x86_64/Makefile (tests): Add tst-platform-1.
(modules-names): Add tst-platformmod-1 and
x86_64/tst-platformmod-2.
(CFLAGS-tst-platform-1.c): New.
(CFLAGS-tst-platformmod-1.c): Likewise.
(CFLAGS-tst-platformmod-2.c): Likewise.
(LDFLAGS-tst-platformmod-2.so): Likewise.
($(objpfx)tst-platform-1): Likewise.
($(objpfx)tst-platform-1.out): Likewise.
(tst-platform-1-ENV): Likewise.
($(objpfx)x86_64/tst-platformmod-2.os): Likewise.
* sysdeps/x86_64/tst-platform-1.c: New file.
* sysdeps/x86_64/tst-platformmod-1.c: Likewise.
* sysdeps/x86_64/tst-platformmod-2.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
@@ -389,7 +389,6 @@ no_cpuid:
#endif
/* Reuse dl_platform, dl_hwcap and dl_hwcap_mask for x86. */
- GLRO(dl_platform) = NULL;
#if !HAVE_TUNABLES && defined SHARED
/* The glibc.tune.hwcap_mask tunable is initialized already, so no need to do
this. */
@@ -400,13 +399,15 @@ no_cpuid:
GLRO(dl_hwcap) = HWCAP_X86_64;
if (cpu_features->kind == arch_kind_intel)
{
+ const char *platform = NULL;
+
if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
&& CPU_FEATURES_CPU_P (cpu_features, AVX512CD))
{
if (CPU_FEATURES_CPU_P (cpu_features, AVX512ER))
{
if (CPU_FEATURES_CPU_P (cpu_features, AVX512PF))
- GLRO(dl_platform) = "xeon_phi";
+ platform = "xeon_phi";
}
else
{
@@ -417,7 +418,7 @@ no_cpuid:
}
}
- if (GLRO(dl_platform) == NULL
+ if (platform == NULL
&& CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable)
&& CPU_FEATURES_ARCH_P (cpu_features, FMA_Usable)
&& CPU_FEATURES_CPU_P (cpu_features, BMI1)
@@ -425,7 +426,10 @@ no_cpuid:
&& CPU_FEATURES_CPU_P (cpu_features, LZCNT)
&& CPU_FEATURES_CPU_P (cpu_features, MOVBE)
&& CPU_FEATURES_CPU_P (cpu_features, POPCNT))
- GLRO(dl_platform) = "haswell";
+ platform = "haswell";
+
+ if (platform != NULL)
+ GLRO(dl_platform) = platform;
}
#else
GLRO(dl_hwcap) = 0;
Index: glibc-2.26/sysdeps/x86_64/Makefile
===================================================================
--- glibc-2.26.orig/sysdeps/x86_64/Makefile
+++ glibc-2.26/sysdeps/x86_64/Makefile
@@ -62,6 +62,21 @@ endif
$(objpfx)tst-x86_64-1: $(objpfx)x86_64/tst-x86_64mod-1.so
+ifneq (no,$(have-tunables))
+tests += tst-platform-1
+modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
+CFLAGS-tst-platform-1.c = -mno-avx
+CFLAGS-tst-platformmod-1.c = -mno-avx
+CFLAGS-tst-platformmod-2.c = -mno-avx
+LDFLAGS-tst-platformmod-2.so = -Wl,-soname,tst-platformmod-2.so
+$(objpfx)tst-platform-1: $(objpfx)tst-platformmod-1.so
+$(objpfx)tst-platform-1.out: $(objpfx)x86_64/tst-platformmod-2.so
+# Turn off AVX512F_Usable and AVX2_Usable so that GLRO(dl_platform) is
+# always set to x86_64.
+tst-platform-1-ENV = LD_PRELOAD=$(objpfx)\$$PLATFORM/tst-platformmod-2.so \
+ GLIBC_TUNABLES=glibc.tune.hwcaps=-AVX512F_Usable,-AVX2_Usable
+endif
+
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 \
@@ -143,3 +158,8 @@ do-tests-clean common-mostlyclean: tst-x
.PHONY: tst-x86_64-1-clean
tst-x86_64-1-clean:
-rm -rf $(objpfx)x86_64
+
+$(objpfx)x86_64/tst-platformmod-2.os: $(objpfx)tst-platformmod-2.os
+ $(make-target-directory)
+ rm -f $@
+ ln $< $@
Index: glibc-2.26/sysdeps/x86_64/tst-platform-1.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/x86_64/tst-platform-1.c
@@ -0,0 +1,29 @@
+/* Test PRELOAD with $PLATFORM.
+ 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 <stdlib.h>
+
+extern int preload (void);
+
+static int
+do_test (void)
+{
+ return preload () == 0x1234 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+#include <support/test-driver.c>
Index: glibc-2.26/sysdeps/x86_64/tst-platformmod-1.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/x86_64/tst-platformmod-1.c
@@ -0,0 +1,23 @@
+/* Test PRELOAD with $PLATFORM.
+ 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/>. */
+
+int
+preload (void)
+{
+ return 0;
+}
Index: glibc-2.26/sysdeps/x86_64/tst-platformmod-2.c
===================================================================
--- /dev/null
+++ glibc-2.26/sysdeps/x86_64/tst-platformmod-2.c
@@ -0,0 +1,23 @@
+/* Test PRELOAD with $PLATFORM.
+ 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/>. */
+
+int
+preload (void)
+{
+ return 0x1234;
+}