From c2c4c8048294acab9e6b6a31c57d1acc25ad1d72c6e3f5a30a5b7c9260ecb0b5 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 6 Aug 2018 15:01:59 +0000 Subject: [PATCH 1/8] Accepting request 627715 from home:Andreas_Schwab:Factory - Update to glibc 2.28 * The localization data for ISO 14651 is updated to match the 2016 Edition 4 release of the standard, this matches data provided by Unicode 9.0.0 * Unicode 11.0.0 Support: Character encoding, character type info, and transliteration tables are all updated to Unicode 11.0.0, using generator scripts contributed by Mike FABIAN (Red Hat) * functions that round their results to a narrower type are added from TS 18661-1:2014 and TS 18661-3:2015 * Two grammatical forms of month names are now supported * The renameat2 function has been added, a variant of the renameat function which has a flags argument * The statx function has been added, a variant of the fstatat64 function with an additional flags argument * IDN domain names in getaddrinfo and getnameinfo now use the system libidn2 library if installed * Parsing of dynamic string tokens in DT_RPATH, DT_RUNPATH, DT_NEEDED, DT_AUXILIARY, and DT_FILTER has been expanded to support the full range of ELF gABI expressions including such constructs as '$ORIGIN$ORIGIN' (if valid) * Support for ISO C threads (ISO/IEC 9899:2011) has been added. * The nonstandard header files and <_G_config.h> are no longer installed * The stdio functions 'getc' and 'putc' are no longer defined as macros * All stdio functions now treat end-of-file as a sticky condition * The macros 'major', 'minor', and 'makedev' are now only available from the header * The obsolete function ustat is no longer available to newly linked binaries; the headers and have been removed * The obsolete function nfsservctl is no longer available to newly linked OBS-URL: https://build.opensuse.org/request/show/627715 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=509 --- aarch64-sys-ptrace-update.patch | 30 -- crypt_blowfish-1.2-hack_around_arm.diff | 9 - crypt_blowfish-1.2-sha.diff | 174 ----------- crypt_blowfish-1.3.tar.gz | 3 - crypt_blowfish-const.patch | 46 --- crypt_blowfish-gensalt.patch | 373 ----------------------- fix-locking-in-_IO_cleanup.patch | 26 +- fnmatch-collating-elements.patch | 19 +- glibc-2.14-crypt.diff | 98 ------ glibc-2.27.tar.xz | 3 - glibc-2.27.tar.xz.sig | 16 - glibc-2.28.tar.xz | 3 + glibc-2.28.tar.xz.sig | 16 + glibc.changes | 60 ++++ glibc.spec | 137 ++------- glibc_post_upgrade.c | 138 +-------- i386-memmove-sse2-unaligned.patch | 149 --------- i386-sigaction-sa-restorer.patch | 281 ----------------- mempcpy-avx512.patch | 42 --- netgroup-cache-keys.patch | 19 -- nss-database-multiple-dfn.patch | 89 ------ pkey-get-reserved-name.patch | 19 -- powerpc-sys-ptrace-undefine-macros.patch | 59 ---- powerpc-sys-ptrace-update.patch | 95 ------ realpath-ssize-max-overflow.patch | 129 -------- res-send-enomem.patch | 20 -- riscv-fmax-fmin-nan.patch | 112 ------- riscv-kernel-sigaction.patch | 17 -- riscv-readelflib.patch | 27 -- riscv-tls-init.patch | 51 ---- 30 files changed, 137 insertions(+), 2123 deletions(-) delete mode 100644 aarch64-sys-ptrace-update.patch delete mode 100644 crypt_blowfish-1.2-hack_around_arm.diff delete mode 100644 crypt_blowfish-1.2-sha.diff delete mode 100644 crypt_blowfish-1.3.tar.gz delete mode 100644 crypt_blowfish-const.patch delete mode 100644 crypt_blowfish-gensalt.patch delete mode 100644 glibc-2.14-crypt.diff delete mode 100644 glibc-2.27.tar.xz delete mode 100644 glibc-2.27.tar.xz.sig create mode 100644 glibc-2.28.tar.xz create mode 100644 glibc-2.28.tar.xz.sig delete mode 100644 i386-memmove-sse2-unaligned.patch delete mode 100644 i386-sigaction-sa-restorer.patch delete mode 100644 mempcpy-avx512.patch delete mode 100644 netgroup-cache-keys.patch delete mode 100644 nss-database-multiple-dfn.patch delete mode 100644 pkey-get-reserved-name.patch delete mode 100644 powerpc-sys-ptrace-undefine-macros.patch delete mode 100644 powerpc-sys-ptrace-update.patch delete mode 100644 realpath-ssize-max-overflow.patch delete mode 100644 res-send-enomem.patch delete mode 100644 riscv-fmax-fmin-nan.patch delete mode 100644 riscv-kernel-sigaction.patch delete mode 100644 riscv-readelflib.patch delete mode 100644 riscv-tls-init.patch diff --git a/aarch64-sys-ptrace-update.patch b/aarch64-sys-ptrace-update.patch deleted file mode 100644 index bea5aa1..0000000 --- a/aarch64-sys-ptrace-update.patch +++ /dev/null @@ -1,30 +0,0 @@ -2018-02-10 Dmitry V. Levin - - [BZ #22433] - * sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request): - Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS, - and PTRACE_SETHBPREGS. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h -+++ glibc-2.27/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h -@@ -78,18 +78,10 @@ enum __ptrace_request - PTRACE_DETACH = 17, - #define PT_DETACH PTRACE_DETACH - -- PTRACE_GET_THREAD_AREA = 22, -- - /* Continue and stop at the next entry to or return from syscall. */ - PTRACE_SYSCALL = 24, - #define PT_SYSCALL PTRACE_SYSCALL - -- /* Get all hardware breakpoint registers. */ -- PTRACE_GETHBPREGS = 29, -- -- /* Set all hardware breakpoint registers. */ -- PTRACE_SETHBPREGS = 30, -- - /* Set ptrace filter options. */ - PTRACE_SETOPTIONS = 0x4200, - #define PT_SETOPTIONS PTRACE_SETOPTIONS diff --git a/crypt_blowfish-1.2-hack_around_arm.diff b/crypt_blowfish-1.2-hack_around_arm.diff deleted file mode 100644 index 3beb8ea..0000000 --- a/crypt_blowfish-1.2-hack_around_arm.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- x86.S -+++ x86.S -@@ -199,5 +199,5 @@ - #endif - - #if defined(__ELF__) && defined(__linux__) --.section .note.GNU-stack,"",@progbits -+.section .note.GNU-stack,"",%progbits - #endif diff --git a/crypt_blowfish-1.2-sha.diff b/crypt_blowfish-1.2-sha.diff deleted file mode 100644 index d7a5ce9..0000000 --- a/crypt_blowfish-1.2-sha.diff +++ /dev/null @@ -1,174 +0,0 @@ -From 1c581a8364ab18a6938f3153d7bea793d06a4652 Mon Sep 17 00:00:00 2001 -From: Ludwig Nussel -Date: Thu, 25 Aug 2011 14:00:38 +0200 -Subject: [PATCH crypt_blowfish] support for sha256 and sha512 - ---- - crypt.3 | 14 +++++++++++++ - crypt_gensalt.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - wrapper.c | 23 +++++++++++++++++++++ - 3 files changed, 95 insertions(+), 0 deletions(-) - -Index: crypt_blowfish-1.3/crypt.3 -=================================================================== ---- crypt_blowfish-1.3.orig/crypt.3 -+++ crypt_blowfish-1.3/crypt.3 -@@ -399,6 +399,20 @@ too low for the currently available hard - .hash "$1$" "\e$1\e$[^$]{1,8}\e$[./0-9A-Za-z]{22}" unlimited 8 "" 128 "6 to 48" 1000 - .PP - .ti -2 -+.B SHA256 based -+.br -+This is Ulrich Drepper's SHA256-based password hashing method originally -+developed for Linux. -+.hash "$5$" "\e$5\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{43}" unlimited 8 "" 256 "0 to 96" "1000 to 999999999 (default 5000)" -+.PP -+.ti -2 -+.B SHA512 based -+.br -+This is Ulrich Drepper's SHA512-based password hashing method originally -+developed for Linux. -+.hash "$6$" "\e$6\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{86}" unlimited 8 "" 512 "0 to 96" "1000 to 999999999 (default 5000)" -+.PP -+.ti -2 - .BR "OpenBSD-style Blowfish-based" " (" bcrypt ) - .br - .B bcrypt -Index: crypt_blowfish-1.3/crypt_gensalt.c -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_gensalt.c -+++ crypt_blowfish-1.3/crypt_gensalt.c -@@ -19,6 +19,7 @@ - */ - - #include -+#include - - #include - #ifndef __set_errno -@@ -122,3 +123,60 @@ char *_crypt_gensalt_md5_rn(const char * - - return output; - } -+ -+#define SHA2_SALT_LEN_MAX 16 -+#define SHA2_ROUNDS_MIN 1000 -+#define SHA2_ROUNDS_MAX 999999999 -+char *_crypt_gensalt_sha2_rn (const char *prefix, unsigned long count, -+ const char *input, int size, char *output, int output_size) -+ -+{ -+ char *o = output; -+ const char *i = input; -+ unsigned needed = 3 + MIN(size/3*4, SHA2_SALT_LEN_MAX) + 1; -+ -+ if (size < 3 || output_size < needed) -+ goto error; -+ -+ size = MIN(size, SHA2_SALT_LEN_MAX/4*3); -+ -+ o[0] = prefix[0]; -+ o[1] = prefix[1]; -+ o[2] = prefix[2]; -+ o += 3; -+ -+ if (count) { -+ count = MAX(SHA2_ROUNDS_MIN, MIN(count, SHA2_ROUNDS_MAX)); -+ int n = snprintf (o, output_size-3, "rounds=%ld$", count); -+ if (n < 0 || n >= output_size-3) -+ goto error; -+ needed += n; -+ o += n; -+ } -+ -+ if (output_size < needed) -+ goto error; -+ -+ while (size >= 3) { -+ unsigned long value = -+ (unsigned long)(unsigned char)i[0] | -+ ((unsigned long)(unsigned char)i[1] << 8) | -+ ((unsigned long)(unsigned char)i[2] << 16); -+ o[0] = _crypt_itoa64[value & 0x3f]; -+ o[1] = _crypt_itoa64[(value >> 6) & 0x3f]; -+ o[2] = _crypt_itoa64[(value >> 12) & 0x3f]; -+ o[3] = _crypt_itoa64[(value >> 18) & 0x3f]; -+ size -= 3; -+ i += 3; -+ o += 3; -+ } -+ o[0] = '\0'; -+ -+ return output; -+ -+error: -+ if (output_size > 0) -+ output[0] = '\0'; -+ errno = ENOMEM; -+ return NULL; -+} -Index: crypt_blowfish-1.3/crypt_gensalt.h -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_gensalt.h -+++ crypt_blowfish-1.3/crypt_gensalt.h -@@ -26,5 +26,7 @@ extern char *_crypt_gensalt_extended_rn( - const char *input, int size, char *output, int output_size); - extern char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count, - const char *input, int size, char *output, int output_size); -+extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count, -+ const char *input, int size, char *output, int output_size); - - #endif -Index: crypt_blowfish-1.3/wrapper.c -=================================================================== ---- crypt_blowfish-1.3.orig/wrapper.c -+++ crypt_blowfish-1.3/wrapper.c -@@ -50,6 +50,10 @@ - #include "crypt.h" - extern char *__md5_crypt_r(const char *key, const char *salt, - char *buffer, int buflen); -+extern char *__sha256_crypt_r (const char *key, const char *salt, -+ char *buffer, int buflen); -+extern char *__sha512_crypt_r (const char *key, const char *salt, -+ char *buffer, int buflen); - /* crypt-entry.c needs to be patched to define __des_crypt_r rather than - * __crypt_r, and not define crypt_r and crypt at all */ - extern char *__des_crypt_r(const char *key, const char *salt, -@@ -112,6 +116,10 @@ static char *_crypt_retval_magic(char *r - char *__crypt_rn(__const char *key, __const char *setting, - void *data, int size) - { -+ if (setting[0] == '$' && setting[1] == '6') -+ return __sha512_crypt_r(key, setting, (char *)data, size); -+ if (setting[0] == '$' && setting[1] == '5') -+ return __sha256_crypt_r(key, setting, (char *)data, size); - if (setting[0] == '$' && setting[1] == '2') - return _crypt_blowfish_rn(key, setting, (char *)data, size); - if (setting[0] == '$' && setting[1] == '1') -@@ -129,6 +137,16 @@ char *__crypt_rn(__const char *key, __co - char *__crypt_ra(__const char *key, __const char *setting, - void **data, int *size) - { -+ if (setting[0] == '$' && setting[1] == '6') { -+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE)) -+ return NULL; -+ return __sha512_crypt_r(key, setting, (char *)*data, *size); -+ } -+ if (setting[0] == '$' && setting[1] == '5') { -+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE)) -+ return NULL; -+ return __sha256_crypt_r(key, setting, (char *)*data, *size); -+ } - if (setting[0] == '$' && setting[1] == '2') { - if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE)) - return NULL; -@@ -210,6 +228,9 @@ char *__crypt_gensalt_rn(const char *pre - return NULL; - } - -+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3)) -+ use = _crypt_gensalt_sha2_rn; -+ else - if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) || - !strncmp(prefix, "$2y$", 4)) - use = _crypt_gensalt_blowfish_rn; diff --git a/crypt_blowfish-1.3.tar.gz b/crypt_blowfish-1.3.tar.gz deleted file mode 100644 index fcb0aed..0000000 --- a/crypt_blowfish-1.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:83fa01fca6996fe8d882b7f8e9ba0305a5664936100b01481ea3c6a8ce8d72fd -size 30310 diff --git a/crypt_blowfish-const.patch b/crypt_blowfish-const.patch deleted file mode 100644 index 0d4a8d0..0000000 --- a/crypt_blowfish-const.patch +++ /dev/null @@ -1,46 +0,0 @@ -Index: crypt_blowfish-1.2/crypt_blowfish.c -=================================================================== ---- crypt_blowfish-1.2.orig/crypt_blowfish.c -+++ crypt_blowfish-1.2/crypt_blowfish.c -@@ -81,7 +81,7 @@ typedef struct { - * Magic IV for 64 Blowfish encryptions that we do at the end. - * The string is "OrpheanBeholderScryDoubt" on big-endian. - */ --static BF_word BF_magic_w[6] = { -+static const BF_word BF_magic_w[6] = { - 0x4F727068, 0x65616E42, 0x65686F6C, - 0x64657253, 0x63727944, 0x6F756274 - }; -@@ -89,7 +89,7 @@ static BF_word BF_magic_w[6] = { - /* - * P-box and S-box tables initialized with digits of Pi. - */ --static BF_ctx BF_init_state = { -+static const BF_ctx BF_init_state = { - { - { - 0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, -@@ -361,10 +361,10 @@ static BF_ctx BF_init_state = { - } - }; - --static unsigned char BF_itoa64[64 + 1] = -+static const unsigned char BF_itoa64[64 + 1] = - "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - --static unsigned char BF_atoi64[0x60] = { -+static const unsigned char BF_atoi64[0x60] = { - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64, - 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, -@@ -440,8 +440,8 @@ static void BF_encode(char *dst, const B - - static void BF_swap(BF_word *x, int count) - { -- static int endianness_check = 1; -- char *is_little_endian = (char *)&endianness_check; -+ static const int endianness_check = 1; -+ const char *is_little_endian = (const char *)&endianness_check; - BF_word tmp; - - if (*is_little_endian) diff --git a/crypt_blowfish-gensalt.patch b/crypt_blowfish-gensalt.patch deleted file mode 100644 index 9d1dd87..0000000 --- a/crypt_blowfish-gensalt.patch +++ /dev/null @@ -1,373 +0,0 @@ -Index: crypt_blowfish-1.3/crypt_blowfish.c -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_blowfish.c -+++ crypt_blowfish-1.3/crypt_blowfish.c -@@ -877,31 +877,3 @@ char *_crypt_blowfish_rn(const char *key - __set_errno(EINVAL); /* pretend we don't support this hash type */ - return NULL; - } -- --char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count, -- const char *input, int size, char *output, int output_size) --{ -- if (size < 16 || output_size < 7 + 22 + 1 || -- (count && (count < 4 || count > 31)) || -- prefix[0] != '$' || prefix[1] != '2' || -- (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) { -- if (output_size > 0) output[0] = '\0'; -- __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL); -- return NULL; -- } -- -- if (!count) count = 5; -- -- output[0] = '$'; -- output[1] = '2'; -- output[2] = prefix[2]; -- output[3] = '$'; -- output[4] = '0' + count / 10; -- output[5] = '0' + count % 10; -- output[6] = '$'; -- -- BF_encode(&output[7], (const BF_word *)input, 16); -- output[7 + 22] = '\0'; -- -- return output; --} -Index: crypt_blowfish-1.3/crypt_blowfish.h -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_blowfish.h -+++ crypt_blowfish-1.3/crypt_blowfish.h -@@ -20,8 +20,5 @@ - extern int _crypt_output_magic(const char *setting, char *output, int size); - extern char *_crypt_blowfish_rn(const char *key, const char *setting, - char *output, int size); --extern char *_crypt_gensalt_blowfish_rn(const char *prefix, -- unsigned long count, -- const char *input, int size, char *output, int output_size); - - #endif -Index: crypt_blowfish-1.3/crypt_gensalt.c -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_gensalt.c -+++ crypt_blowfish-1.3/crypt_gensalt.c -@@ -20,6 +20,7 @@ - - #include - #include -+#include - - #include - #ifndef __set_errno -@@ -180,3 +181,69 @@ error: - errno = ENOMEM; - return NULL; - } -+ -+ -+typedef unsigned int BF_word; -+ -+static const unsigned char BF_itoa64[64 + 1] = -+ "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; -+ -+static void BF_encode(char *dst, const BF_word *src, int size) -+{ -+ const unsigned char *sptr = (const unsigned char *)src; -+ const unsigned char *end = sptr + size; -+ unsigned char *dptr = (unsigned char *)dst; -+ unsigned int c1, c2; -+ -+ do { -+ c1 = *sptr++; -+ *dptr++ = BF_itoa64[c1 >> 2]; -+ c1 = (c1 & 0x03) << 4; -+ if (sptr >= end) { -+ *dptr++ = BF_itoa64[c1]; -+ break; -+ } -+ -+ c2 = *sptr++; -+ c1 |= c2 >> 4; -+ *dptr++ = BF_itoa64[c1]; -+ c1 = (c2 & 0x0f) << 2; -+ if (sptr >= end) { -+ *dptr++ = BF_itoa64[c1]; -+ break; -+ } -+ -+ c2 = *sptr++; -+ c1 |= c2 >> 6; -+ *dptr++ = BF_itoa64[c1]; -+ *dptr++ = BF_itoa64[c2 & 0x3f]; -+ } while (sptr < end); -+} -+ -+char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count, -+ const char *input, int size, char *output, int output_size) -+{ -+ if (size < 16 || output_size < 7 + 22 + 1 || -+ (count && (count < 4 || count > 31)) || -+ prefix[0] != '$' || prefix[1] != '2' || -+ (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) { -+ if (output_size > 0) output[0] = '\0'; -+ __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL); -+ return NULL; -+ } -+ -+ if (!count) count = 5; -+ -+ output[0] = '$'; -+ output[1] = '2'; -+ output[2] = prefix[2]; -+ output[3] = '$'; -+ output[4] = '0' + count / 10; -+ output[5] = '0' + count % 10; -+ output[6] = '$'; -+ -+ BF_encode(&output[7], (const BF_word *)input, 16); -+ output[7 + 22] = '\0'; -+ -+ return output; -+} -Index: crypt_blowfish-1.3/crypt_gensalt.h -=================================================================== ---- crypt_blowfish-1.3.orig/crypt_gensalt.h -+++ crypt_blowfish-1.3/crypt_gensalt.h -@@ -28,5 +28,8 @@ extern char *_crypt_gensalt_md5_rn(const - const char *input, int size, char *output, int output_size); - extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count, - const char *input, int size, char *output, int output_size); -+extern char *_crypt_gensalt_blowfish_rn(const char *prefix, -+ unsigned long count, -+ const char *input, int size, char *output, int output_size); - - #endif -Index: crypt_blowfish-1.3/wrapper-gensalt.c -=================================================================== ---- /dev/null -+++ crypt_blowfish-1.3/wrapper-gensalt.c -@@ -0,0 +1,114 @@ -+/* -+ * Written by Solar Designer in 2000-2011. -+ * No copyright is claimed, and the software is hereby placed in the public -+ * domain. In case this attempt to disclaim copyright and place the software -+ * in the public domain is deemed null and void, then the software is -+ * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the -+ * general public under the following terms: -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted. -+ * -+ * There's ABSOLUTELY NO WARRANTY, express or implied. -+ * -+ * See crypt_blowfish.c for more information. -+ */ -+ -+#include -+#include -+ -+#include -+#ifndef __set_errno -+#define __set_errno(val) errno = (val) -+#endif -+ -+#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1) -+ -+#if defined(__GLIBC__) && defined(_LIBC) -+#define __SKIP_GNU -+#endif -+#include "ow-crypt.h" -+ -+#include "crypt_gensalt.h" -+ -+#if !(defined(__GLIBC__) && defined(_LIBC)) -+#define __crypt_gensalt_rn crypt_gensalt_rn -+#define __crypt_gensalt_ra crypt_gensalt_ra -+#define __crypt_gensalt crypt_gensalt -+#endif -+ -+char *__crypt_gensalt_rn(const char *prefix, unsigned long count, -+ const char *input, int size, char *output, int output_size) -+{ -+ char *(*use)(const char *_prefix, unsigned long _count, -+ const char *_input, int _size, -+ char *_output, int _output_size); -+ -+ /* This may be supported on some platforms in the future */ -+ if (!input) { -+ __set_errno(EINVAL); -+ return NULL; -+ } -+ -+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3)) -+ use = _crypt_gensalt_sha2_rn; -+ else -+ if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) || -+ !strncmp(prefix, "$2y$", 4)) -+ use = _crypt_gensalt_blowfish_rn; -+ else -+ if (!strncmp(prefix, "$1$", 3)) -+ use = _crypt_gensalt_md5_rn; -+ else -+ if (prefix[0] == '_') -+ use = _crypt_gensalt_extended_rn; -+ else -+ if (!prefix[0] || -+ (prefix[0] && prefix[1] && -+ memchr(_crypt_itoa64, prefix[0], 64) && -+ memchr(_crypt_itoa64, prefix[1], 64))) -+ use = _crypt_gensalt_traditional_rn; -+ else { -+ __set_errno(EINVAL); -+ return NULL; -+ } -+ -+ return use(prefix, count, input, size, output, output_size); -+} -+ -+char *__crypt_gensalt_ra(const char *prefix, unsigned long count, -+ const char *input, int size) -+{ -+ char output[CRYPT_GENSALT_OUTPUT_SIZE]; -+ char *retval; -+ -+ retval = __crypt_gensalt_rn(prefix, count, -+ input, size, output, sizeof(output)); -+ -+ if (retval) { -+ retval = strdup(retval); -+#ifndef __GLIBC__ -+ /* strdup(3) on glibc sets errno, so we don't need to bother */ -+ if (!retval) -+ __set_errno(ENOMEM); -+#endif -+ } -+ -+ return retval; -+} -+ -+char *__crypt_gensalt(const char *prefix, unsigned long count, -+ const char *input, int size) -+{ -+ static char output[CRYPT_GENSALT_OUTPUT_SIZE]; -+ -+ return __crypt_gensalt_rn(prefix, count, -+ input, size, output, sizeof(output)); -+} -+ -+#if defined(__GLIBC__) && defined(_LIBC) -+weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn) -+weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra) -+weak_alias(__crypt_gensalt, crypt_gensalt) -+#endif -+ -Index: crypt_blowfish-1.3/wrapper.c -=================================================================== ---- crypt_blowfish-1.3.orig/wrapper.c -+++ crypt_blowfish-1.3/wrapper.c -@@ -35,7 +35,6 @@ - #endif - - #define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1) --#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1) - - #if defined(__GLIBC__) && defined(_LIBC) - #define __SKIP_GNU -@@ -43,7 +42,6 @@ - #include "ow-crypt.h" - - #include "crypt_blowfish.h" --#include "crypt_gensalt.h" - - #if defined(__GLIBC__) && defined(_LIBC) - /* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */ -@@ -209,89 +207,11 @@ char *crypt(const char *key, const char - crypt_rn(key, setting, output, sizeof(output)), - setting, output, sizeof(output)); - } -- --#define __crypt_gensalt_rn crypt_gensalt_rn --#define __crypt_gensalt_ra crypt_gensalt_ra --#define __crypt_gensalt crypt_gensalt --#endif -- --char *__crypt_gensalt_rn(const char *prefix, unsigned long count, -- const char *input, int size, char *output, int output_size) --{ -- char *(*use)(const char *_prefix, unsigned long _count, -- const char *_input, int _size, -- char *_output, int _output_size); -- -- /* This may be supported on some platforms in the future */ -- if (!input) { -- __set_errno(EINVAL); -- return NULL; -- } -- -- if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3)) -- use = _crypt_gensalt_sha2_rn; -- else -- if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) || -- !strncmp(prefix, "$2y$", 4)) -- use = _crypt_gensalt_blowfish_rn; -- else -- if (!strncmp(prefix, "$1$", 3)) -- use = _crypt_gensalt_md5_rn; -- else -- if (prefix[0] == '_') -- use = _crypt_gensalt_extended_rn; -- else -- if (!prefix[0] || -- (prefix[0] && prefix[1] && -- memchr(_crypt_itoa64, prefix[0], 64) && -- memchr(_crypt_itoa64, prefix[1], 64))) -- use = _crypt_gensalt_traditional_rn; -- else { -- __set_errno(EINVAL); -- return NULL; -- } -- -- return use(prefix, count, input, size, output, output_size); --} -- --char *__crypt_gensalt_ra(const char *prefix, unsigned long count, -- const char *input, int size) --{ -- char output[CRYPT_GENSALT_OUTPUT_SIZE]; -- char *retval; -- -- retval = __crypt_gensalt_rn(prefix, count, -- input, size, output, sizeof(output)); -- -- if (retval) { -- retval = strdup(retval); --#ifndef __GLIBC__ -- /* strdup(3) on glibc sets errno, so we don't need to bother */ -- if (!retval) -- __set_errno(ENOMEM); - #endif -- } -- -- return retval; --} -- --char *__crypt_gensalt(const char *prefix, unsigned long count, -- const char *input, int size) --{ -- static char output[CRYPT_GENSALT_OUTPUT_SIZE]; -- -- return __crypt_gensalt_rn(prefix, count, -- input, size, output, sizeof(output)); --} - - #if defined(__GLIBC__) && defined(_LIBC) --weak_alias(__crypt_rn, crypt_rn) --weak_alias(__crypt_ra, crypt_ra) - weak_alias(__crypt_r, crypt_r) - weak_alias(__crypt, crypt) --weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn) --weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra) --weak_alias(__crypt_gensalt, crypt_gensalt) - weak_alias(crypt, fcrypt) - #endif - diff --git a/fix-locking-in-_IO_cleanup.patch b/fix-locking-in-_IO_cleanup.patch index 7c9f9da..24e7d6d 100644 --- a/fix-locking-in-_IO_cleanup.patch +++ b/fix-locking-in-_IO_cleanup.patch @@ -3,7 +3,7 @@ Always do locking when accessing streams (bug 15142) During exit, skip files that are currently locked to avoid deadlock. [BZ #15142] - * include/bits/libio.h (_IO_ftrylockfile) [_IO_MTSAVE_IO]: Define. + * libio/libio.h (_IO_ftrylockfile) [_IO_MTSAVE_IO]: Define. * libio/genops.c (_IO_flush_all_lockp): Make static. Rename argument to skip_locked, callers changed. Skip files that are locked if skip_locked. @@ -11,10 +11,10 @@ During exit, skip files that are currently locked to avoid deadlock. files. * libio/libioP.h (_IO_flush_all_lockp): Don't declare. -Index: glibc-2.27/include/bits/libio.h +Index: glibc-2.27/libio/libio.h =================================================================== ---- glibc-2.27.orig/include/bits/libio.h -+++ glibc-2.27/include/bits/libio.h +--- glibc-2.27.orig/libio/libio.h ++++ glibc-2.27/libio/libio.h @@ -33,11 +33,15 @@ libc_hidden_proto (_IO_vfscanf) if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock) # define _IO_funlockfile(_fp) \ @@ -35,9 +35,9 @@ 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 - +@@ -744,8 +744,8 @@ _IO_adjust_column (unsigned start, const + } + libc_hidden_def (_IO_adjust_column) -int -_IO_flush_all_lockp (int do_lock) @@ -45,9 +45,9 @@ Index: glibc-2.27/libio/genops.c +_IO_flush_all_lockp (bool skip_locked) { int result = 0; - struct _IO_FILE *fp; + FILE *fp; @@ -758,7 +758,16 @@ _IO_flush_all_lockp (int do_lock) - for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain) + for (fp = (FILE *) _IO_list_all; fp != NULL; fp = fp->_chain) { run_fp = fp; - if (do_lock) @@ -85,7 +85,7 @@ Index: glibc-2.27/libio/genops.c @@ -852,22 +860,18 @@ _IO_unbuffer_all (void) - for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain) + for (fp = (FILE *) _IO_list_all; fp; fp = fp->_chain) { + run_fp = fp; + /* Skip files that are currently locked. */ @@ -151,9 +151,9 @@ Index: glibc-2.27/libio/libioP.h =================================================================== --- glibc-2.27.orig/libio/libioP.h +++ glibc-2.27/libio/libioP.h -@@ -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_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t); +@@ -486,7 +486,6 @@ extern int _IO_new_do_write (FILE *, con + extern int _IO_old_do_write (FILE *, const char *, size_t); + extern int _IO_wdo_write (FILE *, const wchar_t *, size_t); libc_hidden_proto (_IO_wdo_write) -extern int _IO_flush_all_lockp (int); extern int _IO_flush_all (void); diff --git a/fnmatch-collating-elements.patch b/fnmatch-collating-elements.patch index 8d5a52b..f07711f 100644 --- a/fnmatch-collating-elements.patch +++ b/fnmatch-collating-elements.patch @@ -7,6 +7,7 @@ Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) sequence instead of name. Correct alignment adjustment. * posix/fnmatch.c: Don't include "../locale/elem-hash.h". * posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5. + (LOCALES): Add cs_CZ.ISO-8859-2. * posix/tst-fnmatch4.c: New file. * posix/tst-fnmatch5.c: New file. @@ -22,6 +23,16 @@ Index: glibc-2.27/posix/Makefile tst-posix_spawn-fd tst-posix_spawn-setsid \ tst-posix_fadvise tst-posix_fadvise64 \ tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \ +@@ -165,7 +166,8 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test + endif + + LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \ +- en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8 ++ en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8 \ ++ cs_CZ.ISO-8859-2 + include ../gen-locales.mk + + $(objpfx)bug-regex1.out: $(gen-locales) Index: glibc-2.27/posix/fnmatch.c =================================================================== --- glibc-2.27.orig/posix/fnmatch.c @@ -381,7 +392,7 @@ Index: glibc-2.27/posix/tst-fnmatch4.c +static int +do_test_locale (const char *locale) +{ -+ const char *pattern = "[[.ll.]]"; ++ const char *pattern = "[[.ch.]]"; + + if (setlocale (LC_ALL, locale) == NULL) + { @@ -389,7 +400,7 @@ Index: glibc-2.27/posix/tst-fnmatch4.c + return 1; + } + -+ if (fnmatch (pattern, "ll", 0) != 0) ++ if (fnmatch (pattern, "ch", 0) != 0) + { + printf ("%s didn't match in locale %s\n", pattern, locale); + return 1; @@ -401,8 +412,8 @@ Index: glibc-2.27/posix/tst-fnmatch4.c +static int +do_test (void) +{ -+ return (do_test_locale ("es_US.ISO-8859-1") -+ || do_test_locale ("es_US.UTF-8")); ++ return (do_test_locale ("cs_CZ.ISO-8859-2") ++ || do_test_locale ("cs_CZ.UTF-8")); +} + +#define TEST_FUNCTION do_test () diff --git a/glibc-2.14-crypt.diff b/glibc-2.14-crypt.diff deleted file mode 100644 index 32c2a69..0000000 --- a/glibc-2.14-crypt.diff +++ /dev/null @@ -1,98 +0,0 @@ -Index: glibc-2.27/crypt/Makefile -=================================================================== ---- glibc-2.27.orig/crypt/Makefile -+++ glibc-2.27/crypt/Makefile -@@ -23,14 +23,18 @@ subdir := crypt - include ../Makeconfig - - headers := crypt.h -+headers += gnu-crypt.h ow-crypt.h - --extra-libs := libcrypt -+extra-libs := libcrypt libowcrypt - extra-libs-others := $(extra-libs) - - libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \ - crypt_util - --tests := cert md5c-test sha256c-test sha512c-test badsalttest -+libcrypt-routines += crypt_blowfish x86 wrapper -+libowcrypt-routines := crypt_gensalt wrapper-gensalt -+ -+tests := cert md5c-test sha256c-test sha512c-test - - ifeq ($(crypt-in-libc),yes) - routines += $(libcrypt-routines) -Index: glibc-2.27/crypt/Versions -=================================================================== ---- glibc-2.27.orig/crypt/Versions -+++ glibc-2.27/crypt/Versions -@@ -3,3 +3,8 @@ libcrypt { - crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r; - } - } -+libowcrypt { -+ OW_CRYPT_1.0 { -+ crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra; -+ } -+} -Index: glibc-2.27/crypt/crypt-entry.c -=================================================================== ---- glibc-2.27.orig/crypt/crypt-entry.c -+++ glibc-2.27/crypt/crypt-entry.c -@@ -71,7 +71,7 @@ extern struct crypt_data _ufc_foobar; - */ - - char * --__crypt_r (const char *key, const char *salt, -+__des_crypt_r (const char *key, const char *salt, - struct crypt_data * __restrict data) - { - ufc_long res[4]; -@@ -152,6 +152,7 @@ __crypt_r (const char *key, const char * - - return data->crypt_3_buf; - } -+#if 0 - weak_alias (__crypt_r, crypt_r) - - char * -@@ -190,3 +191,4 @@ __fcrypt (const char *key, const char *s - return crypt (key, salt); - } - #endif -+#endif -Index: glibc-2.27/crypt/crypt-private.h -=================================================================== ---- glibc-2.27.orig/crypt/crypt-private.h -+++ glibc-2.27/crypt/crypt-private.h -@@ -65,7 +65,7 @@ extern void __encrypt_r (char * __restri - struct crypt_data * __restrict __data); - - /* crypt-entry.c */ --extern char *__crypt_r (const char *__key, const char *__salt, -+extern char *__des_crypt_r (const char *__key, const char *__salt, - struct crypt_data * __restrict __data); - extern char *fcrypt (const char *key, const char *salt); - -Index: glibc-2.27/shlib-versions -=================================================================== ---- glibc-2.27.orig/shlib-versions -+++ glibc-2.27/shlib-versions -@@ -59,6 +59,7 @@ libnsl=1 - - # This defines the shared library version numbers we will install. - libcrypt=1 -+libowcrypt=1 - - # The gross patch for programs assuming broken locale implementations. - libBrokenLocale=1 -Index: glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist -=================================================================== ---- /dev/null -+++ glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist -@@ -0,0 +1,4 @@ -+OW_CRYPT_1.0 OW_CRYPT_1.0 A -+OW_CRYPT_1.0 crypt_gensalt F -+OW_CRYPT_1.0 crypt_gensalt_ra F -+OW_CRYPT_1.0 crypt_gensalt_rn F diff --git a/glibc-2.27.tar.xz b/glibc-2.27.tar.xz deleted file mode 100644 index 7c85ec2..0000000 --- a/glibc-2.27.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5172de54318ec0b7f2735e5a91d908afe1c9ca291fec16b5374d9faadfc1fc72 -size 15395316 diff --git a/glibc-2.27.tar.xz.sig b/glibc-2.27.tar.xz.sig deleted file mode 100644 index 75b24ac..0000000 --- a/glibc-2.27.tar.xz.sig +++ /dev/null @@ -1,16 +0,0 @@ ------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----- diff --git a/glibc-2.28.tar.xz b/glibc-2.28.tar.xz new file mode 100644 index 0000000..64e7e12 --- /dev/null +++ b/glibc-2.28.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1900051afad76f7a4f73e71413df4826dce085ef8ddb785a945b66d7d513082 +size 16484344 diff --git a/glibc-2.28.tar.xz.sig b/glibc-2.28.tar.xz.sig new file mode 100644 index 0000000..99e38e1 --- /dev/null +++ b/glibc-2.28.tar.xz.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIcBAABAgAGBQJbYVUmAAoJEBZ5K06iU0D43VkP/19+lsSsDZ97QfojgE/lXgJU +5CmHV4Agjhf1MaFSbmDOwFjlMeU7TXkygQ7z9+E8oikRi69bGhFZjeUenr2mcWWi +FKaF4EVYIM+r4nXJJeZVBKgmFZdzjyqklH2P7/koKuqzMuC8zHX8fLYqDhwxpquO +lHGTR7ai5wFgBSfx/CflpAJ6ZVg9FCMA/GA2W9gJU9C3iyCux5LSrF2Oq035bQ0z +3WAHdjqTzLV8SI2B4XEadmjMseLk+AQwJ+xEa5eoZd5qF3TJVzOWRfSNEJC1jd9S +PonzLStU7u/YcDs33jiW+h4heXA8qK5grF6HaBvh8DBkzzJrMLRKBiprgRdt/UBq +jGSTVUlGDCs39QnnOedWOBxza/mmm24nE6cOE8eTq+OUvdwR9uY4ADrx3bCYNJ+N +B15JAkdfJguAYtqEFbXJL7j4ws18sjfphWbdQYZCUxgSZ9BRjrmPM1MFHlv7BDkx +u/gDEYyGZSVcYAAZ6WOdRD5mjTFpN9kx7qxMqCWL9O1L0UL6cIc2tN6ZI+zBI24m +60Nkh1R5zIepmsTxurYGm9vB+YqoR74N4gUz2LHMNRhZBCjGd4DYkriNOHlqLs1q +W72Bn1uDnWqyWaH59HjNyHEh38qiF+4yD8pJIV38+EUJiUROt1f26ZDgtcys1l+5 +7mN5kVcGKT//Sim81yI5 +=nbAu +-----END PGP SIGNATURE----- diff --git a/glibc.changes b/glibc.changes index 57880c1..8ba04c2 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,63 @@ +------------------------------------------------------------------- +Thu Aug 2 07:48:07 UTC 2018 - schwab@suse.de + +- Update to glibc 2.28 + * The localization data for ISO 14651 is updated to match the 2016 + Edition 4 release of the standard, this matches data provided by + Unicode 9.0.0 + * Unicode 11.0.0 Support: Character encoding, character type info, and + transliteration tables are all updated to Unicode 11.0.0, using + generator scripts contributed by Mike FABIAN (Red Hat) + * functions that round their results to a narrower type are added + from TS 18661-1:2014 and TS 18661-3:2015 + * Two grammatical forms of month names are now supported + * The renameat2 function has been added, a variant of the renameat function + which has a flags argument + * The statx function has been added, a variant of the fstatat64 + function with an additional flags argument + * IDN domain names in getaddrinfo and getnameinfo now use the system libidn2 + library if installed + * Parsing of dynamic string tokens in DT_RPATH, DT_RUNPATH, DT_NEEDED, + DT_AUXILIARY, and DT_FILTER has been expanded to support the full + range of ELF gABI expressions including such constructs as + '$ORIGIN$ORIGIN' (if valid) + * Support for ISO C threads (ISO/IEC 9899:2011) has been added. + * The nonstandard header files and <_G_config.h> are no longer + installed + * The stdio functions 'getc' and 'putc' are no longer defined as macros + * All stdio functions now treat end-of-file as a sticky condition + * The macros 'major', 'minor', and 'makedev' are now only available from + the header + * The obsolete function ustat is no longer available to newly linked + binaries; the headers and have been removed + * The obsolete function nfsservctl is no longer available to newly linked + binaries + * The obsolete function name llseek is no longer available to newly linked + binaries + * The AI_IDN_ALLOW_UNASSIGNED and NI_IDN_ALLOW_UNASSIGNED flags for the + getaddrinfo and getnameinfo functions have been deprecated + * The AI_IDN_USE_STD3_ASCII_RULES and NI_IDN_USE_STD3_ASCII_RULES flags for + the getaddrinfo and getnameinfo functions have been deprecated + * The fcntl function now have a Long File Support variant named fcntl64 + * CVE-2016-6261, CVE-2016-6263, CVE-2017-14062: Various vulnerabilities have + been fixed by removing the glibc-internal IDNA implementation and using + the system-provided libidn2 library instead +- Split off all libcrypt related functions into package libxcrypt +- fix-locking-in-_IO_cleanup.patch, fnmatch-collating-elements.patch: + Rediff +- aarch64-sys-ptrace-update.patch, + crypt_blowfish-1.2-hack_around_arm.diff, crypt_blowfish-1.2-sha.diff, + crypt_blowfish-const.patch, crypt_blowfish-gensalt.patch, + glibc-2.14-crypt.diff, i386-memmove-sse2-unaligned.patch, + i386-sigaction-sa-restorer.patch, mempcpy-avx512.patch, + netgroup-cache-keys.patch, nss-database-multiple-dfn.patch, + pkey-get-reserved-name.patch, powerpc-sys-ptrace-undefine-macros.patch, + powerpc-sys-ptrace-update.patch, realpath-ssize-max-overflow.patch, + res-send-enomem.patch, riscv-fmax-fmin-nan.patch, + riscv-kernel-sigaction.patch, riscv-readelflib.patch, + riscv-tls-init.patch: Removed +- glibc_post_upgrade.c: Don't reload init (bsc#1103124) + ------------------------------------------------------------------- Tue Jun 19 08:37:43 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index d448ec2..a847528 100644 --- a/glibc.spec +++ b/glibc.spec @@ -20,7 +20,6 @@ # It will avoid building some parts of glibc %bcond_with fast_build -%define crypt_bf_version 1.3 %define build_snapshot 0 %bcond_with ringdisabled @@ -71,6 +70,7 @@ BuildRequires: xz BuildRequires: gcc-c++ BuildRequires: gdb BuildRequires: glibc-devel-static +BuildRequires: libidn2-0 BuildRequires: libstdc++-devel BuildRequires: python3-pexpect %endif @@ -146,10 +146,10 @@ BuildArch: i686 %define enablekernel 4.15 %endif -Version: 2.27 +Version: 2.28 Release: 0 %if !%{build_snapshot} -%define git_id 3260f6ce87b7 +%define git_id 3c03baca37fd %define libversion %version %else %define git_id %(echo %version | sed 's/.*\.g//') @@ -173,10 +173,6 @@ Source10: baselibs.conf # For systemd Source20: nscd.conf Source21: nscd.service -# crypt_blowfish -Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz -# The sign key uses MD5 which is no longer accepted by gpg -#Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz.sign %if %{build_main} # ngpt was used in 8.1 and SLES8 @@ -230,16 +226,6 @@ NoSource: 0 # openSUSE specific patches - won't go upstream ### ### openSUSE extensions, configuration -# PATCH-FEATURE-OPENSUSE -- add crypt_blowfish support - bnc#700876 -Patch1: glibc-2.14-crypt.diff -# PATCH-FEATURE-OPENSUSE constify crypt_blowfish -Patch2: crypt_blowfish-const.patch -# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de -Patch3: crypt_blowfish-1.2-sha.diff -# PATCH-FEATURE-OPENSUSE Move crypt_gensalt_rn to separate library -Patch4: crypt_blowfish-gensalt.patch -# PATCH-FEATURE-OPENSUSE Avoid build failure on noexecstack marker on ARM dmueller@suse.de -Patch5: crypt_blowfish-1.2-hack_around_arm.diff # PATCH-FIX-OPENSUSE Fix path for nscd databases Patch6: glibc-2.3.3-nscd-db-path.diff # PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de @@ -280,36 +266,6 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-UPSTREAM Fix parsing flags in ELF64 files (BZ #22827) -Patch1000: riscv-readelflib.patch -# PATCH-FIX-UPSTREAM Fix multiple definitions of __nss_*_database (BZ #22918) -Patch1001: nss-database-multiple-dfn.patch -# PATCH-FIX-UPSTREAM Linux: use reserved name __key in pkey_get (BZ #22797) -Patch1002: pkey-get-reserved-name.patch -# PATCH-FIX-UPSTREAM linux/aarch64: sync sys/ptrace.h with Linux 4.15 (BZ #22433) -Patch1003: aarch64-sys-ptrace-update.patch -# PATCH-FIX-UPSTREAM powerpc: Undefine Linux ptrace macros that conflict with __ptrace_request -Patch1004: powerpc-sys-ptrace-undefine-macros.patch -# PATCH-FIX-UPSTREAM linux/powerpc: sync sys/ptrace.h with Linux 4.15 (BZ #22433, BZ #22807) -Patch1005: powerpc-sys-ptrace-update.patch -# PATCH-FIX-UPSTREAM Fix netgroup cache keys (BZ #22342) -Patch1006: netgroup-cache-keys.patch -# PATCH-FIX-UPSTREAM i386: Fix i386 sigaction sa_restorer initialization (BZ #21269) -Patch1007: i386-sigaction-sa-restorer.patch -# PATCH-FIX-UPSTREAM RISC-V: Do not initialize $gp in TLS macros -Patch1008: riscv-tls-init.patch -# PATCH-FIX-UPSTREAM RISC-V: fmax/fmin: Handle signalling NaNs correctly (BZ #22884) -Patch1009: riscv-fmax-fmin-nan.patch -# PATCH-FIX-UPSTREAM Fix crash in resolver on memory allocation failure (BZ #23005) -Patch1010: res-send-enomem.patch -# PATCH-FIX-UPSTREAM memmove-sse2-unaligned on 32bit x86 produces garbage when crossing 2GB threshold (CVE-2017-18269, BZ #22644) -Patch1011: i386-memmove-sse2-unaligned.patch -# PATCH-FIX-UPSTREAM __mempcpy_avx512_no_vzeroupper mishandles large copies (CVE-2018-11237, BZ #23196) -Patch1012: mempcpy-avx512.patch -# PATCH-FIX-UPSTREAM realpath-ssize-max-overflow.patch: Fix overflow in path length computation (CVE-2018-11236, BZ #22786) -Patch1013: realpath-ssize-max-overflow.patch -# PATCH-FIX-UPSTREAM RISC-V: fix struct kernel_sigaction to match the kernel version (BZ #23069) -Patch1014: riscv-kernel-sigaction.patch ### # Patches awaiting upstream approval @@ -453,6 +409,7 @@ Obsoletes: glibc-devel-64bit Obsoletes: glibc-devel-32bit %endif Requires: glibc = %{version} +Requires: libxcrypt-devel Requires: linux-kernel-headers %description devel @@ -464,6 +421,7 @@ Summary: C library static libraries for -static linking 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++ Requires: %{name}-devel = %{version} +Requires: libxcrypt-devel-static # Provide Fedora name for package to make packaging easier Provides: %{name}-static = %{version} @@ -489,18 +447,6 @@ makedb: A program to create a database for nss %prep %setup -n glibc-%{version} -q -a 4 -# Owl crypt_blowfish -tar -xzf %SOURCE50 -pushd crypt_blowfish-%{crypt_bf_version} -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -popd -mv crypt/{crypt.h,gnu-crypt.h} -mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/ -# -%patch1 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 @@ -519,22 +465,6 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/ %patch304 -p1 %patch306 -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 - %patch2000 -p1 %patch2004 -p1 %patch2005 -p1 @@ -601,7 +531,6 @@ done BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector[^ ]*##' -e 's#-ffortify=[0-9]*##') BuildCC="%__cc" BuildCCplus="%__cxx" -add_ons=libidn # #now overwrite for some architectures # @@ -670,7 +599,6 @@ configure_and_build_glibc() { CC="$BuildCC" CXX="$BuildCCplus" \ --prefix=%{_prefix} \ --libexecdir=%{_libexecdir} --infodir=%{_infodir} \ - --enable-add-ons=$add_ons \ $profile \ "$@" \ --build=%{target} --host=%{target} \ @@ -692,8 +620,8 @@ configure_and_build_glibc() { --with-bugurl=http://bugs.opensuse.org \ --enable-bind-now \ --enable-systemtap \ - --disable-timezone-tools -# Should we enable --enable-nss-crypt to build use freebl3 hash functions? + --disable-timezone-tools \ + --disable-crypt # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" cd .. @@ -752,29 +680,35 @@ make -C cc-base html # # Build glibc_post_upgrade binary # -$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ - -Lcc-base -Bcc-base/csu \ - '-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ +mkdir glibc-post-upgrade +cat > glibc-post-upgrade/Makefile <<\EOF +subdir := glibc-post-upgrade +include ../Makeconfig +vpath %.c $(dir %{SOURCE8}) +others = glibc_post_upgrade +others-static = glibc_post_upgrade +libof-glibc_post_upgrade = glibc_post_upgrade +$(objpfx)glibc_post_upgrade: $(common-objpfx)elf/static-stubs.o +CFLAGS-glibc_post_upgrade.o = \ + -Os -Wno-write-strings -DREMOVE_TLS_DIRS -DREMOVE_PPC_OPTIMIZE_POWER5 \ %ifarch ppc ppc64 %if !%{powerpc_optimize_cpu_power4} - '-DREMOVE_PPC_OPTIMIZE_POWER4' \ + -DREMOVE_PPC_OPTIMIZE_POWER4 \ %endif %if !%{powerpc_optimize_cpu_power6} - '-DREMOVE_PPC_OPTIMIZE_POWER6' \ + -DREMOVE_PPC_OPTIMIZE_POWER6 \ %endif %if !%{powerpc_optimize_cpu_power7} - '-DREMOVE_PPC_OPTIMIZE_POWER7' \ + -DREMOVE_PPC_OPTIMIZE_POWER7 \ %endif %if !%{powerpc_optimize_cpu_cell} - '-DREMOVE_PPC_OPTIMIZE_CELL' \ + -DREMOVE_PPC_OPTIMIZE_CELL \ %endif %endif - '-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' - -# crypt_blowfish man pages -pushd crypt_blowfish-%{crypt_bf_version} -make man -popd + -DLIBDIR='"/%{_lib}"' -DGCONV_MODULES_DIR='"%{_libdir}/gconv"' +include ../Rules +EOF +make -C cc-base subdirs=glibc-post-upgrade glibc-post-upgrade/others %check %if %{build_testsuite} @@ -913,7 +847,7 @@ cc-base/elf/ldconfig -vn $destdir # Miscelanna: -install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} +install -m 0700 cc-base/glibc-post-upgrade/glibc_post_upgrade %{buildroot}%{_sbindir} install -m 644 %{SOURCE7} %{buildroot}/etc install -m 644 %{SOURCE5} %{buildroot}/etc @@ -933,12 +867,6 @@ cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc cd manpages; make install_root=%{buildroot} install; cd .. -# crypt_blowfish man pages -pushd crypt_blowfish-%{crypt_bf_version} -install -m755 -d %{buildroot}%{_mandir}/man3 -install -m644 *.3 %{buildroot}%{_mandir}/man3 -popd - # nscd tools: %ifnarch i686 @@ -1170,12 +1098,6 @@ exit 0 /%{_lib}/libanl.so.1 /%{_lib}/libc-%{libversion}.so /%{_lib}/libc.so.6* -/%{_lib}/libcidn-%{libversion}.so -/%{_lib}/libcidn.so.1 -/%{_lib}/libcrypt-%{libversion}.so -/%{_lib}/libcrypt.so.1 -/%{_lib}/libowcrypt-%{libversion}.so -/%{_lib}/libowcrypt.so.1 /%{_lib}/libdl-%{libversion}.so /%{_lib}/libdl.so.2* /%{_lib}/libm-%{libversion}.so @@ -1281,15 +1203,12 @@ exit 0 %ifarch x86_64 %{_libdir}/libmvec_nonshared.a %endif -%{_libdir}/libpthread_nonshared.a %files devel-static %defattr(-,root,root) %{_libdir}/libBrokenLocale.a %{_libdir}/libanl.a %{_libdir}/libc.a -%{_libdir}/libcrypt.a -%{_libdir}/libowcrypt.a %{_libdir}/libdl.a %{_libdir}/libm.a %ifarch x86_64 @@ -1347,8 +1266,6 @@ exit 0 %ifarch x86_64 %{_libdir}/libmvec_p.a %endif -%{_libdir}/libcrypt_p.a -%{_libdir}/libowcrypt_p.a %{_libdir}/libpthread_p.a %{_libdir}/libresolv_p.a %{_libdir}/librt_p.a diff --git a/glibc_post_upgrade.c b/glibc_post_upgrade.c index 0ed1ff3..876e2ba 100644 --- a/glibc_post_upgrade.c +++ b/glibc_post_upgrade.c @@ -1,6 +1,8 @@ /* skeleton based on version from Fedora Core 3 */ -#define _GNU_SOURCE +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif #include #include @@ -26,14 +28,10 @@ __attribute__((noinline)) void vexec (int failcode, char *const path[]); __attribute__((noinline)) void says (const char *str); __attribute__((noinline)) void sayn (long num); __attribute__((noinline)) void message (char *const path[]); -__attribute__((noinline)) int check_elf (const char *name); int main (void) { - char initpath[256]; - struct stat root, init_root; - /* First, get rid of platform-optimized libraries. We remove any we have ever built, since otherwise we might end up using some old leftover libraries when new ones aren't installed in their place anymore. */ @@ -128,33 +126,6 @@ main (void) "--nostdlib", GCONV_MODULES_DIR); } - /* Check if telinit is available and the init fifo as well. */ - if (access ("/sbin/telinit", X_OK) || access ("/dev/initctl", F_OK)) - _exit (0); - /* Check if we are not inside of some chroot, because we'd just - timeout and leave /etc/initrunlvl. */ - if (readlink ("/proc/1/exe", initpath, 256) <= 0 || - readlink ("/proc/1/root", initpath, 256) <= 0 || - access ("/.buildenv", F_OK) == 0 || /* XEN build */ - stat ("/proc/1/root", &init_root) < 0 || - stat ("/", &root) < 0 || - init_root.st_dev != root.st_dev || init_root.st_ino != root.st_ino) - _exit (0); - - if (check_elf ("/proc/1/exe")) - verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u"); - -#if 0 - /* Check if we can safely condrestart sshd. */ - if (access ("/sbin/service", X_OK) == 0 - && access ("/usr/sbin/sshd", X_OK) == 0 - && access ("/bin/bash", X_OK) == 0) - { - if (check_elf ("/usr/sbin/sshd")) - verbose_exec (121, "/sbin/service", "/sbin/service", "sshd", "condrestart"); - } -#endif - _exit(0); } @@ -231,106 +202,3 @@ message (char *const path[]) says ("/usr/sbin/glibc_post_upgrade: While trying to execute "); says (path[0]); } - -int -check_elf (const char *name) -{ - /* Play safe, if we can't open or read, assume it might be - ELF for the current arch. */ - int ret = 1; - int fd = open (name, O_RDONLY); - if (fd >= 0) - { - Elf32_Ehdr ehdr; - if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version)) - == offsetof (Elf32_Ehdr, e_version)) - { - ret = 0; - if (ehdr.e_ident[EI_CLASS] - == (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32)) - { -#if defined __i386__ - ret = ehdr.e_machine == EM_386; -#elif defined __x86_64__ - ret = ehdr.e_machine == EM_X86_64; -#elif defined __ia64__ - ret = ehdr.e_machine == EM_IA_64; -#elif defined __powerpc64__ - ret = ehdr.e_machine == EM_PPC64; -#elif defined __powerpc__ - ret = ehdr.e_machine == EM_PPC; -#elif defined __s390__ || defined __s390x__ - ret = ehdr.e_machine == EM_S390; -#elif defined __x86_64__ - ret = ehdr.e_machine == EM_X86_64; -#elif defined __sparc__ - if (sizeof (long) == 8) - ret = ehdr.e_machine == EM_SPARCV9; - else - ret = (ehdr.e_machine == EM_SPARC - || ehdr.e_machine == EM_SPARC32PLUS); -#else - ret = 1; -#endif - } - } - close (fd); - } - return ret; -} - -#ifdef SMALL_BINARY - -int __libc_multiple_threads __attribute__((nocommon)); -int __libc_enable_asynccancel (void) { return 0; } -void __libc_disable_asynccancel (int x) { } -void __libc_csu_init (void) { } -void __libc_csu_fini (void) { } -pid_t __fork (void) { return -1; } -char thr_buf[65536]; - -#ifndef __powerpc__ -int -__libc_start_main (int (*main) (void), int argc, char **argv, - void (*init) (void), void (*fini) (void), - void (*rtld_fini) (void), void * stack_end) -#else -struct startup_info -{ - void *sda_base; - int (*main) (int, char **, char **, void *); - int (*init) (int, char **, char **, void *); - void (*fini) (void); -}; - -int -__libc_start_main (int argc, char **ubp_av, char **ubp_ev, - void *auxvec, void (*rtld_fini) (void), - struct startup_info *stinfo, - char **stack_on_entry) -#endif -{ -#if defined __ia64__ || defined __powerpc64__ - register void *r13 __asm ("r13") = thr_buf + 32768; - __asm ("" : : "r" (r13)); -#elif defined __sparc__ - register void *g6 __asm ("g6") = thr_buf + 32768; -# ifdef __arch64__ - __thread_self = thr_buf + 32768; -# else - register void *__thread_self __asm ("g7") = thr_buf + 32768; -# endif - __asm ("" : : "r" (g6), "r" (__thread_self)); -#elif defined __s390__ && !defined __s390x__ - __asm ("sar %%a0,%0" : : "d" (thr_buf + 32768)); -#elif defined __s390x__ - __asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0"); -#elif defined __powerpc__ && !defined __powerpc64__ - register void *r2 __asm ("r2") = thr_buf + 32768; - __asm ("" : : "r" (r2)); -#endif - main(); - return 0; -} - -#endif diff --git a/i386-memmove-sse2-unaligned.patch b/i386-memmove-sse2-unaligned.patch deleted file mode 100644 index 654fbb2..0000000 --- a/i386-memmove-sse2-unaligned.patch +++ /dev/null @@ -1,149 +0,0 @@ -2018-03-23 Andrew Senkevich - Max Horn - - [BZ #22644] - * sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed - branch conditions. - * string/test-memmove.c (do_test2): New testcase. - -Index: glibc-2.27/string/test-memmove.c -=================================================================== ---- glibc-2.27.orig/string/test-memmove.c -+++ glibc-2.27/string/test-memmove.c -@@ -24,6 +24,7 @@ - # define TEST_NAME "memmove" - #endif - #include "test-string.h" -+#include - - char *simple_memmove (char *, const char *, size_t); - -@@ -245,6 +246,60 @@ do_random_tests (void) - } - } - -+static void -+do_test2 (void) -+{ -+ size_t size = 0x20000000; -+ uint32_t * large_buf; -+ -+ large_buf = mmap ((void*) 0x70000000, size, PROT_READ | PROT_WRITE, -+ MAP_PRIVATE | MAP_ANON, -1, 0); -+ -+ if (large_buf == MAP_FAILED) -+ error (EXIT_UNSUPPORTED, errno, "Large mmap failed"); -+ -+ if ((uintptr_t) large_buf > 0x80000000 - 128 -+ || 0x80000000 - (uintptr_t) large_buf > 0x20000000) -+ { -+ error (0, 0, "Large mmap allocated improperly"); -+ ret = EXIT_UNSUPPORTED; -+ munmap ((void *) large_buf, size); -+ return; -+ } -+ -+ size_t bytes_move = 0x80000000 - (uintptr_t) large_buf; -+ size_t arr_size = bytes_move / sizeof (uint32_t); -+ size_t i; -+ -+ FOR_EACH_IMPL (impl, 0) -+ { -+ for (i = 0; i < arr_size; i++) -+ large_buf[i] = (uint32_t) i; -+ -+ uint32_t * dst = &large_buf[33]; -+ -+#ifdef TEST_BCOPY -+ CALL (impl, (char *) large_buf, (char *) dst, bytes_move); -+#else -+ CALL (impl, (char *) dst, (char *) large_buf, bytes_move); -+#endif -+ -+ for (i = 0; i < arr_size; i++) -+ { -+ if (dst[i] != (uint32_t) i) -+ { -+ error (0, 0, -+ "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"", -+ impl->name, dst, large_buf, i); -+ ret = 1; -+ break; -+ } -+ } -+ } -+ -+ munmap ((void *) large_buf, size); -+} -+ - int - test_main (void) - { -@@ -284,6 +339,9 @@ test_main (void) - } - - do_random_tests (); -+ -+ do_test2 (); -+ - return ret; - } - -Index: glibc-2.27/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S -=================================================================== ---- glibc-2.27.orig/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S -+++ glibc-2.27/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S -@@ -72,7 +72,7 @@ ENTRY (MEMCPY) - cmp %edx, %eax - - # ifdef USE_AS_MEMMOVE -- jg L(check_forward) -+ ja L(check_forward) - - L(mm_len_0_or_more_backward): - /* Now do checks for lengths. We do [0..16], [16..32], [32..64], [64..128] -@@ -81,7 +81,7 @@ L(mm_len_0_or_more_backward): - jbe L(mm_len_0_16_bytes_backward) - - cmpl $32, %ecx -- jg L(mm_len_32_or_more_backward) -+ ja L(mm_len_32_or_more_backward) - - /* Copy [0..32] and return. */ - movdqu (%eax), %xmm0 -@@ -92,7 +92,7 @@ L(mm_len_0_or_more_backward): - - L(mm_len_32_or_more_backward): - cmpl $64, %ecx -- jg L(mm_len_64_or_more_backward) -+ ja L(mm_len_64_or_more_backward) - - /* Copy [0..64] and return. */ - movdqu (%eax), %xmm0 -@@ -107,7 +107,7 @@ L(mm_len_32_or_more_backward): - - L(mm_len_64_or_more_backward): - cmpl $128, %ecx -- jg L(mm_len_128_or_more_backward) -+ ja L(mm_len_128_or_more_backward) - - /* Copy [0..128] and return. */ - movdqu (%eax), %xmm0 -@@ -132,7 +132,7 @@ L(mm_len_128_or_more_backward): - add %ecx, %eax - cmp %edx, %eax - movl SRC(%esp), %eax -- jle L(forward) -+ jbe L(forward) - PUSH (%esi) - PUSH (%edi) - PUSH (%ebx) -@@ -269,7 +269,7 @@ L(check_forward): - add %edx, %ecx - cmp %eax, %ecx - movl LEN(%esp), %ecx -- jle L(forward) -+ jbe L(forward) - - /* Now do checks for lengths. We do [0..16], [0..32], [0..64], [0..128] - separately. */ diff --git a/i386-sigaction-sa-restorer.patch b/i386-sigaction-sa-restorer.patch deleted file mode 100644 index 0e735ec..0000000 --- a/i386-sigaction-sa-restorer.patch +++ /dev/null @@ -1,281 +0,0 @@ -2018-03-03 Adhemerval Zanella - - [BZ #21269] - * sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269. - * sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear - sa_restorer for vDSO case. - * sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/Makefile -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/i386/Makefile -+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/Makefile -@@ -3,6 +3,9 @@ default-abi := 32 - - ifeq ($(subdir),misc) - sysdep_routines += ioperm iopl vm86 -+ -+tests += tst-bz21269 -+$(objpfx)tst-bz21269: $(shared-thread-library) - endif - - ifeq ($(subdir),elf) -Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/sigaction.c -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/i386/sigaction.c -+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/sigaction.c -@@ -42,7 +42,6 @@ extern void restore_rt (void) asm ("__re - #endif - extern void restore (void) asm ("__restore") attribute_hidden; - -- - /* If ACT is not NULL, change the action for SIG to *ACT. - If OACT is not NULL, put the old action for SIG in *OACT. */ - int -@@ -65,6 +64,8 @@ __libc_sigaction (int sig, const struct - kact.sa_restorer = ((act->sa_flags & SA_SIGINFO) - ? &restore_rt : &restore); - } -+ else -+ kact.sa_restorer = NULL; - } - - /* XXX The size argument hopefully will have to be changed to the -Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/tst-bz21269.c -=================================================================== ---- /dev/null -+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/tst-bz21269.c -@@ -0,0 +1,233 @@ -+/* Test for i386 sigaction sa_restorer handling (BZ#21269) -+ 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 -+ . */ -+ -+/* This is based on Linux test tools/testing/selftests/x86/ldt_gdt.c, -+ more specifically in do_multicpu_tests function. The main changes -+ are: -+ -+ - C11 atomics instead of plain access. -+ - Remove x86_64 support which simplifies the syscall handling -+ and fallbacks. -+ - Replicate only the test required to trigger the issue for the -+ BZ#21269. */ -+ -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+static int -+xset_thread_area (struct user_desc *u_info) -+{ -+ long ret = syscall (SYS_set_thread_area, u_info); -+ TEST_VERIFY_EXIT (ret == 0); -+ return ret; -+} -+ -+static void -+xmodify_ldt (int func, const void *ptr, unsigned long bytecount) -+{ -+ TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, 1, ptr, bytecount) == 0); -+} -+ -+static int -+futex (int *uaddr, int futex_op, int val, void *timeout, int *uaddr2, -+ int val3) -+{ -+ return syscall (SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3); -+} -+ -+static void -+xsethandler (int sig, void (*handler)(int, siginfo_t *, void *), int flags) -+{ -+ struct sigaction sa = { 0 }; -+ sa.sa_sigaction = handler; -+ sa.sa_flags = SA_SIGINFO | flags; -+ TEST_VERIFY_EXIT (sigemptyset (&sa.sa_mask) == 0); -+ TEST_VERIFY_EXIT (sigaction (sig, &sa, 0) == 0); -+} -+ -+static jmp_buf jmpbuf; -+ -+static void -+sigsegv_handler (int sig, siginfo_t *info, void *ctx_void) -+{ -+ siglongjmp (jmpbuf, 1); -+} -+ -+/* Points to an array of 1024 ints, each holding its own index. */ -+static const unsigned int *counter_page; -+static struct user_desc *low_user_desc; -+static struct user_desc *low_user_desc_clear; /* Used to delete GDT entry. */ -+static int gdt_entry_num; -+ -+static void -+setup_counter_page (void) -+{ -+ long page_size = sysconf (_SC_PAGE_SIZE); -+ TEST_VERIFY_EXIT (page_size > 0); -+ unsigned int *page = xmmap (NULL, page_size, PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1); -+ for (int i = 0; i < (page_size / sizeof (unsigned int)); i++) -+ page[i] = i; -+ counter_page = page; -+} -+ -+static void -+setup_low_user_desc (void) -+{ -+ low_user_desc = xmmap (NULL, 2 * sizeof (struct user_desc), -+ PROT_READ | PROT_WRITE, -+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1); -+ -+ low_user_desc->entry_number = -1; -+ low_user_desc->base_addr = (unsigned long) &counter_page[1]; -+ low_user_desc->limit = 0xffff; -+ low_user_desc->seg_32bit = 1; -+ low_user_desc->contents = 0; -+ low_user_desc->read_exec_only = 0; -+ low_user_desc->limit_in_pages = 1; -+ low_user_desc->seg_not_present = 0; -+ low_user_desc->useable = 0; -+ -+ xset_thread_area (low_user_desc); -+ -+ low_user_desc_clear = low_user_desc + 1; -+ low_user_desc_clear->entry_number = gdt_entry_num; -+ low_user_desc_clear->read_exec_only = 1; -+ low_user_desc_clear->seg_not_present = 1; -+} -+ -+/* Possible values of futex: -+ 0: thread is idle. -+ 1: thread armed. -+ 2: thread should clear LDT entry 0. -+ 3: thread should exit. */ -+static atomic_uint ftx; -+ -+static void * -+threadproc (void *ctx) -+{ -+ while (1) -+ { -+ futex ((int *) &ftx, FUTEX_WAIT, 1, NULL, NULL, 0); -+ while (atomic_load (&ftx) != 2) -+ { -+ if (atomic_load (&ftx) >= 3) -+ return NULL; -+ } -+ -+ /* clear LDT entry 0. */ -+ const struct user_desc desc = { 0 }; -+ xmodify_ldt (1, &desc, sizeof (desc)); -+ -+ /* If ftx == 2, set it to zero, If ftx == 100, quit. */ -+ if (atomic_fetch_add (&ftx, -2) != 2) -+ return NULL; -+ } -+} -+ -+ -+/* As described in testcase, for historical reasons x86_32 Linux (and compat -+ on x86_64) interprets SA_RESTORER clear with nonzero sa_restorer as a -+ request for stack switching if the SS segment is 'funny' (this is default -+ scenario for vDSO system). This means that anything that tries to mix -+ signal handling with segmentation should explicit clear the sa_restorer. -+ -+ This testcase check if sigaction in fact does it by changing the local -+ descriptor table (LDT) through the modify_ldt syscall and triggering -+ a synchronous segfault on iret fault by trying to install an invalid -+ segment. With a correct zeroed sa_restorer it should not trigger an -+ 'real' SEGSEGV and allows the siglongjmp in signal handler. */ -+ -+static int -+do_test (void) -+{ -+ setup_counter_page (); -+ setup_low_user_desc (); -+ -+ pthread_t thread; -+ unsigned short orig_ss; -+ -+ xsethandler (SIGSEGV, sigsegv_handler, 0); -+ /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults. */ -+ xsethandler (SIGILL, sigsegv_handler, 0); -+ -+ thread = xpthread_create (0, threadproc, 0); -+ -+ asm volatile ("mov %%ss, %0" : "=rm" (orig_ss)); -+ -+ for (int i = 0; i < 5; i++) -+ { -+ if (sigsetjmp (jmpbuf, 1) != 0) -+ continue; -+ -+ /* Make sure the thread is ready after the last test. */ -+ while (atomic_load (&ftx) != 0) -+ ; -+ -+ struct user_desc desc = { -+ .entry_number = 0, -+ .base_addr = 0, -+ .limit = 0xffff, -+ .seg_32bit = 1, -+ .contents = 0, -+ .read_exec_only = 0, -+ .limit_in_pages = 1, -+ .seg_not_present = 0, -+ .useable = 0 -+ }; -+ -+ xmodify_ldt (0x11, &desc, sizeof (desc)); -+ -+ /* Arm the thread. */ -+ ftx = 1; -+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0); -+ -+ asm volatile ("mov %0, %%ss" : : "r" (0x7)); -+ -+ /* Fire up thread modify_ldt call. */ -+ atomic_store (&ftx, 2); -+ -+ while (atomic_load (&ftx) != 0) -+ ; -+ -+ /* On success, modify_ldt will segfault us synchronously and we will -+ escape via siglongjmp. */ -+ support_record_failure (); -+ } -+ -+ atomic_store (&ftx, 100); -+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0); -+ -+ xpthread_join (thread); -+ -+ return 0; -+} -+ -+#include diff --git a/mempcpy-avx512.patch b/mempcpy-avx512.patch deleted file mode 100644 index 0fe123c..0000000 --- a/mempcpy-avx512.patch +++ /dev/null @@ -1,42 +0,0 @@ - [BZ #23196] - CVE-2018-11237 - * sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S - (L(preloop_large)): Save initial destination pointer in %r11 and - use it instead of %rax after the loop. - * string/test-mempcpy.c (MIN_PAGE_SIZE): Define. - -Index: glibc-2.27/string/test-mempcpy.c -=================================================================== ---- glibc-2.27.orig/string/test-mempcpy.c -+++ glibc-2.27/string/test-mempcpy.c -@@ -18,6 +18,7 @@ - . */ - - #define MEMCPY_RESULT(dst, len) (dst) + (len) -+#define MIN_PAGE_SIZE 131072 - #define TEST_MAIN - #define TEST_NAME "mempcpy" - #include "test-string.h" -Index: glibc-2.27/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S -=================================================================== ---- glibc-2.27.orig/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S -+++ glibc-2.27/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S -@@ -336,6 +336,7 @@ L(preloop_large): - vmovups (%rsi), %zmm4 - vmovups 0x40(%rsi), %zmm5 - -+ mov %rdi, %r11 - /* Align destination for access with non-temporal stores in the loop. */ - mov %rdi, %r8 - and $-0x80, %rdi -@@ -366,8 +367,8 @@ L(gobble_256bytes_nt_loop): - cmp $256, %rdx - ja L(gobble_256bytes_nt_loop) - sfence -- vmovups %zmm4, (%rax) -- vmovups %zmm5, 0x40(%rax) -+ vmovups %zmm4, (%r11) -+ vmovups %zmm5, 0x40(%r11) - jmp L(check) - - L(preloop_large_bkw): diff --git a/netgroup-cache-keys.patch b/netgroup-cache-keys.patch deleted file mode 100644 index 1702d71..0000000 --- a/netgroup-cache-keys.patch +++ /dev/null @@ -1,19 +0,0 @@ -2018-03-01 DJ Delorie - - [BZ #22342] - * nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in - key value. - -Index: glibc-2.27/nscd/netgroupcache.c -=================================================================== ---- glibc-2.27.orig/nscd/netgroupcache.c -+++ glibc-2.27/nscd/netgroupcache.c -@@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, in - { - const char *group = key; - key = (char *) rawmemchr (key, '\0') + 1; -- size_t group_len = key - group - 1; -+ size_t group_len = key - group; - const char *host = *key++ ? key : NULL; - if (host != NULL) - key = (char *) rawmemchr (key, '\0') + 1; diff --git a/nss-database-multiple-dfn.patch b/nss-database-multiple-dfn.patch deleted file mode 100644 index 7191c3f..0000000 --- a/nss-database-multiple-dfn.patch +++ /dev/null @@ -1,89 +0,0 @@ -2018-03-03 Andreas Schwab - - [BZ #22918] - * nss/nsswitch.h (DEFINE_DATABASE): Don't define __nss_*_database. - * nss/nsswitch.c (DEFINE_DATABASE): Define __nss_*_database here. - * nscd/gai.c (__nss_hosts_database): Readd definition. - * posix/tst-rfc3484.c (__nss_hosts_database): Likewise. - * posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise. - * posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise. - -Index: glibc-2.27/nscd/gai.c -=================================================================== ---- glibc-2.27.orig/nscd/gai.c -+++ glibc-2.27/nscd/gai.c -@@ -45,3 +45,6 @@ - #ifdef HAVE_LIBIDN - # include - #endif -+ -+/* Some variables normally defined in libc. */ -+service_user *__nss_hosts_database attribute_hidden; -Index: glibc-2.27/nss/nsswitch.c -=================================================================== ---- glibc-2.27.orig/nss/nsswitch.c -+++ glibc-2.27/nss/nsswitch.c -@@ -62,7 +62,7 @@ static service_library *nss_new_service - - /* Declare external database variables. */ - #define DEFINE_DATABASE(name) \ -- extern service_user *__nss_##name##_database attribute_hidden; \ -+ service_user *__nss_##name##_database attribute_hidden; \ - weak_extern (__nss_##name##_database) - #include "databases.def" - #undef DEFINE_DATABASE -Index: glibc-2.27/nss/nsswitch.h -=================================================================== ---- glibc-2.27.orig/nss/nsswitch.h -+++ glibc-2.27/nss/nsswitch.h -@@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits - #define MAX_NR_ADDRS 48 - - /* Prototypes for __nss_*_lookup2 functions. */ --#define DEFINE_DATABASE(arg) \ -- service_user *__nss_##arg##_database attribute_hidden; \ -- int __nss_##arg##_lookup2 (service_user **, const char *, \ -- const char *, void **); \ -+#define DEFINE_DATABASE(arg) \ -+ extern service_user *__nss_##arg##_database attribute_hidden; \ -+ int __nss_##arg##_lookup2 (service_user **, const char *, \ -+ const char *, void **); \ - libc_hidden_proto (__nss_##arg##_lookup2) - #include "databases.def" - #undef DEFINE_DATABASE -Index: glibc-2.27/posix/tst-rfc3484-2.c -=================================================================== ---- glibc-2.27.orig/posix/tst-rfc3484-2.c -+++ glibc-2.27/posix/tst-rfc3484-2.c -@@ -58,6 +58,7 @@ _res_hconf_init (void) - #undef USE_NSCD - #include "../sysdeps/posix/getaddrinfo.c" - -+service_user *__nss_hosts_database attribute_hidden; - - /* This is the beginning of the real test code. The above defines - (among other things) the function rfc3484_sort. */ -Index: glibc-2.27/posix/tst-rfc3484-3.c -=================================================================== ---- glibc-2.27.orig/posix/tst-rfc3484-3.c -+++ glibc-2.27/posix/tst-rfc3484-3.c -@@ -58,6 +58,7 @@ _res_hconf_init (void) - #undef USE_NSCD - #include "../sysdeps/posix/getaddrinfo.c" - -+service_user *__nss_hosts_database attribute_hidden; - - /* This is the beginning of the real test code. The above defines - (among other things) the function rfc3484_sort. */ -Index: glibc-2.27/posix/tst-rfc3484.c -=================================================================== ---- glibc-2.27.orig/posix/tst-rfc3484.c -+++ glibc-2.27/posix/tst-rfc3484.c -@@ -58,6 +58,7 @@ _res_hconf_init (void) - #undef USE_NSCD - #include "../sysdeps/posix/getaddrinfo.c" - -+service_user *__nss_hosts_database attribute_hidden; - - /* This is the beginning of the real test code. The above defines - (among other things) the function rfc3484_sort. */ diff --git a/pkey-get-reserved-name.patch b/pkey-get-reserved-name.patch deleted file mode 100644 index 3708292..0000000 --- a/pkey-get-reserved-name.patch +++ /dev/null @@ -1,19 +0,0 @@ -2018-02-07 Igor Gnatenko - - [BZ #22797] - * sysdeps/unix/sysv/linux/bits/mman-shared.h (pkey_get): Add - missing second underscore to parameter name. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/bits/mman-shared.h -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/bits/mman-shared.h -+++ glibc-2.27/sysdeps/unix/sysv/linux/bits/mman-shared.h -@@ -61,7 +61,7 @@ int pkey_set (int __key, unsigned int __ - - /* Return the access rights for the current thread for KEY, which must - have been allocated using pkey_alloc. */ --int pkey_get (int _key) __THROW; -+int pkey_get (int __key) __THROW; - - /* Free an allocated protection key, which must have been allocated - using pkey_alloc. */ diff --git a/powerpc-sys-ptrace-undefine-macros.patch b/powerpc-sys-ptrace-undefine-macros.patch deleted file mode 100644 index 371d21a..0000000 --- a/powerpc-sys-ptrace-undefine-macros.patch +++ /dev/null @@ -1,59 +0,0 @@ -2018-02-26 Tulio Magno Quites Machado Filho - - * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Undefine Linux - macros used in __ptrace_request. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -+++ glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -@@ -24,6 +24,49 @@ - - __BEGIN_DECLS - -+#if defined _LINUX_PTRACE_H || defined _ASM_POWERPC_PTRACE_H -+/* Do not let Linux headers macros interfere with enum __ptrace_request. */ -+# undef PTRACE_ATTACH -+# undef PTRACE_CONT -+# undef PTRACE_DETACH -+# undef PTRACE_GET_DEBUGREG -+# undef PTRACE_GETEVENTMSG -+# undef PTRACE_GETEVRREGS -+# undef PTRACE_GETFPREGS -+# undef PTRACE_GETREGS -+# undef PTRACE_GETREGS64 -+# undef PTRACE_GETREGSET -+# undef PTRACE_GETSIGINFO -+# undef PTRACE_GETSIGMASK -+# undef PTRACE_GETVRREGS -+# undef PTRACE_GETVSRREGS -+# undef PTRACE_INTERRUPT -+# undef PTRACE_KILL -+# undef PTRACE_LISTEN -+# undef PTRACE_PEEKDATA -+# undef PTRACE_PEEKSIGINFO -+# undef PTRACE_PEEKTEXT -+# undef PTRACE_POKEDATA -+# undef PTRACE_POKETEXT -+# undef PTRACE_SECCOMP_GET_FILTER -+# undef PTRACE_SEIZE -+# undef PTRACE_SET_DEBUGREG -+# undef PTRACE_SETEVRREGS -+# undef PTRACE_SETFPREGS -+# undef PTRACE_SETOPTIONS -+# undef PTRACE_SETREGS -+# undef PTRACE_SETREGS64 -+# undef PTRACE_SETREGSET -+# undef PTRACE_SETSIGINFO -+# undef PTRACE_SETSIGMASK -+# undef PTRACE_SETVRREGS -+# undef PTRACE_SETVSRREGS -+# undef PTRACE_SINGLEBLOCK -+# undef PTRACE_SINGLESTEP -+# undef PTRACE_SYSCALL -+# undef PTRACE_TRACEME -+#endif -+ - /* Type of the REQUEST argument to `ptrace.' */ - enum __ptrace_request - { diff --git a/powerpc-sys-ptrace-update.patch b/powerpc-sys-ptrace-update.patch deleted file mode 100644 index a75c667..0000000 --- a/powerpc-sys-ptrace-update.patch +++ /dev/null @@ -1,95 +0,0 @@ -2018-02-26 Dmitry V. Levin - - [BZ #22433] - [BZ #22807] - * sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (__ptrace_request): Add - PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS, - PTRACE_GETVRREGS, PTRACE_SETVRREGS, PTRACE_GETEVRREGS, - PTRACE_SETEVRREGS, PTRACE_GETREGS64, PTRACE_SETREGS64, - PTRACE_GET_DEBUGREG, PTRACE_SET_DEBUGREG, PTRACE_GETVSRREGS, - PTRACE_SETVSRREGS, and PTRACE_SINGLEBLOCK. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -=================================================================== ---- glibc-2.27.orig/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -+++ glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h -@@ -112,6 +112,22 @@ enum __ptrace_request - PTRACE_SINGLESTEP = 9, - #define PT_STEP PTRACE_SINGLESTEP - -+ /* Get all general purpose registers used by a process. */ -+ PTRACE_GETREGS = 12, -+#define PT_GETREGS PTRACE_GETREGS -+ -+ /* Set all general purpose registers used by a process. */ -+ PTRACE_SETREGS = 13, -+#define PT_SETREGS PTRACE_SETREGS -+ -+ /* Get all floating point registers used by a process. */ -+ PTRACE_GETFPREGS = 14, -+#define PT_GETFPREGS PTRACE_GETFPREGS -+ -+ /* Set all floating point registers used by a process. */ -+ PTRACE_SETFPREGS = 15, -+#define PT_SETFPREGS PTRACE_SETFPREGS -+ - /* Attach to a process that is already running. */ - PTRACE_ATTACH = 16, - #define PT_ATTACH PTRACE_ATTACH -@@ -120,10 +136,56 @@ enum __ptrace_request - PTRACE_DETACH = 17, - #define PT_DETACH PTRACE_DETACH - -+ /* Get all altivec registers used by a process. */ -+ PTRACE_GETVRREGS = 18, -+#define PT_GETVRREGS PTRACE_GETVRREGS -+ -+ /* Set all altivec registers used by a process. */ -+ PTRACE_SETVRREGS = 19, -+#define PT_SETVRREGS PTRACE_SETVRREGS -+ -+ /* Get all SPE registers used by a process. */ -+ PTRACE_GETEVRREGS = 20, -+#define PT_GETEVRREGS PTRACE_GETEVRREGS -+ -+ /* Set all SPE registers used by a process. */ -+ PTRACE_SETEVRREGS = 21, -+#define PT_SETEVRREGS PTRACE_SETEVRREGS -+ -+ /* Same as PTRACE_GETREGS except a 32-bit process will obtain -+ the full 64-bit registers. Implemented by 64-bit kernels only. */ -+ PTRACE_GETREGS64 = 22, -+#define PT_GETREGS64 PTRACE_GETREGS64 -+ -+ /* Same as PTRACE_SETREGS except a 32-bit process will set -+ the full 64-bit registers. Implemented by 64-bit kernels only. */ -+ PTRACE_SETREGS64 = 23, -+#define PT_SETREGS64 PTRACE_SETREGS64 -+ - /* Continue and stop at the next entry to or return from syscall. */ - PTRACE_SYSCALL = 24, - #define PT_SYSCALL PTRACE_SYSCALL - -+ /* Get a debug register of a process. */ -+ PTRACE_GET_DEBUGREG = 25, -+#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG -+ -+ /* Set a debug register of a process. */ -+ PTRACE_SET_DEBUGREG = 26, -+#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG -+ -+ /* Get the first 32 VSX registers of a process. */ -+ PTRACE_GETVSRREGS = 27, -+#define PT_GETVSRREGS PTRACE_GETVSRREGS -+ -+ /* Set the first 32 VSX registers of a process. */ -+ PTRACE_SETVSRREGS = 28, -+#define PT_SETVSRREGS PTRACE_SETVSRREGS -+ -+ /* Execute process until next taken branch. */ -+ PTRACE_SINGLEBLOCK = 256, -+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK -+ - /* Set ptrace filter options. */ - PTRACE_SETOPTIONS = 0x4200, - #define PT_SETOPTIONS PTRACE_SETOPTIONS diff --git a/realpath-ssize-max-overflow.patch b/realpath-ssize-max-overflow.patch deleted file mode 100644 index b9ddb09..0000000 --- a/realpath-ssize-max-overflow.patch +++ /dev/null @@ -1,129 +0,0 @@ -2018-05-09 Paul Pluzhnikov - - [BZ #22786] - * stdlib/canonicalize.c (__realpath): Fix overflow in path length - computation. - * stdlib/Makefile (test-bz22786): New test. - * stdlib/test-bz22786.c: New test. - -Index: glibc-2.27/stdlib/Makefile -=================================================================== ---- glibc-2.27.orig/stdlib/Makefile -+++ glibc-2.27/stdlib/Makefile -@@ -84,7 +84,7 @@ tests := tst-strtol tst-strtod testmb t - tst-cxa_atexit tst-on_exit test-atexit-race \ - test-at_quick_exit-race test-cxa_atexit-race \ - test-on_exit-race test-dlclose-exit-race \ -- tst-makecontext-align -+ tst-makecontext-align test-bz22786 - - tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \ - tst-tls-atexit tst-tls-atexit-nodelete -Index: glibc-2.27/stdlib/canonicalize.c -=================================================================== ---- glibc-2.27.orig/stdlib/canonicalize.c -+++ glibc-2.27/stdlib/canonicalize.c -@@ -181,7 +181,7 @@ __realpath (const char *name, char *reso - extra_buf = __alloca (path_max); - - len = strlen (end); -- if ((long int) (n + len) >= path_max) -+ if (path_max - n <= len) - { - __set_errno (ENAMETOOLONG); - goto error; -Index: glibc-2.27/stdlib/test-bz22786.c -=================================================================== ---- /dev/null -+++ glibc-2.27/stdlib/test-bz22786.c -@@ -0,0 +1,90 @@ -+/* Bug 22786: test for buffer overflow in realpath. -+ Copyright (C) 2018 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 -+ . */ -+ -+/* This file must be run from within a directory called "stdlib". */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int -+do_test (void) -+{ -+ const char dir[] = "bz22786"; -+ const char lnk[] = "bz22786/symlink"; -+ -+ rmdir (dir); -+ if (mkdir (dir, 0755) != 0 && errno != EEXIST) -+ { -+ printf ("mkdir %s: %m\n", dir); -+ return EXIT_FAILURE; -+ } -+ if (symlink (".", lnk) != 0 && errno != EEXIST) -+ { -+ printf ("symlink (%s, %s): %m\n", dir, lnk); -+ return EXIT_FAILURE; -+ } -+ -+ const size_t path_len = (size_t) INT_MAX + 1; -+ -+ DIAG_PUSH_NEEDS_COMMENT; -+#if __GNUC_PREREQ (7, 0) -+ /* GCC 7 warns about too-large allocations; here we need such -+ allocation to succeed for the test to work. */ -+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than="); -+#endif -+ char *path = malloc (path_len); -+ DIAG_POP_NEEDS_COMMENT; -+ -+ if (path == NULL) -+ { -+ printf ("malloc (%zu): %m\n", path_len); -+ return EXIT_UNSUPPORTED; -+ } -+ -+ /* Construct very long path = "bz22786/symlink/aaaa....." */ -+ char *p = mempcpy (path, lnk, sizeof (lnk) - 1); -+ *(p++) = '/'; -+ memset (p, 'a', path_len - (path - p) - 2); -+ p[path_len - (path - p) - 1] = '\0'; -+ -+ /* This call crashes before the fix for bz22786 on 32-bit platforms. */ -+ p = realpath (path, NULL); -+ -+ if (p != NULL || errno != ENAMETOOLONG) -+ { -+ printf ("realpath: %s (%m)", p); -+ return EXIT_FAILURE; -+ } -+ -+ /* Cleanup. */ -+ unlink (lnk); -+ rmdir (dir); -+ -+ return 0; -+} -+ -+#define TEST_FUNCTION do_test -+#include diff --git a/res-send-enomem.patch b/res-send-enomem.patch deleted file mode 100644 index de216f1..0000000 --- a/res-send-enomem.patch +++ /dev/null @@ -1,20 +0,0 @@ - [BZ #23005] - * resolv/res_send.c (__res_context_send): Return ENOMEM if - allocation of private copy of nsaddr_list fails. - -Index: glibc-2.27/resolv/res_send.c -=================================================================== ---- glibc-2.27.orig/resolv/res_send.c -+++ glibc-2.27/resolv/res_send.c -@@ -471,6 +471,11 @@ __res_context_send (struct resolv_contex - '\0', - sizeof (struct sockaddr_in6) - - sizeof (struct sockaddr_in)); -+ else -+ { -+ __set_errno (ENOMEM); -+ return -1; -+ } - } - EXT(statp).nscount = statp->nscount; - } diff --git a/riscv-fmax-fmin-nan.patch b/riscv-fmax-fmin-nan.patch deleted file mode 100644 index 95dbfcd..0000000 --- a/riscv-fmax-fmin-nan.patch +++ /dev/null @@ -1,112 +0,0 @@ -2018-02-22 Andrew Waterman - - [BZ # 22884] - * sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly. - * sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise. - * sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise. - * sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise. - -Index: glibc-2.27/sysdeps/riscv/rvd/s_fmax.c -=================================================================== ---- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmax.c -+++ glibc-2.27/sysdeps/riscv/rvd/s_fmax.c -@@ -17,12 +17,19 @@ - . */ - - #include -+#include - #include - - double - __fmax (double x, double y) - { -- asm ("fmax.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); -- return x; -+ double res; -+ -+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) -+ return x + y; -+ else -+ asm ("fmax.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); -+ -+ return res; - } - libm_alias_double (__fmax, fmax) -Index: glibc-2.27/sysdeps/riscv/rvd/s_fmin.c -=================================================================== ---- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmin.c -+++ glibc-2.27/sysdeps/riscv/rvd/s_fmin.c -@@ -17,12 +17,19 @@ - . */ - - #include -+#include - #include - - double - __fmin (double x, double y) - { -- asm ("fmin.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); -- return x; -+ double res; -+ -+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) -+ return x + y; -+ else -+ asm ("fmin.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); -+ -+ return res; - } - libm_alias_double (__fmin, fmin) -Index: glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c -=================================================================== ---- glibc-2.27.orig/sysdeps/riscv/rvf/s_fmaxf.c -+++ glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c -@@ -17,12 +17,19 @@ - . */ - - #include -+#include - #include - - float - __fmaxf (float x, float y) - { -- asm ("fmax.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); -- return x; -+ float res; -+ -+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) -+ return x + y; -+ else -+ asm ("fmax.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); -+ -+ return res; - } - libm_alias_float (__fmax, fmax) -Index: glibc-2.27/sysdeps/riscv/rvf/s_fminf.c -=================================================================== ---- glibc-2.27.orig/sysdeps/riscv/rvf/s_fminf.c -+++ glibc-2.27/sysdeps/riscv/rvf/s_fminf.c -@@ -17,12 +17,19 @@ - . */ - - #include -+#include - #include - - float - __fminf (float x, float y) - { -- asm ("fmin.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); -- return x; -+ float res; -+ -+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) -+ return x + y; -+ else -+ asm ("fmin.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); -+ -+ return res; - } - libm_alias_float (__fmin, fmin) diff --git a/riscv-kernel-sigaction.patch b/riscv-kernel-sigaction.patch deleted file mode 100644 index aedf329..0000000 --- a/riscv-kernel-sigaction.patch +++ /dev/null @@ -1,17 +0,0 @@ -2018-04-28 Aurelien Jarno - - [BZ #23069] - * sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h: New file. - -Index: glibc-2.27/sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h -=================================================================== ---- /dev/null -+++ glibc-2.27/sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h -@@ -0,0 +1,7 @@ -+/* This is the sigaction structure from the RISC-V Linux 4.15 kernel. */ -+ -+struct kernel_sigaction { -+ __sighandler_t k_sa_handler; -+ unsigned long sa_flags; -+ sigset_t sa_mask; -+}; diff --git a/riscv-readelflib.patch b/riscv-readelflib.patch deleted file mode 100644 index 344f80d..0000000 --- a/riscv-readelflib.patch +++ /dev/null @@ -1,27 +0,0 @@ -2018-02-09 DJ Delorie - - [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. */ diff --git a/riscv-tls-init.patch b/riscv-tls-init.patch deleted file mode 100644 index 83e8649..0000000 --- a/riscv-tls-init.patch +++ /dev/null @@ -1,51 +0,0 @@ -2018-02-22 DJ Delorie - - * sysdeps/riscv/tls-macros.h: Do not initialize $gp. - -Index: glibc-2.27/sysdeps/riscv/tls-macros.h -=================================================================== ---- glibc-2.27.orig/sysdeps/riscv/tls-macros.h -+++ glibc-2.27/sysdeps/riscv/tls-macros.h -@@ -23,19 +23,9 @@ - #include - #include "dl-tls.h" - --#define LOAD_GP \ -- ".option push\n\t" \ -- ".option norelax\n\t" \ -- "la gp, __global_pointer$\n\t" \ -- ".option pop\n\t" -- --#define UNLOAD_GP -- - #define TLS_GD(x) \ - ({ void *__result; \ -- asm (LOAD_GP \ -- "la.tls.gd %0, " #x "\n\t" \ -- UNLOAD_GP \ -+ asm ("la.tls.gd %0, " #x "\n\t" \ - : "=r" (__result)); \ - __tls_get_addr (__result); }) - -@@ -43,19 +33,15 @@ - - #define TLS_IE(x) \ - ({ void *__result; \ -- asm (LOAD_GP \ -- "la.tls.ie %0, " #x "\n\t" \ -+ asm ("la.tls.ie %0, " #x "\n\t" \ - "add %0, %0, tp\n\t" \ -- UNLOAD_GP \ - : "=r" (__result)); \ - __result; }) - - #define TLS_LE(x) \ - ({ void *__result; \ -- asm (LOAD_GP \ -- "lui %0, %%tprel_hi(" #x ")\n\t" \ -+ asm ("lui %0, %%tprel_hi(" #x ")\n\t" \ - "add %0, %0, tp, %%tprel_add(" #x ")\n\t" \ - "addi %0, %0, %%tprel_lo(" #x ")\n\t" \ -- UNLOAD_GP \ - : "=r" (__result)); \ - __result; }) From 8fdb38368b6e147421d68d7462d5781c180ef2ffe382a9ee6108140299d55fdf Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 12 Sep 2018 07:22:12 +0000 Subject: [PATCH 2/8] Accepting request 635265 from home:Andreas_Schwab:Factory - Add libpng-devel and zlib-devel for utils build - Add glibc-locale-base subpackage containing only C, C.UTF-8 and en_US.UTF-8 locales (fate#326551) OBS-URL: https://build.opensuse.org/request/show/635265 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=510 --- baselibs.conf | 3 ++- glibc.changes | 11 +++++++++++ glibc.spec | 33 +++++++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/baselibs.conf b/baselibs.conf index 0af8f27..522c24b 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -8,10 +8,11 @@ glibc prereq -glibc-x86 +/usr/lib/getconf/[^g] +/usr/sbin/iconvconfig -> /usr/sbin/iconvconfig- -glibc-locale +glibc-locale-base arch i586 block! +/usr/lib(64)?/gconv/gconv-modules targettype x86 -/usr/lib(64)?/gconv/gconv-modules + obsoletes "glibc-locale-" glibc-devel requires "glibc- = %version" arch i586 block! diff --git a/glibc.changes b/glibc.changes index 8ba04c2..c988207 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Sep 12 06:47:33 UTC 2018 - schwab@suse.de + +- Add libpng-devel and zlib-devel for utils build + +------------------------------------------------------------------- +Wed Aug 15 13:53:41 UTC 2018 - schwab@suse.de + +- Add glibc-locale-base subpackage containing only C, C.UTF-8 and + en_US.UTF-8 locales (fate#326551) + ------------------------------------------------------------------- Thu Aug 2 07:48:07 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index a847528..16e0f47 100644 --- a/glibc.spec +++ b/glibc.spec @@ -76,6 +76,8 @@ BuildRequires: python3-pexpect %endif %if %{build_utils} BuildRequires: gd-devel +BuildRequires: libpng-devel +BuildRequires: zlib-devel %endif %if "%flavor" == "i686" ExclusiveArch: i586 i686 @@ -347,12 +349,22 @@ use the internationalization features of the GNU libc. It is normally not necessary to install this packages, the data files are already created. -%package locale +%package locale-base Summary: Locale Data for Localized Programs License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later Group: System/Libraries Requires(post): /bin/cat Requires: glibc = %{version} + +%description locale-base +Locale data for the internationalisation features of the GNU C library. +This package contains only the US-english locales. + +%package locale +Summary: Locale Data for Localized Programs +License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later +Group: System/Libraries +Requires: glibc-locale-base = %{version} # bug437293 %ifarch ppc64 Obsoletes: glibc-locale-64bit @@ -839,7 +851,10 @@ cc-base/elf/ldconfig -vn $destdir # non-parallel build for install-locales: 9:34mins # parallel build with fdupes: 7:08mins make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + # Avoid hardlinks across subpackages + mv %{buildroot}/usr/lib/locale/{en_US,C}.utf8 . %fdupes %{buildroot}/usr/lib/locale + mv {en_US,C}.utf8 %{buildroot}/usr/lib/locale/ cd .. %endif # Create file list for glibc-locale package @@ -992,7 +1007,7 @@ rm %{buildroot}/%{_lib}/lp64d %{buildroot}%{_libdir}/lp64d %post -p %{_sbindir}/glibc_post_upgrade %postun -p /sbin/ldconfig -%post locale +%post locale-base for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do [ -d "$l.d" ] || continue echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l" @@ -1173,14 +1188,24 @@ exit 0 %{_sbindir}/glibc_post_upgrade %{_sbindir}/iconvconfig -%files locale -f libc.lang +%files locale-base -f libc.lang %defattr(-,root,root) %{_datadir}/locale/locale.alias %if %{build_locales} - /usr/lib/locale +%dir %{_prefix}/lib/locale +%{_prefix}/lib/locale/C.utf8 +%{_prefix}/lib/locale/en_US.utf8 %endif %{_libdir}/gconv +%files locale +%defattr(-,root,root) +%if %{build_locales} +%{_prefix}/lib/locale +%exclude %{_prefix}/lib/locale/C.utf8 +%exclude %{_prefix}/lib/locale/en_US.utf8 +%endif + %files devel %defattr(-,root,root) %license COPYING COPYING.LIB From 9a399490793a386d5bfce4704365f8c0b2982423e3c7261f812bddfc85ff4480 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 27 Sep 2018 13:22:16 +0000 Subject: [PATCH 3/8] Accepting request 638790 from home:Andreas_Schwab:Factory - unwind-ctor.patch: Add missing unwind information to ld.so on powerpc32 (BZ #23707) - old-getdents64.patch: Rewrite __old_getdents64 (BZ #23497) - nss-files-leak.patch: Fix file stream leak in aliases lookup (BZ #23521) - riscv-feholdexcept-setround.patch: Fix rounding save/restore bug - pthread-cond-broadcast-waiters-after-spinning.patch: Fix waiters-after-spinning case (BZ #23538) - regex-uninit-memory-access.patch: fix uninitialized memory access (BZ #23578) - spawni-maybe-script-execute.patch: Fix segfault in maybe_script_execute - gethostid-gethostbyname-failure.patch: Check for NULL value from gethostbyname_r (BZ #23679) - strstr-huge-needle.patch: Fix strstr bug with huge needles (BZ #23637) OBS-URL: https://build.opensuse.org/request/show/638790 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=511 --- gethostid-gethostbyname-failure.patch | 165 ++++++++++ glibc.changes | 17 + glibc.spec | 28 ++ nss-files-leak.patch | 307 ++++++++++++++++++ old-getdents64.patch | 249 ++++++++++++++ ...ond-broadcast-waiters-after-spinning.patch | 27 ++ regex-uninit-memory-access.patch | 261 +++++++++++++++ riscv-feholdexcept-setround.patch | 19 ++ spawni-maybe-script-execute.patch | 18 + strstr-huge-needle.patch | 95 ++++++ unwind-ctor.patch | 131 ++++++++ 11 files changed, 1317 insertions(+) create mode 100644 gethostid-gethostbyname-failure.patch create mode 100644 nss-files-leak.patch create mode 100644 old-getdents64.patch create mode 100644 pthread-cond-broadcast-waiters-after-spinning.patch create mode 100644 regex-uninit-memory-access.patch create mode 100644 riscv-feholdexcept-setround.patch create mode 100644 spawni-maybe-script-execute.patch create mode 100644 strstr-huge-needle.patch create mode 100644 unwind-ctor.patch diff --git a/gethostid-gethostbyname-failure.patch b/gethostid-gethostbyname-failure.patch new file mode 100644 index 0000000..589bb55 --- /dev/null +++ b/gethostid-gethostbyname-failure.patch @@ -0,0 +1,165 @@ +2018-09-20 Florian Weimer + + * misc/tst-gethostid.c: New file. + * misc/Makefile [$(build-shared)] (tests): Add tst-gethostid. + (tst-gethostid): Link with -ldl. + +2018-09-20 Mingli Yu + + * sysdeps/unix/sysv/linux/gethostid.c (gethostid): Check for NULL + value from gethostbyname_r. + +Index: glibc-2.28/misc/Makefile +=================================================================== +--- glibc-2.28.orig/misc/Makefile ++++ glibc-2.28/misc/Makefile +@@ -86,6 +86,11 @@ tests := tst-dirname tst-tsearch tst-fds + tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ + tst-preadvwritev2 tst-preadvwritev64v2 + ++# Tests which need libdl. ++ifeq (yes,$(build-shared)) ++tests += tst-gethostid ++endif ++ + tests-internal := tst-atomic tst-atomic-long tst-allocate_once + tests-static := tst-empty + +@@ -145,3 +150,5 @@ tst-allocate_once-ENV = MALLOC_TRACE=$(o + $(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out + $(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \ + $(evaluate-test) ++ ++$(objpfx)tst-gethostid: $(libdl) +Index: glibc-2.28/misc/tst-gethostid.c +=================================================================== +--- /dev/null ++++ glibc-2.28/misc/tst-gethostid.c +@@ -0,0 +1,108 @@ ++/* Basic test for gethostid. ++ Copyright (C) 2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Initial test is run outside a chroot, to increase the likelihood of ++ success. */ ++static void ++outside_chroot (void *closure) ++{ ++ long id = gethostid (); ++ printf ("info: host ID outside chroot: 0x%lx\n", id); ++} ++ ++/* The same, but this time perform a chroot operation. */ ++static void ++in_chroot (void *closure) ++{ ++ const char *chroot_path = closure; ++ xchroot (chroot_path); ++ long id = gethostid (); ++ printf ("info: host ID in chroot: 0x%lx\n", id); ++} ++ ++static int ++do_test (void) ++{ ++ support_isolate_in_subprocess (outside_chroot, NULL); ++ ++ /* Now run the test inside a chroot. */ ++ support_become_root (); ++ if (!support_can_chroot ()) ++ /* Cannot perform further tests. */ ++ return 0; ++ ++ /* Only use nss_files. */ ++ __nss_configure_lookup ("hosts", "files"); ++ ++ /* Load the DSO outside of the chroot. */ ++ xdlopen (LIBNSS_FILES_SO, RTLD_LAZY); ++ ++ char *chroot_dir = support_create_temp_directory ("tst-gethostid-"); ++ support_isolate_in_subprocess (in_chroot, chroot_dir); ++ ++ /* Tests with /etc/hosts in the chroot. */ ++ { ++ char *path = xasprintf ("%s/etc", chroot_dir); ++ add_temp_file (path); ++ xmkdir (path, 0777); ++ free (path); ++ path = xasprintf ("%s/etc/hosts", chroot_dir); ++ add_temp_file (path); ++ ++ FILE *fp = xfopen (path, "w"); ++ xfclose (fp); ++ printf ("info: chroot test with an empty /etc/hosts file\n"); ++ support_isolate_in_subprocess (in_chroot, chroot_dir); ++ ++ char hostname[1024]; ++ int ret = gethostname (hostname, sizeof (hostname)); ++ if (ret < 0) ++ printf ("warning: invalid result from gethostname: %d\n", ret); ++ else if (strlen (hostname) == 0) ++ puts ("warning: gethostname returned empty string"); ++ else ++ { ++ printf ("info: chroot test with IPv6 address in /etc/hosts for: %s\n", ++ hostname); ++ fp = xfopen (path, "w"); ++ /* Use an IPv6 address to induce another lookup failure. */ ++ fprintf (fp, "2001:db8::1 %s\n", hostname); ++ xfclose (fp); ++ support_isolate_in_subprocess (in_chroot, chroot_dir); ++ } ++ free (path); ++ } ++ free (chroot_dir); ++ ++ return 0; ++} ++ ++#include +Index: glibc-2.28/sysdeps/unix/sysv/linux/gethostid.c +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/gethostid.c ++++ glibc-2.28/sysdeps/unix/sysv/linux/gethostid.c +@@ -102,12 +102,12 @@ gethostid (void) + { + int ret = __gethostbyname_r (hostname, &hostbuf, + tmpbuf.data, tmpbuf.length, &hp, &herr); +- if (ret == 0) ++ if (ret == 0 && hp != NULL) + break; + else + { + /* Enlarge the buffer on ERANGE. */ +- if (herr == NETDB_INTERNAL && errno == ERANGE) ++ if (ret != 0 && herr == NETDB_INTERNAL && errno == ERANGE) + { + if (!scratch_buffer_grow (&tmpbuf)) + return 0; diff --git a/glibc.changes b/glibc.changes index c988207..a4d0592 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Wed Sep 26 09:41:59 UTC 2018 - schwab@suse.de + +- unwind-ctor.patch: Add missing unwind information to ld.so on powerpc32 + (BZ #23707) +- old-getdents64.patch: Rewrite __old_getdents64 (BZ #23497) +- nss-files-leak.patch: Fix file stream leak in aliases lookup (BZ #23521) +- riscv-feholdexcept-setround.patch: Fix rounding save/restore bug +- pthread-cond-broadcast-waiters-after-spinning.patch: Fix + waiters-after-spinning case (BZ #23538) +- regex-uninit-memory-access.patch: fix uninitialized memory access (BZ + #23578) +- spawni-maybe-script-execute.patch: Fix segfault in maybe_script_execute +- gethostid-gethostbyname-failure.patch: Check for NULL value from + gethostbyname_r (BZ #23679) +- strstr-huge-needle.patch: Fix strstr bug with huge needles (BZ #23637) + ------------------------------------------------------------------- Wed Sep 12 06:47:33 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index 16e0f47..fcafa51 100644 --- a/glibc.spec +++ b/glibc.spec @@ -268,6 +268,24 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM Add missing unwind information to ld.so on powerpc32 (BZ #23707) +Patch1000: unwind-ctor.patch +# PATCH-FIX-UPSTREAM Rewrite __old_getdents64 (BZ #23497) +Patch1001: old-getdents64.patch +# PATCH-FIX-UPSTREAM nss_files: Fix file stream leak in aliases lookup (BZ #23521) +Patch1002: nss-files-leak.patch +# PATCH-FIX-UPSTREAM RISC-V: Fix rounding save/restore bug +Patch1003: riscv-feholdexcept-setround.patch +# PATCH-FIX-UPSTREAM pthread_cond_broadcast: Fix waiters-after-spinning case (BZ #23538) +Patch1004: pthread-cond-broadcast-waiters-after-spinning.patch +# PATCH-FIX-UPSTREAM regex: fix uninitialized memory access (BZ #23578) +Patch1005: regex-uninit-memory-access.patch +# PATCH-FIX-UPSTREAM Fix segfault in maybe_script_execute +Patch1006: spawni-maybe-script-execute.patch +# PATCH-FIX-UPSTREAM Linux gethostid: Check for NULL value from gethostbyname_r (BZ #23679) +Patch1007: gethostid-gethostbyname-failure.patch +# PATCH-FIX-UPSTREAM Fix strstr bug with huge needles (BZ #23637) +Patch1008: strstr-huge-needle.patch ### # Patches awaiting upstream approval @@ -477,6 +495,16 @@ makedb: A program to create a database for nss %patch304 -p1 %patch306 -p1 +%patch1000 -p1 +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 +%patch1006 -p1 +%patch1007 -p1 +%patch1008 -p1 + %patch2000 -p1 %patch2004 -p1 %patch2005 -p1 diff --git a/nss-files-leak.patch b/nss-files-leak.patch new file mode 100644 index 0000000..11af9b5 --- /dev/null +++ b/nss-files-leak.patch @@ -0,0 +1,307 @@ +2018-08-14 Florian Weimer + + [BZ #23521] + [BZ #23522] + * nss/nss_files/files-alias.c (get_next_alias): During :include: + processing, bail out if no room, and close the stream before + returning ERANGE. + * nss/Makefile (tests): Add tst-nss-files-alias-leak. + (tst-nss-files-alias-leak): Link with libdl. + (tst-nss-files-alias-leak.out): Depend on nss_files. + + * nss/tst-nss-files-alias-leak.c: New file. + +Index: glibc-2.28/nss/Makefile +=================================================================== +--- glibc-2.28.orig/nss/Makefile ++++ glibc-2.28/nss/Makefile +@@ -65,6 +65,7 @@ ifeq (yes,$(build-shared)) + tests += tst-nss-files-hosts-erange + tests += tst-nss-files-hosts-multi + tests += tst-nss-files-hosts-getent ++tests += tst-nss-files-alias-leak + endif + + # If we have a thread library then we can test cancellation against +@@ -171,3 +172,5 @@ endif + $(objpfx)tst-nss-files-hosts-erange: $(libdl) + $(objpfx)tst-nss-files-hosts-multi: $(libdl) + $(objpfx)tst-nss-files-hosts-getent: $(libdl) ++$(objpfx)tst-nss-files-alias-leak: $(libdl) ++$(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so +Index: glibc-2.28/nss/nss_files/files-alias.c +=================================================================== +--- glibc-2.28.orig/nss/nss_files/files-alias.c ++++ glibc-2.28/nss/nss_files/files-alias.c +@@ -221,6 +221,13 @@ get_next_alias (FILE *stream, const char + { + while (! feof_unlocked (listfile)) + { ++ if (room_left < 2) ++ { ++ free (old_line); ++ fclose (listfile); ++ goto no_more_room; ++ } ++ + first_unused[room_left - 1] = '\xff'; + line = fgets_unlocked (first_unused, room_left, + listfile); +@@ -229,6 +236,7 @@ get_next_alias (FILE *stream, const char + if (first_unused[room_left - 1] != '\xff') + { + free (old_line); ++ fclose (listfile); + goto no_more_room; + } + +@@ -256,6 +264,7 @@ get_next_alias (FILE *stream, const char + + __alignof__ (char *))) + { + free (old_line); ++ fclose (listfile); + goto no_more_room; + } + room_left -= ((first_unused - cp) +Index: glibc-2.28/nss/tst-nss-files-alias-leak.c +=================================================================== +--- /dev/null ++++ glibc-2.28/nss/tst-nss-files-alias-leak.c +@@ -0,0 +1,237 @@ ++/* Check for file descriptor leak in alias :include: processing (bug 23521). ++ Copyright (C) 2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct support_chroot *chroot_env; ++ ++/* Number of the aliases for the "many" user. This must be large ++ enough to trigger reallocation for the pointer array, but result in ++ answers below the maximum size tried in do_test. */ ++enum { many_aliases = 30 }; ++ ++static void ++prepare (int argc, char **argv) ++{ ++ chroot_env = support_chroot_create ++ ((struct support_chroot_configuration) { } ); ++ ++ char *path = xasprintf ("%s/etc/aliases", chroot_env->path_chroot); ++ add_temp_file (path); ++ support_write_file_string ++ (path, ++ "user1: :include:/etc/aliases.user1\n" ++ "user2: :include:/etc/aliases.user2\n" ++ "comment: comment1, :include:/etc/aliases.comment\n" ++ "many: :include:/etc/aliases.many\n"); ++ free (path); ++ ++ path = xasprintf ("%s/etc/aliases.user1", chroot_env->path_chroot); ++ add_temp_file (path); ++ support_write_file_string (path, "alias1\n"); ++ free (path); ++ ++ path = xasprintf ("%s/etc/aliases.user2", chroot_env->path_chroot); ++ add_temp_file (path); ++ support_write_file_string (path, "alias1a, alias2\n"); ++ free (path); ++ ++ path = xasprintf ("%s/etc/aliases.comment", chroot_env->path_chroot); ++ add_temp_file (path); ++ support_write_file_string ++ (path, ++ /* The line must be longer than the line with the :include: ++ directive in /etc/aliases. */ ++ "# Long line. ##############################################\n" ++ "comment2\n"); ++ free (path); ++ ++ path = xasprintf ("%s/etc/aliases.many", chroot_env->path_chroot); ++ add_temp_file (path); ++ FILE *fp = xfopen (path, "w"); ++ for (int i = 0; i < many_aliases; ++i) ++ fprintf (fp, "a%d\n", i); ++ TEST_VERIFY_EXIT (! ferror (fp)); ++ xfclose (fp); ++ free (path); ++} ++ ++/* The names of the users to test. */ ++static const char *users[] = { "user1", "user2", "comment", "many" }; ++ ++static void ++check_aliases (int id, const struct aliasent *e) ++{ ++ TEST_VERIFY_EXIT (id >= 0 || id < array_length (users)); ++ const char *name = users[id]; ++ TEST_COMPARE_BLOB (e->alias_name, strlen (e->alias_name), ++ name, strlen (name)); ++ ++ switch (id) ++ { ++ case 0: ++ TEST_COMPARE (e->alias_members_len, 1); ++ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), ++ "alias1", strlen ("alias1")); ++ break; ++ ++ case 1: ++ TEST_COMPARE (e->alias_members_len, 2); ++ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), ++ "alias1a", strlen ("alias1a")); ++ TEST_COMPARE_BLOB (e->alias_members[1], strlen (e->alias_members[1]), ++ "alias2", strlen ("alias2")); ++ break; ++ ++ case 2: ++ TEST_COMPARE (e->alias_members_len, 2); ++ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), ++ "comment1", strlen ("comment1")); ++ TEST_COMPARE_BLOB (e->alias_members[1], strlen (e->alias_members[1]), ++ "comment2", strlen ("comment2")); ++ break; ++ ++ case 3: ++ TEST_COMPARE (e->alias_members_len, many_aliases); ++ for (int i = 0; i < e->alias_members_len; ++i) ++ { ++ char alias[30]; ++ int len = snprintf (alias, sizeof (alias), "a%d", i); ++ TEST_VERIFY_EXIT (len > 0); ++ TEST_COMPARE_BLOB (e->alias_members[i], strlen (e->alias_members[i]), ++ alias, len); ++ } ++ break; ++ } ++} ++ ++static int ++do_test (void) ++{ ++ /* Make sure we don't try to load the module in the chroot. */ ++ if (dlopen (LIBNSS_FILES_SO, RTLD_NOW) == NULL) ++ FAIL_EXIT1 ("could not load " LIBNSS_FILES_SO ": %s", dlerror ()); ++ ++ /* Some of these descriptors will become unavailable if there is a ++ file descriptor leak. 10 is chosen somewhat arbitrarily. The ++ array must be longer than the number of files opened by nss_files ++ at the same time (currently that number is 2). */ ++ int next_descriptors[10]; ++ for (size_t i = 0; i < array_length (next_descriptors); ++i) ++ { ++ next_descriptors[i] = dup (0); ++ TEST_VERIFY_EXIT (next_descriptors[i] > 0); ++ } ++ for (size_t i = 0; i < array_length (next_descriptors); ++i) ++ xclose (next_descriptors[i]); ++ ++ support_become_root (); ++ if (!support_can_chroot ()) ++ return EXIT_UNSUPPORTED; ++ ++ __nss_configure_lookup ("aliases", "files"); ++ ++ xchroot (chroot_env->path_chroot); ++ ++ /* Attempt various buffer sizes. If the operation succeeds, we ++ expect correct data. */ ++ for (int id = 0; id < array_length (users); ++id) ++ { ++ bool found = false; ++ for (size_t size = 1; size <= 1000; ++size) ++ { ++ void *buffer = malloc (size); ++ struct aliasent result; ++ struct aliasent *res; ++ errno = EINVAL; ++ int ret = getaliasbyname_r (users[id], &result, buffer, size, &res); ++ if (ret == 0) ++ { ++ if (res != NULL) ++ { ++ found = true; ++ check_aliases (id, res); ++ } ++ else ++ { ++ support_record_failure (); ++ printf ("error: failed lookup for user \"%s\", size %zu\n", ++ users[id], size); ++ } ++ } ++ else if (ret != ERANGE) ++ { ++ support_record_failure (); ++ printf ("error: invalid return code %d (user \%s\", size %zu)\n", ++ ret, users[id], size); ++ } ++ free (buffer); ++ ++ /* Make sure that we did not have a file descriptor leak. */ ++ for (size_t i = 0; i < array_length (next_descriptors); ++i) ++ { ++ int new_fd = dup (0); ++ if (new_fd != next_descriptors[i]) ++ { ++ support_record_failure (); ++ printf ("error: descriptor %d at index %zu leaked" ++ " (user \"%s\", size %zu)\n", ++ next_descriptors[i], i, users[id], size); ++ ++ /* Close unexpected descriptor, the leak probing ++ descriptors, and the leaked descriptor ++ next_descriptors[i]. */ ++ xclose (new_fd); ++ for (size_t j = 0; j <= i; ++j) ++ xclose (next_descriptors[j]); ++ goto next_size; ++ } ++ } ++ for (size_t i = 0; i < array_length (next_descriptors); ++i) ++ xclose (next_descriptors[i]); ++ ++ next_size: ++ ; ++ } ++ if (!found) ++ { ++ support_record_failure (); ++ printf ("error: user %s not found\n", users[id]); ++ } ++ } ++ ++ support_chroot_free (chroot_env); ++ return 0; ++} ++ ++#define PREPARE prepare ++#include diff --git a/old-getdents64.patch b/old-getdents64.patch new file mode 100644 index 0000000..d7dbf4f --- /dev/null +++ b/old-getdents64.patch @@ -0,0 +1,249 @@ +2018-08-10 Florian Weimer + + [BZ #23497] + * sysdeps/unix/sysv/linux/getdents64.c (handle_overflow): New + function. + (__old_getdents64): Use getdents64. Convert entries without + moving them. + * sysdeps/unix/sysv/linux/tst-readdir64-compat.c: New file. + * sysdeps/unix/sysv/linux/Makefile (tests-internal): Add + tst-readdir64-compat. + +Index: glibc-2.28/sysdeps/unix/sysv/linux/Makefile +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/Makefile ++++ glibc-2.28/sysdeps/unix/sysv/linux/Makefile +@@ -161,6 +161,7 @@ inhibit-glue = yes + + ifeq ($(subdir),dirent) + sysdep_routines += getdirentries getdirentries64 ++tests-internal += tst-readdir64-compat + endif + + ifeq ($(subdir),nis) +Index: glibc-2.28/sysdeps/unix/sysv/linux/getdents64.c +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/getdents64.c ++++ glibc-2.28/sysdeps/unix/sysv/linux/getdents64.c +@@ -33,41 +33,80 @@ strong_alias (__getdents64, __getdents) + # include + + # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) +-# include ++# include ++# include + +-/* kernel definition of as of 3.2. */ +-struct compat_linux_dirent ++static ssize_t ++handle_overflow (int fd, __off64_t offset, ssize_t count) + { +- /* Both d_ino and d_off are compat_ulong_t which are defined in all +- architectures as 'u32'. */ +- uint32_t d_ino; +- uint32_t d_off; +- unsigned short d_reclen; +- char d_name[1]; +-}; ++ /* If this is the first entry in the buffer, we can report the ++ error. */ ++ if (count == 0) ++ { ++ __set_errno (EOVERFLOW); ++ return -1; ++ } ++ ++ /* Otherwise, seek to the overflowing entry, so that the next call ++ will report the error, and return the data read so far.. */ ++ if (__lseek64 (fd, offset, SEEK_SET) != 0) ++ return -1; ++ return count; ++} + + ssize_t + __old_getdents64 (int fd, char *buf, size_t nbytes) + { +- ssize_t retval = INLINE_SYSCALL_CALL (getdents, fd, buf, nbytes); ++ /* We do not move the individual directory entries. This is only ++ possible if the target type (struct __old_dirent64) is smaller ++ than the source type. */ ++ _Static_assert (offsetof (struct __old_dirent64, d_name) ++ <= offsetof (struct dirent64, d_name), ++ "__old_dirent64 is larger than dirent64"); ++ _Static_assert (__alignof__ (struct __old_dirent64) ++ <= __alignof__ (struct dirent64), ++ "alignment of __old_dirent64 is larger than dirent64"); + +- /* The kernel added the d_type value after the name. Change this now. */ +- if (retval != -1) ++ ssize_t retval = INLINE_SYSCALL_CALL (getdents64, fd, buf, nbytes); ++ if (retval > 0) + { +- union +- { +- struct compat_linux_dirent k; +- struct dirent u; +- } *kbuf = (void *) buf; +- +- while ((char *) kbuf < buf + retval) ++ char *p = buf; ++ char *end = buf + retval; ++ while (p < end) + { +- char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1); +- memmove (kbuf->u.d_name, kbuf->k.d_name, +- strlen (kbuf->k.d_name) + 1); +- kbuf->u.d_type = d_type; ++ struct dirent64 *source = (struct dirent64 *) p; ++ ++ /* Copy out the fixed-size data. */ ++ __ino_t ino = source->d_ino; ++ __off64_t offset = source->d_off; ++ unsigned int reclen = source->d_reclen; ++ unsigned char type = source->d_type; ++ ++ /* Check for ino_t overflow. */ ++ if (__glibc_unlikely (ino != source->d_ino)) ++ return handle_overflow (fd, offset, p - buf); ++ ++ /* Convert to the target layout. Use a separate struct and ++ memcpy to side-step aliasing issues. */ ++ struct __old_dirent64 result; ++ result.d_ino = ino; ++ result.d_off = offset; ++ result.d_reclen = reclen; ++ result.d_type = type; ++ ++ /* Write the fixed-sized part of the result to the ++ buffer. */ ++ size_t result_name_offset = offsetof (struct __old_dirent64, d_name); ++ memcpy (p, &result, result_name_offset); ++ ++ /* Adjust the position of the name if necessary. Copy ++ everything until the end of the record, including the ++ terminating NUL byte. */ ++ if (result_name_offset != offsetof (struct dirent64, d_name)) ++ memmove (p + result_name_offset, source->d_name, ++ reclen - offsetof (struct dirent64, d_name)); + +- kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen); ++ p += reclen; + } + } + return retval; +Index: glibc-2.28/sysdeps/unix/sysv/linux/tst-readdir64-compat.c +=================================================================== +--- /dev/null ++++ glibc-2.28/sysdeps/unix/sysv/linux/tst-readdir64-compat.c +@@ -0,0 +1,111 @@ ++/* Test readdir64 compatibility symbol. ++ Copyright (C) 2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Copied from . */ ++struct __old_dirent64 ++ { ++ __ino_t d_ino; ++ __off64_t d_off; ++ unsigned short int d_reclen; ++ unsigned char d_type; ++ char d_name[256]; ++ }; ++ ++typedef struct __old_dirent64 *(*compat_readdir64_type) (DIR *); ++ ++#if TEST_COMPAT (libc, GLIBC_2_1, GLIBC_2_2) ++struct __old_dirent64 *compat_readdir64 (DIR *); ++compat_symbol_reference (libc, compat_readdir64, readdir64, GLIBC_2_1); ++#endif ++ ++static int ++do_test (void) ++{ ++#if TEST_COMPAT (libc, GLIBC_2_1, GLIBC_2_2) ++ ++ /* Directory stream using the non-compat readdir64 symbol. The test ++ checks against this. */ ++ DIR *dir_reference = opendir ("."); ++ TEST_VERIFY_EXIT (dir_reference != NULL); ++ DIR *dir_test = opendir ("."); ++ TEST_VERIFY_EXIT (dir_test != NULL); ++ ++ /* This loop assumes that the enumeration order is consistent for ++ two different handles. Nothing should write to the current ++ directory (in the source tree) while this test runs, so there ++ should not be any difference due to races. */ ++ size_t count = 0; ++ while (true) ++ { ++ errno = 0; ++ struct dirent64 *entry_reference = readdir64 (dir_reference); ++ if (entry_reference == NULL && errno != 0) ++ FAIL_EXIT1 ("readdir64 entry %zu: %m\n", count); ++ struct __old_dirent64 *entry_test = compat_readdir64 (dir_test); ++ if (entry_reference == NULL) ++ { ++ if (errno == EOVERFLOW) ++ { ++ TEST_VERIFY (entry_reference->d_ino ++ != (__ino_t) entry_reference->d_ino); ++ printf ("info: inode number overflow at entry %zu\n", count); ++ break; ++ } ++ if (errno != 0) ++ FAIL_EXIT1 ("compat readdir64 entry %zu: %m\n", count); ++ } ++ ++ /* Check that both streams end at the same time. */ ++ if (entry_reference == NULL) ++ { ++ TEST_VERIFY (entry_test == NULL); ++ break; ++ } ++ else ++ TEST_VERIFY_EXIT (entry_test != NULL); ++ ++ /* Check that the entries are the same. */ ++ TEST_COMPARE_BLOB (entry_reference->d_name, ++ strlen (entry_reference->d_name), ++ entry_test->d_name, strlen (entry_test->d_name)); ++ TEST_COMPARE (entry_reference->d_ino, entry_test->d_ino); ++ TEST_COMPARE (entry_reference->d_off, entry_test->d_off); ++ TEST_COMPARE (entry_reference->d_type, entry_test->d_type); ++ TEST_COMPARE (entry_reference->d_reclen, entry_test->d_reclen); ++ ++ ++count; ++ } ++ printf ("info: %zu directory entries found\n", count); ++ TEST_VERIFY (count >= 3); /* ".", "..", and some source files. */ ++ ++ TEST_COMPARE (closedir (dir_test), 0); ++ TEST_COMPARE (closedir (dir_reference), 0); ++#endif ++ return 0; ++} ++ ++#include diff --git a/pthread-cond-broadcast-waiters-after-spinning.patch b/pthread-cond-broadcast-waiters-after-spinning.patch new file mode 100644 index 0000000..74642b1 --- /dev/null +++ b/pthread-cond-broadcast-waiters-after-spinning.patch @@ -0,0 +1,27 @@ +2018-08-27 Martin Kuchta + Torvald Riegel + + [BZ #23538] + * nptl/pthread_cond_common.c (__condvar_quiesce_and_switch_g1): + Update r to include the set wake-request flag if waiters are + remaining after spinning. + +Index: glibc-2.28/nptl/pthread_cond_common.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_cond_common.c ++++ glibc-2.28/nptl/pthread_cond_common.c +@@ -405,8 +405,12 @@ __condvar_quiesce_and_switch_g1 (pthread + { + /* There is still a waiter after spinning. Set the wake-request + flag and block. Relaxed MO is fine because this is just about +- this futex word. */ +- r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1); ++ this futex word. ++ ++ Update r to include the set wake-request flag so that the upcoming ++ futex_wait only blocks if the flag is still set (otherwise, we'd ++ violate the basic client-side futex protocol). */ ++ r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1) | 1; + + if ((r >> 1) > 0) + futex_wait_simple (cond->__data.__g_refs + g1, r, private); diff --git a/regex-uninit-memory-access.patch b/regex-uninit-memory-access.patch new file mode 100644 index 0000000..b3ea683 --- /dev/null +++ b/regex-uninit-memory-access.patch @@ -0,0 +1,261 @@ +2018-08-28 Florian Weimer + + [BZ #23578] + * posix/tst-regcomp-truncated.c: New file. + * posix/Makefile (tests): Add it. + (tst-regcomp-truncated.out): Depend on generated locales. + +2018-08-25 Paul Eggert + + [BZ #23578] + regex: fix uninitialized memory access + I introduced this bug into gnulib in commit + 8335a4d6c7b4448cd0bcb6d0bebf1d456bcfdb17 dated 2006-04-10; + eventually it was merged into glibc. The bug was found by + project-repo and reported here: + https://lists.gnu.org/r/sed-devel/2018-08/msg00017.html + Diagnosis and draft fix reported by Assaf Gordon here: + https://lists.gnu.org/r/bug-gnulib/2018-08/msg00071.html + https://lists.gnu.org/r/bug-gnulib/2018-08/msg00142.html + * posix/regex_internal.c (build_wcs_upper_buffer): + Fix bug when mbrtowc returns 0. + +Index: glibc-2.28/posix/Makefile +=================================================================== +--- glibc-2.28.orig/posix/Makefile ++++ glibc-2.28/posix/Makefile +@@ -96,7 +96,7 @@ tests := test-errno tstgetopt testfnm r + tst-posix_fadvise tst-posix_fadvise64 \ + tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \ + tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \ +- bug-regex38 ++ bug-regex38 tst-regcomp-truncated + tests-internal := bug-regex5 bug-regex20 bug-regex33 \ + tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \ + tst-glob_lstat_compat tst-spawn4-compat +@@ -194,6 +194,7 @@ $(objpfx)tst-regex2.out: $(gen-locales) + $(objpfx)tst-regexloc.out: $(gen-locales) + $(objpfx)tst-rxspencer.out: $(gen-locales) + $(objpfx)tst-rxspencer-no-utf8.out: $(gen-locales) ++$(objpfx)tst-regcomp-truncated.out: $(gen-locales) + endif + + # If we will use the generic uname implementation, we must figure out what +Index: glibc-2.28/posix/regex_internal.c +=================================================================== +--- glibc-2.28.orig/posix/regex_internal.c ++++ glibc-2.28/posix/regex_internal.c +@@ -317,7 +317,7 @@ build_wcs_upper_buffer (re_string_t *pst + mbclen = __mbrtowc (&wc, + ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx + + byte_idx), remain_len, &pstr->cur_state); +- if (BE (mbclen < (size_t) -2, 1)) ++ if (BE (0 < mbclen && mbclen < (size_t) -2, 1)) + { + wchar_t wcu = __towupper (wc); + if (wcu != wc) +@@ -386,7 +386,7 @@ build_wcs_upper_buffer (re_string_t *pst + else + p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; + mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); +- if (BE (mbclen < (size_t) -2, 1)) ++ if (BE (0 < mbclen && mbclen < (size_t) -2, 1)) + { + wchar_t wcu = __towupper (wc); + if (wcu != wc) +Index: glibc-2.28/posix/tst-regcomp-truncated.c +=================================================================== +--- /dev/null ++++ glibc-2.28/posix/tst-regcomp-truncated.c +@@ -0,0 +1,191 @@ ++/* Test compilation of truncated regular expressions. ++ Copyright (C) 2018 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 ++ . */ ++ ++/* This test constructs various patterns in an attempt to trigger ++ over-reading the regular expression compiler, such as bug ++ 23578. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Locales to test. */ ++static const char locales[][17] = ++ { ++ "C", ++ "en_US.UTF-8", ++ "de_DE.ISO-8859-1", ++ }; ++ ++/* Syntax options. Will be combined with other flags. */ ++static const reg_syntax_t syntaxes[] = ++ { ++ RE_SYNTAX_EMACS, ++ RE_SYNTAX_AWK, ++ RE_SYNTAX_GNU_AWK, ++ RE_SYNTAX_POSIX_AWK, ++ RE_SYNTAX_GREP, ++ RE_SYNTAX_EGREP, ++ RE_SYNTAX_POSIX_EGREP, ++ RE_SYNTAX_POSIX_BASIC, ++ RE_SYNTAX_POSIX_EXTENDED, ++ RE_SYNTAX_POSIX_MINIMAL_EXTENDED, ++ }; ++ ++/* Trailing characters placed after the initial character. */ ++static const char trailing_strings[][4] = ++ { ++ "", ++ "[", ++ "\\", ++ "[\\", ++ "(", ++ "(\\", ++ "\\(", ++ }; ++ ++static int ++do_test (void) ++{ ++ /* Staging buffer for the constructed regular expression. */ ++ char buffer[16]; ++ ++ /* Allocation used to detect over-reading by the regular expression ++ compiler. */ ++ struct support_next_to_fault ntf ++ = support_next_to_fault_allocate (sizeof (buffer)); ++ ++ /* Arbitrary Unicode codepoint at which we stop generating ++ characters. We do not probe the whole range because that would ++ take too long due to combinatorical exploision as the result of ++ combination with other flags. */ ++ static const wchar_t last_character = 0xfff; ++ ++ for (size_t locale_idx = 0; locale_idx < array_length (locales); ++ ++ locale_idx) ++ { ++ if (setlocale (LC_ALL, locales[locale_idx]) == NULL) ++ { ++ support_record_failure (); ++ printf ("error: setlocale (\"%s\"): %m", locales[locale_idx]); ++ continue; ++ } ++ if (test_verbose > 0) ++ printf ("info: testing locale \"%s\"\n", locales[locale_idx]); ++ ++ for (wchar_t wc = 0; wc <= last_character; ++wc) ++ { ++ char *after_wc; ++ if (wc == 0) ++ { ++ /* wcrtomb treats L'\0' in a special way. */ ++ *buffer = '\0'; ++ after_wc = &buffer[1]; ++ } ++ else ++ { ++ mbstate_t ps = { }; ++ size_t ret = wcrtomb (buffer, wc, &ps); ++ if (ret == (size_t) -1) ++ { ++ /* EILSEQ means that the target character set ++ cannot encode the character. */ ++ if (errno != EILSEQ) ++ { ++ support_record_failure (); ++ printf ("error: wcrtomb (0x%x) failed: %m\n", ++ (unsigned) wc); ++ } ++ continue; ++ } ++ TEST_VERIFY_EXIT (ret != 0); ++ after_wc = &buffer[ret]; ++ } ++ ++ for (size_t trailing_idx = 0; ++ trailing_idx < array_length (trailing_strings); ++ ++trailing_idx) ++ { ++ char *after_trailing ++ = stpcpy (after_wc, trailing_strings[trailing_idx]); ++ ++ for (int do_nul = 0; do_nul < 2; ++do_nul) ++ { ++ char *after_nul; ++ if (do_nul) ++ { ++ *after_trailing = '\0'; ++ after_nul = &after_trailing[1]; ++ } ++ else ++ after_nul = after_trailing; ++ ++ size_t length = after_nul - buffer; ++ ++ /* Make sure that the faulting region starts ++ after the used portion of the buffer. */ ++ char *ntf_start = ntf.buffer + sizeof (buffer) - length; ++ memcpy (ntf_start, buffer, length); ++ ++ for (const reg_syntax_t *psyntax = syntaxes; ++ psyntax < array_end (syntaxes); ++psyntax) ++ for (int do_icase = 0; do_icase < 2; ++do_icase) ++ { ++ re_syntax_options = *psyntax; ++ if (do_icase) ++ re_syntax_options |= RE_ICASE; ++ ++ regex_t reg; ++ memset (®, 0, sizeof (reg)); ++ const char *msg = re_compile_pattern ++ (ntf_start, length, ®); ++ if (msg != NULL) ++ { ++ if (test_verbose > 0) ++ { ++ char *quoted = support_quote_blob ++ (buffer, length); ++ printf ("info: compilation failed for pattern" ++ " \"%s\", syntax 0x%lx: %s\n", ++ quoted, re_syntax_options, msg); ++ free (quoted); ++ } ++ } ++ else ++ regfree (®); ++ } ++ } ++ } ++ } ++ } ++ ++ support_next_to_fault_free (&ntf); ++ ++ return 0; ++} ++ ++#include diff --git a/riscv-feholdexcept-setround.patch b/riscv-feholdexcept-setround.patch new file mode 100644 index 0000000..3dcc00d --- /dev/null +++ b/riscv-feholdexcept-setround.patch @@ -0,0 +1,19 @@ +2018-08-03 DJ Delorie + + * sysdeps/riscv/rvf/math_private.h (libc_feholdexcept_setround_riscv): + Move libc_fesetround_riscv after libc_feholdexcept_riscv. + +Index: glibc-2.28/sysdeps/riscv/rvf/math_private.h +=================================================================== +--- glibc-2.28.orig/sysdeps/riscv/rvf/math_private.h ++++ glibc-2.28/sysdeps/riscv/rvf/math_private.h +@@ -72,8 +72,8 @@ libc_fesetround_riscv (int round) + static __always_inline void + libc_feholdexcept_setround_riscv (fenv_t *envp, int round) + { +- libc_fesetround_riscv (round); + libc_feholdexcept_riscv (envp); ++ libc_fesetround_riscv (round); + } + + #define libc_feholdexcept_setround libc_feholdexcept_setround_riscv diff --git a/spawni-maybe-script-execute.patch b/spawni-maybe-script-execute.patch new file mode 100644 index 0000000..3a42ef2 --- /dev/null +++ b/spawni-maybe-script-execute.patch @@ -0,0 +1,18 @@ +2018-09-06 Stefan Liebler + + * sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute): + Increment size of new_argv by one. + +Index: glibc-2.28/sysdeps/unix/sysv/linux/spawni.c +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/spawni.c ++++ glibc-2.28/sysdeps/unix/sysv/linux/spawni.c +@@ -101,7 +101,7 @@ maybe_script_execute (struct posix_spawn + ptrdiff_t argc = args->argc; + + /* Construct an argument list for the shell. */ +- char *new_argv[argc + 1]; ++ char *new_argv[argc + 2]; + new_argv[0] = (char *) _PATH_BSHELL; + new_argv[1] = (char *) args->file; + if (argc > 1) diff --git a/strstr-huge-needle.patch b/strstr-huge-needle.patch new file mode 100644 index 0000000..c0876e3 --- /dev/null +++ b/strstr-huge-needle.patch @@ -0,0 +1,95 @@ +2018-09-19 Wilco Dijkstra + + [BZ #23637] + * string/test-strstr.c (pr23637): New function. + (test_main): Add tests with longer needles. + * string/strcasestr.c (AVAILABLE): Fix readahead distance. + * string/strstr.c (AVAILABLE): Likewise. + +Index: glibc-2.28/string/strcasestr.c +=================================================================== +--- glibc-2.28.orig/string/strcasestr.c ++++ glibc-2.28/string/strcasestr.c +@@ -37,8 +37,9 @@ + /* Two-Way algorithm. */ + #define RETURN_TYPE char * + #define AVAILABLE(h, h_l, j, n_l) \ +- (((j) + (n_l) <= (h_l)) || ((h_l) += __strnlen ((void*)((h) + (h_l)), 512), \ +- (j) + (n_l) <= (h_l))) ++ (((j) + (n_l) <= (h_l)) \ ++ || ((h_l) += __strnlen ((void*)((h) + (h_l)), (n_l) + 512), \ ++ (j) + (n_l) <= (h_l))) + #define CHECK_EOL (1) + #define RET0_IF_0(a) if (!a) goto ret0 + #define CANON_ELEMENT(c) TOLOWER (c) +Index: glibc-2.28/string/strstr.c +=================================================================== +--- glibc-2.28.orig/string/strstr.c ++++ glibc-2.28/string/strstr.c +@@ -33,8 +33,9 @@ + + #define RETURN_TYPE char * + #define AVAILABLE(h, h_l, j, n_l) \ +- (((j) + (n_l) <= (h_l)) || ((h_l) += __strnlen ((void*)((h) + (h_l)), 512), \ +- (j) + (n_l) <= (h_l))) ++ (((j) + (n_l) <= (h_l)) \ ++ || ((h_l) += __strnlen ((void*)((h) + (h_l)), (n_l) + 512), \ ++ (j) + (n_l) <= (h_l))) + #define CHECK_EOL (1) + #define RET0_IF_0(a) if (!a) goto ret0 + #define FASTSEARCH(S,C,N) (void*) strchr ((void*)(S), (C)) +Index: glibc-2.28/string/test-strstr.c +=================================================================== +--- glibc-2.28.orig/string/test-strstr.c ++++ glibc-2.28/string/test-strstr.c +@@ -151,6 +151,32 @@ check2 (void) + } + } + ++#define N 1024 ++ ++static void ++pr23637 (void) ++{ ++ char *h = (char*) buf1; ++ char *n = (char*) buf2; ++ ++ for (int i = 0; i < N; i++) ++ { ++ n[i] = 'x'; ++ h[i] = ' '; ++ h[i + N] = 'x'; ++ } ++ ++ n[N] = '\0'; ++ h[N * 2] = '\0'; ++ ++ /* Ensure we don't match at the first 'x'. */ ++ h[0] = 'x'; ++ ++ char *exp_result = stupid_strstr (h, n); ++ FOR_EACH_IMPL (impl, 0) ++ check_result (impl, h, n, exp_result); ++} ++ + static int + test_main (void) + { +@@ -158,6 +184,7 @@ test_main (void) + + check1 (); + check2 (); ++ pr23637 (); + + printf ("%23s", ""); + FOR_EACH_IMPL (impl, 0) +@@ -202,6 +229,9 @@ test_main (void) + do_test (15, 9, hlen, klen, 1); + do_test (15, 15, hlen, klen, 0); + do_test (15, 15, hlen, klen, 1); ++ ++ do_test (15, 15, hlen + klen * 4, klen * 4, 0); ++ do_test (15, 15, hlen + klen * 4, klen * 4, 1); + } + + do_test (0, 0, page_size - 1, 16, 0); diff --git a/unwind-ctor.patch b/unwind-ctor.patch new file mode 100644 index 0000000..ac7a80f --- /dev/null +++ b/unwind-ctor.patch @@ -0,0 +1,131 @@ +2018-09-26 Andreas Schwab + + [BZ #23707] + * sysdeps/powerpc/powerpc32/dl-start.S: Add unwind information. + * elf/Makefile (tests): Add tst-unwind-ctor. + (modules-names): Add tst-unwind-ctor-lib. + ($(objpfx)tst-unwind-ctor): Depend on + $(objpfx)tst-unwind-ctor-lib.so. + +Index: glibc-2.28/elf/Makefile +=================================================================== +--- glibc-2.28.orig/elf/Makefile ++++ glibc-2.28/elf/Makefile +@@ -186,7 +186,8 @@ tests += restest1 preloadtest loadfail m + tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ + tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ + tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ +- tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note ++ tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \ ++ tst-unwind-ctor + # reldep9 + tests-internal += loadtest unload unload2 circleload1 \ + neededtest neededtest2 neededtest3 neededtest4 \ +@@ -273,7 +274,7 @@ modules-names = testobj1 testobj2 testob + tst-latepthreadmod $(tst-tls-many-dynamic-modules) \ + tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \ + tst-main1mod tst-libc_dlvsym-dso tst-absolute-sym-lib \ +- tst-absolute-zero-lib tst-big-note-lib ++ tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib + + ifeq (yes,$(have-mtls-dialect-gnu2)) + tests += tst-gnu2-tls1 +@@ -1484,3 +1485,5 @@ tst-libc_dlvsym-static-ENV = \ + $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so + + $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so ++ ++$(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so +Index: glibc-2.28/elf/tst-unwind-ctor-lib.c +=================================================================== +--- /dev/null ++++ glibc-2.28/elf/tst-unwind-ctor-lib.c +@@ -0,0 +1,42 @@ ++/* Unit test for _Unwind_Backtrace in a shared object constructor. ++ Copyright (C) 2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++ ++static _Unwind_Reason_Code ++callback (struct _Unwind_Context *ctx, void *arg) ++{ ++ return _URC_NO_REASON; ++} ++ ++static void ++__attribute__ ((constructor)) ++do_unwind (void) ++{ ++ /* Arrange for this test to be killed if _Unwind_Backtrace runs into an ++ endless loop. We cannot use the test driver since the test needs to ++ run in a constructor. */ ++ alarm (20); ++ _Unwind_Backtrace (callback, 0); ++} ++ ++void ++dummy (void) ++{ ++} +Index: glibc-2.28/elf/tst-unwind-ctor.c +=================================================================== +--- /dev/null ++++ glibc-2.28/elf/tst-unwind-ctor.c +@@ -0,0 +1,27 @@ ++/* Unit test for _Unwind_Backtrace in a shared object constructor. ++ Copyright (C) 2018 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 ++ . */ ++ ++extern void dummy (void); ++ ++int ++main (void) ++{ ++ /* Just call a dummy function in the shared library. The actual test ++ runs in its constructor. */ ++ dummy (); ++} +Index: glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S +=================================================================== +--- glibc-2.28.orig/sysdeps/powerpc/powerpc32/dl-start.S ++++ glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S +@@ -34,6 +34,9 @@ ENTRY(_start) + _dl_start to save the link register). */ + li r4,0 + addi r1,r1,-16 ++ cfi_adjust_cfa_offset (16) ++/* Mark lr as undefined to stop unwinding. */ ++ cfi_undefined (lr) + stw r4,0(r1) + bl _dl_start@local + From 386fd5bef023a1d2406ae4d7ee7b11125a58ff29313110044124ef30cbb3925d Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 7 Nov 2018 14:16:18 +0000 Subject: [PATCH 4/8] Accepting request 647005 from home:Andreas_Schwab:Factory - pthread-mutex-lock-elision-race.patch: Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP (BZ #23275) - x86-haswell-string-flags.patch: x86: Fix Haswell CPU string flags (BZ #23709) OBS-URL: https://build.opensuse.org/request/show/647005 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=512 --- glibc.changes | 8 + glibc.spec | 8 +- pthread-mutex-lock-elision-race.patch | 717 ++++++++++++++++++++++++++ x86-haswell-string-flags.patch | 24 + 4 files changed, 756 insertions(+), 1 deletion(-) create mode 100644 pthread-mutex-lock-elision-race.patch create mode 100644 x86-haswell-string-flags.patch diff --git a/glibc.changes b/glibc.changes index a4d0592..6231aa2 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Nov 7 11:09:05 UTC 2018 - schwab@suse.de + +- pthread-mutex-lock-elision-race.patch: Fix race in pthread_mutex_lock + while promoting to PTHREAD_MUTEX_ELISION_NP (BZ #23275) +- x86-haswell-string-flags.patch: x86: Fix Haswell CPU string flags (BZ + #23709) + ------------------------------------------------------------------- Wed Sep 26 09:41:59 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index fcafa51..22db61c 100644 --- a/glibc.spec +++ b/glibc.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -286,6 +286,10 @@ Patch1006: spawni-maybe-script-execute.patch Patch1007: gethostid-gethostbyname-failure.patch # PATCH-FIX-UPSTREAM Fix strstr bug with huge needles (BZ #23637) Patch1008: strstr-huge-needle.patch +# PATCH-FIX-UPSTREAM Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP (BZ #23275) +Patch1009: pthread-mutex-lock-elision-race.patch +# PATCH-FIX-UPSTREAM x86: Fix Haswell CPU string flags (BZ #23709) +Patch1010: x86-haswell-string-flags.patch ### # Patches awaiting upstream approval @@ -504,6 +508,8 @@ makedb: A program to create a database for nss %patch1006 -p1 %patch1007 -p1 %patch1008 -p1 +%patch1009 -p1 +%patch1010 -p1 %patch2000 -p1 %patch2004 -p1 diff --git a/pthread-mutex-lock-elision-race.patch b/pthread-mutex-lock-elision-race.patch new file mode 100644 index 0000000..3b7e084 --- /dev/null +++ b/pthread-mutex-lock-elision-race.patch @@ -0,0 +1,717 @@ +2018-10-17 Stefan Liebler + + [BZ #23275] + * nptl/tst-mutex10.c: New File. + * nptl/Makefile (tests): Add tst-mutex10. + (tst-mutex10-ENV): New variable. + * sysdeps/unix/sysv/linux/s390/force-elision.h: (FORCE_ELISION): + Ensure that elision path is used if elision is available. + * sysdeps/unix/sysv/linux/powerpc/force-elision.h (FORCE_ELISION): + Likewise. + * sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION): + Likewise. + * nptl/pthreadP.h (PTHREAD_MUTEX_TYPE, PTHREAD_MUTEX_TYPE_ELISION) + (PTHREAD_MUTEX_PSHARED): Use atomic_load_relaxed. + * nptl/pthread_mutex_consistent.c (pthread_mutex_consistent): Likewise. + * nptl/pthread_mutex_getprioceiling.c (pthread_mutex_getprioceiling): + Likewise. + * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full) + (__pthread_mutex_cond_lock_adjust): Likewise. + * nptl/pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): + Likewise. + * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Likewise. + * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise. + * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise. + * sysdeps/nptl/bits/thread-shared-types.h (struct __pthread_mutex_s): + Add comments. + * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): + Use atomic_load_relaxed and atomic_store_relaxed. + * nptl/pthread_mutex_init.c (__pthread_mutex_init): + Use atomic_store_relaxed. + +Index: glibc-2.28/nptl/Makefile +=================================================================== +--- glibc-2.28.orig/nptl/Makefile ++++ glibc-2.28/nptl/Makefile +@@ -241,9 +241,9 @@ LDLIBS-tst-minstack-throw = -lstdc++ + + tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ + tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \ +- tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex7a tst-mutex7robust \ +- tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ +- tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ ++ tst-mutex7 tst-mutex9 tst-mutex10 tst-mutex5a tst-mutex7a \ ++ tst-mutex7robust tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \ ++ tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ + tst-mutexpi9 \ + tst-spin1 tst-spin2 tst-spin3 tst-spin4 \ + tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \ +@@ -709,6 +709,8 @@ endif + + $(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so + ++tst-mutex10-ENV = GLIBC_TUNABLES=glibc.elision.enable=1 ++ + # The tests here better do not run in parallel + ifneq ($(filter %tests,$(MAKECMDGOALS)),) + .NOTPARALLEL: +Index: glibc-2.28/nptl/pthreadP.h +=================================================================== +--- glibc-2.28.orig/nptl/pthreadP.h ++++ glibc-2.28/nptl/pthreadP.h +@@ -110,19 +110,23 @@ enum + }; + #define PTHREAD_MUTEX_PSHARED_BIT 128 + ++/* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ + #define PTHREAD_MUTEX_TYPE(m) \ +- ((m)->__data.__kind & 127) ++ (atomic_load_relaxed (&((m)->__data.__kind)) & 127) + /* Don't include NO_ELISION, as that type is always the same + as the underlying lock type. */ + #define PTHREAD_MUTEX_TYPE_ELISION(m) \ +- ((m)->__data.__kind & (127|PTHREAD_MUTEX_ELISION_NP)) ++ (atomic_load_relaxed (&((m)->__data.__kind)) \ ++ & (127 | PTHREAD_MUTEX_ELISION_NP)) + + #if LLL_PRIVATE == 0 && LLL_SHARED == 128 + # define PTHREAD_MUTEX_PSHARED(m) \ +- ((m)->__data.__kind & 128) ++ (atomic_load_relaxed (&((m)->__data.__kind)) & 128) + #else + # define PTHREAD_MUTEX_PSHARED(m) \ +- (((m)->__data.__kind & 128) ? LLL_SHARED : LLL_PRIVATE) ++ ((atomic_load_relaxed (&((m)->__data.__kind)) & 128) \ ++ ? LLL_SHARED : LLL_PRIVATE) + #endif + + /* The kernel when waking robust mutexes on exit never uses +Index: glibc-2.28/nptl/pthread_mutex_consistent.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_consistent.c ++++ glibc-2.28/nptl/pthread_mutex_consistent.c +@@ -23,8 +23,11 @@ + int + pthread_mutex_consistent (pthread_mutex_t *mutex) + { +- /* Test whether this is a robust mutex with a dead owner. */ +- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 ++ /* Test whether this is a robust mutex with a dead owner. ++ See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if ((atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 + || mutex->__data.__owner != PTHREAD_MUTEX_INCONSISTENT) + return EINVAL; + +Index: glibc-2.28/nptl/pthread_mutex_destroy.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_destroy.c ++++ glibc-2.28/nptl/pthread_mutex_destroy.c +@@ -27,12 +27,17 @@ __pthread_mutex_destroy (pthread_mutex_t + { + LIBC_PROBE (mutex_destroy, 1, mutex); + +- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if ((atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 + && mutex->__data.__nusers != 0) + return EBUSY; + +- /* Set to an invalid value. */ +- mutex->__data.__kind = -1; ++ /* Set to an invalid value. Relaxed MO is enough as it is undefined behavior ++ if the mutex is used after it has been destroyed. But you can reinitialize ++ it with pthread_mutex_init. */ ++ atomic_store_relaxed (&(mutex->__data.__kind), -1); + + return 0; + } +Index: glibc-2.28/nptl/pthread_mutex_getprioceiling.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_getprioceiling.c ++++ glibc-2.28/nptl/pthread_mutex_getprioceiling.c +@@ -24,7 +24,9 @@ + int + pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling) + { +- if (__builtin_expect ((mutex->__data.__kind ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if (__builtin_expect ((atomic_load_relaxed (&(mutex->__data.__kind)) + & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0, 0)) + return EINVAL; + +Index: glibc-2.28/nptl/pthread_mutex_init.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_init.c ++++ glibc-2.28/nptl/pthread_mutex_init.c +@@ -101,7 +101,7 @@ __pthread_mutex_init (pthread_mutex_t *m + memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T); + + /* Copy the values from the attribute. */ +- mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS; ++ int mutex_kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS; + + if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0) + { +@@ -111,17 +111,17 @@ __pthread_mutex_init (pthread_mutex_t *m + return ENOTSUP; + #endif + +- mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ mutex_kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; + } + + switch (imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) + { + case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: +- mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_INHERIT_NP; ++ mutex_kind |= PTHREAD_MUTEX_PRIO_INHERIT_NP; + break; + + case PTHREAD_PRIO_PROTECT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: +- mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_PROTECT_NP; ++ mutex_kind |= PTHREAD_MUTEX_PRIO_PROTECT_NP; + + int ceiling = (imutexattr->mutexkind + & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK) +@@ -145,7 +145,11 @@ __pthread_mutex_init (pthread_mutex_t *m + FUTEX_PRIVATE_FLAG FUTEX_WAKE. */ + if ((imutexattr->mutexkind & (PTHREAD_MUTEXATTR_FLAG_PSHARED + | PTHREAD_MUTEXATTR_FLAG_ROBUST)) != 0) +- mutex->__data.__kind |= PTHREAD_MUTEX_PSHARED_BIT; ++ mutex_kind |= PTHREAD_MUTEX_PSHARED_BIT; ++ ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ atomic_store_relaxed (&(mutex->__data.__kind), mutex_kind); + + /* Default values: mutex not used yet. */ + // mutex->__count = 0; already done by memset +Index: glibc-2.28/nptl/pthread_mutex_lock.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_lock.c ++++ glibc-2.28/nptl/pthread_mutex_lock.c +@@ -62,6 +62,8 @@ static int __pthread_mutex_lock_full (pt + int + __pthread_mutex_lock (pthread_mutex_t *mutex) + { ++ /* See concurrency notes regarding mutex type which is loaded from __kind ++ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ + unsigned int type = PTHREAD_MUTEX_TYPE_ELISION (mutex); + + LIBC_PROBE (mutex_entry, 1, mutex); +@@ -350,8 +352,14 @@ __pthread_mutex_lock_full (pthread_mutex + case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: + case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; +- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ int kind, robust; ++ { ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); ++ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ } + + if (robust) + { +@@ -502,7 +510,10 @@ __pthread_mutex_lock_full (pthread_mutex + case PTHREAD_MUTEX_PP_NORMAL_NP: + case PTHREAD_MUTEX_PP_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_KIND_MASK_NP; + + oldval = mutex->__data.__lock; + +@@ -607,15 +618,18 @@ hidden_def (__pthread_mutex_lock) + void + __pthread_mutex_cond_lock_adjust (pthread_mutex_t *mutex) + { +- assert ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_INHERIT_NP) != 0); +- assert ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0); +- assert ((mutex->__data.__kind & PTHREAD_MUTEX_PSHARED_BIT) == 0); ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); ++ assert ((mutex_kind & PTHREAD_MUTEX_PRIO_INHERIT_NP) != 0); ++ assert ((mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0); ++ assert ((mutex_kind & PTHREAD_MUTEX_PSHARED_BIT) == 0); + + /* Record the ownership. */ + pid_t id = THREAD_GETMEM (THREAD_SELF, tid); + mutex->__data.__owner = id; + +- if (mutex->__data.__kind == PTHREAD_MUTEX_PI_RECURSIVE_NP) ++ if (mutex_kind == PTHREAD_MUTEX_PI_RECURSIVE_NP) + ++mutex->__data.__count; + } + #endif +Index: glibc-2.28/nptl/pthread_mutex_setprioceiling.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_setprioceiling.c ++++ glibc-2.28/nptl/pthread_mutex_setprioceiling.c +@@ -27,9 +27,10 @@ int + pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling, + int *old_ceiling) + { +- /* The low bits of __kind aren't ever changed after pthread_mutex_init, +- so we don't need a lock yet. */ +- if ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0) ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if ((atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0) + return EINVAL; + + /* See __init_sched_fifo_prio. */ +Index: glibc-2.28/nptl/pthread_mutex_timedlock.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_timedlock.c ++++ glibc-2.28/nptl/pthread_mutex_timedlock.c +@@ -53,6 +53,8 @@ __pthread_mutex_timedlock (pthread_mutex + /* We must not check ABSTIME here. If the thread does not block + abstime must not be checked for a valid value. */ + ++ /* See concurrency notes regarding mutex type which is loaded from __kind ++ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ + switch (__builtin_expect (PTHREAD_MUTEX_TYPE_ELISION (mutex), + PTHREAD_MUTEX_TIMED_NP)) + { +@@ -338,8 +340,14 @@ __pthread_mutex_timedlock (pthread_mutex + case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: + case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; +- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ int kind, robust; ++ { ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); ++ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ } + + if (robust) + { +@@ -509,7 +517,10 @@ __pthread_mutex_timedlock (pthread_mutex + case PTHREAD_MUTEX_PP_NORMAL_NP: + case PTHREAD_MUTEX_PP_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_KIND_MASK_NP; + + oldval = mutex->__data.__lock; + +Index: glibc-2.28/nptl/pthread_mutex_trylock.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_trylock.c ++++ glibc-2.28/nptl/pthread_mutex_trylock.c +@@ -36,6 +36,8 @@ __pthread_mutex_trylock (pthread_mutex_t + int oldval; + pid_t id = THREAD_GETMEM (THREAD_SELF, tid); + ++ /* See concurrency notes regarding mutex type which is loaded from __kind ++ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ + switch (__builtin_expect (PTHREAD_MUTEX_TYPE_ELISION (mutex), + PTHREAD_MUTEX_TIMED_NP)) + { +@@ -199,8 +201,14 @@ __pthread_mutex_trylock (pthread_mutex_t + case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: + case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; +- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ int kind, robust; ++ { ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); ++ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ } + + if (robust) + /* Note: robust PI futexes are signaled by setting bit 0. */ +@@ -325,7 +333,10 @@ __pthread_mutex_trylock (pthread_mutex_t + case PTHREAD_MUTEX_PP_NORMAL_NP: + case PTHREAD_MUTEX_PP_ADAPTIVE_NP: + { +- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_KIND_MASK_NP; + + oldval = mutex->__data.__lock; + +Index: glibc-2.28/nptl/pthread_mutex_unlock.c +=================================================================== +--- glibc-2.28.orig/nptl/pthread_mutex_unlock.c ++++ glibc-2.28/nptl/pthread_mutex_unlock.c +@@ -35,6 +35,8 @@ int + attribute_hidden + __pthread_mutex_unlock_usercnt (pthread_mutex_t *mutex, int decr) + { ++ /* See concurrency notes regarding mutex type which is loaded from __kind ++ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ + int type = PTHREAD_MUTEX_TYPE_ELISION (mutex); + if (__builtin_expect (type & + ~(PTHREAD_MUTEX_KIND_MASK_NP|PTHREAD_MUTEX_ELISION_FLAGS_NP), 0)) +@@ -222,13 +224,19 @@ __pthread_mutex_unlock_full (pthread_mut + /* If the previous owner died and the caller did not succeed in + making the state consistent, mark the mutex as unrecoverable + and make all waiters. */ +- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0 ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if ((atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0 + && __builtin_expect (mutex->__data.__owner + == PTHREAD_MUTEX_INCONSISTENT, 0)) + pi_notrecoverable: + newowner = PTHREAD_MUTEX_NOTRECOVERABLE; + +- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0) ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ if ((atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0) + { + continue_pi_robust: + /* Remove mutex from the list. +@@ -251,7 +259,10 @@ __pthread_mutex_unlock_full (pthread_mut + /* Unlock. Load all necessary mutex data before releasing the mutex + to not violate the mutex destruction requirements (see + lll_unlock). */ +- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; ++ /* See concurrency notes regarding __kind in struct __pthread_mutex_s ++ in sysdeps/nptl/bits/thread-shared-types.h. */ ++ int robust = atomic_load_relaxed (&(mutex->__data.__kind)) ++ & PTHREAD_MUTEX_ROBUST_NORMAL_NP; + private = (robust + ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex) + : PTHREAD_MUTEX_PSHARED (mutex)); +Index: glibc-2.28/nptl/tst-mutex10.c +=================================================================== +--- /dev/null ++++ glibc-2.28/nptl/tst-mutex10.c +@@ -0,0 +1,109 @@ ++/* Testing race while enabling lock elision. ++ Copyright (C) 2018 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static pthread_barrier_t barrier; ++static pthread_mutex_t mutex; ++static long long int iteration_count = 1000000; ++static unsigned int thread_count = 3; ++ ++static void * ++thr_func (void *arg) ++{ ++ long long int i; ++ for (i = 0; i < iteration_count; i++) ++ { ++ if ((uintptr_t) arg == 0) ++ { ++ xpthread_mutex_destroy (&mutex); ++ xpthread_mutex_init (&mutex, NULL); ++ } ++ ++ xpthread_barrier_wait (&barrier); ++ ++ /* Test if enabling lock elision works if it is enabled concurrently. ++ There was a race in FORCE_ELISION macro which leads to either ++ pthread_mutex_destroy returning EBUSY as the owner was recorded ++ by pthread_mutex_lock - in "normal mutex" code path - but was not ++ resetted in pthread_mutex_unlock - in "elision" code path. ++ Or it leads to the assertion in nptl/pthread_mutex_lock.c: ++ assert (mutex->__data.__owner == 0); ++ Please ensure that the test is run with lock elision: ++ export GLIBC_TUNABLES=glibc.elision.enable=1 */ ++ xpthread_mutex_lock (&mutex); ++ xpthread_mutex_unlock (&mutex); ++ ++ xpthread_barrier_wait (&barrier); ++ } ++ return NULL; ++} ++ ++static int ++do_test (void) ++{ ++ unsigned int i; ++ printf ("Starting %d threads to run %lld iterations.\n", ++ thread_count, iteration_count); ++ ++ pthread_t *threads = xmalloc (thread_count * sizeof (pthread_t)); ++ xpthread_barrier_init (&barrier, NULL, thread_count); ++ xpthread_mutex_init (&mutex, NULL); ++ ++ for (i = 0; i < thread_count; i++) ++ threads[i] = xpthread_create (NULL, thr_func, (void *) (uintptr_t) i); ++ ++ for (i = 0; i < thread_count; i++) ++ xpthread_join (threads[i]); ++ ++ xpthread_barrier_destroy (&barrier); ++ free (threads); ++ ++ return EXIT_SUCCESS; ++} ++ ++#define OPT_ITERATIONS 10000 ++#define OPT_THREADS 10001 ++#define CMDLINE_OPTIONS \ ++ { "iterations", required_argument, NULL, OPT_ITERATIONS }, \ ++ { "threads", required_argument, NULL, OPT_THREADS }, ++static void ++cmdline_process (int c) ++{ ++ long long int arg = strtoll (optarg, NULL, 0); ++ switch (c) ++ { ++ case OPT_ITERATIONS: ++ if (arg > 0) ++ iteration_count = arg; ++ break; ++ case OPT_THREADS: ++ if (arg > 0 && arg < 100) ++ thread_count = arg; ++ break; ++ } ++} ++#define CMDLINE_PROCESS cmdline_process ++#define TIMEOUT 50 ++#include +Index: glibc-2.28/sysdeps/nptl/bits/thread-shared-types.h +=================================================================== +--- glibc-2.28.orig/sysdeps/nptl/bits/thread-shared-types.h ++++ glibc-2.28/sysdeps/nptl/bits/thread-shared-types.h +@@ -124,7 +124,27 @@ struct __pthread_mutex_s + unsigned int __nusers; + #endif + /* KIND must stay at this position in the structure to maintain +- binary compatibility with static initializers. */ ++ binary compatibility with static initializers. ++ ++ Concurrency notes: ++ The __kind of a mutex is initialized either by the static ++ PTHREAD_MUTEX_INITIALIZER or by a call to pthread_mutex_init. ++ ++ After a mutex has been initialized, the __kind of a mutex is usually not ++ changed. BUT it can be set to -1 in pthread_mutex_destroy or elision can ++ be enabled. This is done concurrently in the pthread_mutex_*lock functions ++ by using the macro FORCE_ELISION. This macro is only defined for ++ architectures which supports lock elision. ++ ++ For elision, there are the flags PTHREAD_MUTEX_ELISION_NP and ++ PTHREAD_MUTEX_NO_ELISION_NP which can be set in addition to the already set ++ type of a mutex. ++ Before a mutex is initialized, only PTHREAD_MUTEX_NO_ELISION_NP can be set ++ with pthread_mutexattr_settype. ++ After a mutex has been initialized, the functions pthread_mutex_*lock can ++ enable elision - if the mutex-type and the machine supports it - by setting ++ the flag PTHREAD_MUTEX_ELISION_NP. This is done concurrently. Afterwards ++ the lock / unlock functions are using specific elision code-paths. */ + int __kind; + __PTHREAD_COMPAT_PADDING_MID + #if __PTHREAD_MUTEX_NUSERS_AFTER_KIND +Index: glibc-2.28/sysdeps/unix/sysv/linux/powerpc/force-elision.h +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/powerpc/force-elision.h ++++ glibc-2.28/sysdeps/unix/sysv/linux/powerpc/force-elision.h +@@ -18,9 +18,45 @@ + + /* Automatically enable elision for existing user lock kinds. */ + #define FORCE_ELISION(m, s) \ +- if (__pthread_force_elision \ +- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ if (__pthread_force_elision) \ + { \ +- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ +- s; \ ++ /* See concurrency notes regarding __kind in \ ++ struct __pthread_mutex_s in \ ++ sysdeps/nptl/bits/thread-shared-types.h. \ ++ \ ++ There are the following cases for the kind of a mutex \ ++ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ ++ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ ++ only one of both flags can be set): \ ++ - both flags are not set: \ ++ This is the first lock operation for this mutex. Enable \ ++ elision as it is not enabled so far. \ ++ Note: It can happen that multiple threads are calling e.g. \ ++ pthread_mutex_lock at the same time as the first lock \ ++ operation for this mutex. Then elision is enabled for this \ ++ mutex by multiple threads. Storing with relaxed MO is enough \ ++ as all threads will store the same new value for the kind of \ ++ the mutex. But we have to ensure that we always use the \ ++ elision path regardless if this thread has enabled elision or \ ++ another one. \ ++ \ ++ - PTHREAD_MUTEX_ELISION_NP flag is set: \ ++ Elision was already enabled for this mutex by a previous lock \ ++ operation. See case above. Just use the elision path. \ ++ \ ++ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ ++ Elision was explicitly disabled by pthread_mutexattr_settype. \ ++ Do not use the elision path. \ ++ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ ++ changed after mutex initialization. */ \ ++ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ { \ ++ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ ++ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ ++ } \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ ++ { \ ++ s; \ ++ } \ + } +Index: glibc-2.28/sysdeps/unix/sysv/linux/s390/force-elision.h +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/s390/force-elision.h ++++ glibc-2.28/sysdeps/unix/sysv/linux/s390/force-elision.h +@@ -18,9 +18,45 @@ + + /* Automatically enable elision for existing user lock kinds. */ + #define FORCE_ELISION(m, s) \ +- if (__pthread_force_elision \ +- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ if (__pthread_force_elision) \ + { \ +- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ +- s; \ ++ /* See concurrency notes regarding __kind in \ ++ struct __pthread_mutex_s in \ ++ sysdeps/nptl/bits/thread-shared-types.h. \ ++ \ ++ There are the following cases for the kind of a mutex \ ++ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ ++ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ ++ only one of both flags can be set): \ ++ - both flags are not set: \ ++ This is the first lock operation for this mutex. Enable \ ++ elision as it is not enabled so far. \ ++ Note: It can happen that multiple threads are calling e.g. \ ++ pthread_mutex_lock at the same time as the first lock \ ++ operation for this mutex. Then elision is enabled for this \ ++ mutex by multiple threads. Storing with relaxed MO is enough \ ++ as all threads will store the same new value for the kind of \ ++ the mutex. But we have to ensure that we always use the \ ++ elision path regardless if this thread has enabled elision or \ ++ another one. \ ++ \ ++ - PTHREAD_MUTEX_ELISION_NP flag is set: \ ++ Elision was already enabled for this mutex by a previous lock \ ++ operation. See case above. Just use the elision path. \ ++ \ ++ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ ++ Elision was explicitly disabled by pthread_mutexattr_settype. \ ++ Do not use the elision path. \ ++ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ ++ changed after mutex initialization. */ \ ++ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ { \ ++ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ ++ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ ++ } \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ ++ { \ ++ s; \ ++ } \ + } +Index: glibc-2.28/sysdeps/unix/sysv/linux/x86/force-elision.h +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/x86/force-elision.h ++++ glibc-2.28/sysdeps/unix/sysv/linux/x86/force-elision.h +@@ -18,9 +18,45 @@ + + /* Automatically enable elision for existing user lock kinds. */ + #define FORCE_ELISION(m, s) \ +- if (__pthread_force_elision \ +- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ if (__pthread_force_elision) \ + { \ +- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ +- s; \ ++ /* See concurrency notes regarding __kind in \ ++ struct __pthread_mutex_s in \ ++ sysdeps/nptl/bits/thread-shared-types.h. \ ++ \ ++ There are the following cases for the kind of a mutex \ ++ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ ++ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ ++ only one of both flags can be set): \ ++ - both flags are not set: \ ++ This is the first lock operation for this mutex. Enable \ ++ elision as it is not enabled so far. \ ++ Note: It can happen that multiple threads are calling e.g. \ ++ pthread_mutex_lock at the same time as the first lock \ ++ operation for this mutex. Then elision is enabled for this \ ++ mutex by multiple threads. Storing with relaxed MO is enough \ ++ as all threads will store the same new value for the kind of \ ++ the mutex. But we have to ensure that we always use the \ ++ elision path regardless if this thread has enabled elision or \ ++ another one. \ ++ \ ++ - PTHREAD_MUTEX_ELISION_NP flag is set: \ ++ Elision was already enabled for this mutex by a previous lock \ ++ operation. See case above. Just use the elision path. \ ++ \ ++ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ ++ Elision was explicitly disabled by pthread_mutexattr_settype. \ ++ Do not use the elision path. \ ++ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ ++ changed after mutex initialization. */ \ ++ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ ++ { \ ++ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ ++ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ ++ } \ ++ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ ++ { \ ++ s; \ ++ } \ + } diff --git a/x86-haswell-string-flags.patch b/x86-haswell-string-flags.patch new file mode 100644 index 0000000..cfa35a6 --- /dev/null +++ b/x86-haswell-string-flags.patch @@ -0,0 +1,24 @@ +2018-10-23 Adhemerval Zanella + + [BZ #23709] + * sysdeps/x86/cpu-features.c (init_cpu_features): Set TSX bits + independently of other flags. + +Index: glibc-2.28/sysdeps/x86/cpu-features.c +=================================================================== +--- glibc-2.28.orig/sysdeps/x86/cpu-features.c ++++ glibc-2.28/sysdeps/x86/cpu-features.c +@@ -316,7 +316,13 @@ init_cpu_features (struct cpu_features * + | bit_arch_Fast_Unaligned_Copy + | bit_arch_Prefer_PMINUB_for_stringop); + break; ++ } + ++ /* Disable TSX on some Haswell processors to avoid TSX on kernels that ++ weren't updated with the latest microcode package (which disables ++ broken feature by default). */ ++ switch (model) ++ { + case 0x3f: + /* Xeon E7 v3 with stepping >= 4 has working TSX. */ + if (stepping >= 4) From 5876829c6a54ce6439efd19d1307dd3e69c2ba4b76b60aedae201fb415840539 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 8 Nov 2018 08:05:53 +0000 Subject: [PATCH 5/8] Accepting request 647063 from home:jengelh:branches:Base:System - Fix typography for glibc-locale-base. OBS-URL: https://build.opensuse.org/request/show/647063 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=513 --- glibc.changes | 5 +++++ glibc.spec | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/glibc.changes b/glibc.changes index 6231aa2..13d8bd5 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Nov 7 17:24:35 UTC 2018 - Jan Engelhardt + +- Fix typography for glibc-locale-base. + ------------------------------------------------------------------- Wed Nov 7 11:09:05 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index 22db61c..1143858 100644 --- a/glibc.spec +++ b/glibc.spec @@ -372,7 +372,7 @@ not necessary to install this packages, the data files are already created. %package locale-base -Summary: Locale Data for Localized Programs +Summary: en_US Locale Data for Localized Programs License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later Group: System/Libraries Requires(post): /bin/cat @@ -380,7 +380,7 @@ Requires: glibc = %{version} %description locale-base Locale data for the internationalisation features of the GNU C library. -This package contains only the US-english locales. +This package contains only the U.S. English locale. %package locale Summary: Locale Data for Localized Programs From d0ecab50fd9041109b53403703cc266b345fcdcfd88aad9c12f57fce6ad8bf25 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 28 Nov 2018 13:22:17 +0000 Subject: [PATCH 6/8] Accepting request 652421 from home:Andreas_Schwab:Factory - if-nametoindex-descr-leak.patch: if_nametoindex: Fix descriptor leak for overlong name (CVE-2018-19591, BZ #23927, bsc#1117603) OBS-URL: https://build.opensuse.org/request/show/652421 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=514 --- glibc.changes | 6 ++++++ glibc.spec | 3 +++ if-nametoindex-descr-leak.patch | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 if-nametoindex-descr-leak.patch diff --git a/glibc.changes b/glibc.changes index 13d8bd5..76f7998 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 28 09:52:49 UTC 2018 - schwab@suse.de + +- if-nametoindex-descr-leak.patch: if_nametoindex: Fix descriptor leak for + overlong name (CVE-2018-19591, BZ #23927, bsc#1117603) + ------------------------------------------------------------------- Wed Nov 7 17:24:35 UTC 2018 - Jan Engelhardt diff --git a/glibc.spec b/glibc.spec index 1143858..1716d29 100644 --- a/glibc.spec +++ b/glibc.spec @@ -290,6 +290,8 @@ Patch1008: strstr-huge-needle.patch Patch1009: pthread-mutex-lock-elision-race.patch # PATCH-FIX-UPSTREAM x86: Fix Haswell CPU string flags (BZ #23709) Patch1010: x86-haswell-string-flags.patch +# PATCH-FIX-UPSTREAM if_nametoindex: Fix descriptor leak for overlong name (CVE-2018-19591, BZ #23927) +Patch1011: if-nametoindex-descr-leak.patch ### # Patches awaiting upstream approval @@ -510,6 +512,7 @@ makedb: A program to create a database for nss %patch1008 -p1 %patch1009 -p1 %patch1010 -p1 +%patch1011 -p1 %patch2000 -p1 %patch2004 -p1 diff --git a/if-nametoindex-descr-leak.patch b/if-nametoindex-descr-leak.patch new file mode 100644 index 0000000..66e2d01 --- /dev/null +++ b/if-nametoindex-descr-leak.patch @@ -0,0 +1,36 @@ +2018-11-27 Florian Weimer + + [BZ #23927] + CVE-2018-19591 + * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Avoid + descriptor leak in case of ENODEV error. + +Index: glibc-2.28/sysdeps/unix/sysv/linux/if_index.c +=================================================================== +--- glibc-2.28.orig/sysdeps/unix/sysv/linux/if_index.c ++++ glibc-2.28/sysdeps/unix/sysv/linux/if_index.c +@@ -38,11 +38,6 @@ __if_nametoindex (const char *ifname) + return 0; + #else + struct ifreq ifr; +- int fd = __opensock (); +- +- if (fd < 0) +- return 0; +- + if (strlen (ifname) >= IFNAMSIZ) + { + __set_errno (ENODEV); +@@ -50,6 +45,12 @@ __if_nametoindex (const char *ifname) + } + + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); ++ ++ int fd = __opensock (); ++ ++ if (fd < 0) ++ return 0; ++ + if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) + { + int saved_errno = errno; From c8985eb9dbe76caa1e1449a312f41454fc9f52096c660da6a0ff75cf55bd4bde Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 10 Jan 2019 11:21:29 +0000 Subject: [PATCH 7/8] Accepting request 664336 from home:Andreas_Schwab:Factory - fnmatch-collating-elements.patch: update - riscv-flush-icache.patch: fix for compiling against 4.20 headers OBS-URL: https://build.opensuse.org/request/show/664336 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=515 --- fnmatch-collating-elements.patch | 229 +++++++++++++++++++++---------- glibc.changes | 6 + glibc.spec | 5 +- riscv-flush-icache.patch | 26 ++++ 4 files changed, 192 insertions(+), 74 deletions(-) create mode 100644 riscv-flush-icache.patch diff --git a/fnmatch-collating-elements.patch b/fnmatch-collating-elements.patch index f07711f..a6eba6c 100644 --- a/fnmatch-collating-elements.patch +++ b/fnmatch-collating-elements.patch @@ -1,4 +1,8 @@ -Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) +Fix handling of collating elements in fnmatch (bug 17396, bug 16976) + +This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for +regexp matching. As a side effect it also removes the use of an unbound +VLA. [BZ #16976] [BZ #17396] @@ -6,15 +10,34 @@ Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) looking up collating elements match against (wide) character sequence instead of name. Correct alignment adjustment. * posix/fnmatch.c: Don't include "../locale/elem-hash.h". + (WMEMCMP) [HANDLE_MULTIBYTE]: Define. * posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5. (LOCALES): Add cs_CZ.ISO-8859-2. * posix/tst-fnmatch4.c: New file. * posix/tst-fnmatch5.c: New file. + * include/wchar.h (__wmemcmp): Declare. + * wcsmbs/wmemcmp.c: Define __wmemcmp and add wmemcmp as weak alias. + * sysdeps/i386/i686/multiarch/wmemcmp.c: Likewise. + * sysdeps/x86_64/multiarch/wmemcmp.c: Likewise. + * sysdeps/s390/wmemcmp.c: Likewise. -Index: glibc-2.27/posix/Makefile +Index: glibc-2.28/include/wchar.h =================================================================== ---- glibc-2.27.orig/posix/Makefile -+++ glibc-2.27/posix/Makefile +--- glibc-2.28.orig/include/wchar.h ++++ glibc-2.28/include/wchar.h +@@ -143,6 +143,8 @@ libc_hidden_proto (wmemchr) + libc_hidden_proto (__wmemchr) + libc_hidden_proto (wmemset) + libc_hidden_proto (__wmemset) ++extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n) ++ __THROW __attribute_pure__; + + /* Now define the internal interfaces. */ + extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) +Index: glibc-2.28/posix/Makefile +=================================================================== +--- glibc-2.28.orig/posix/Makefile ++++ glibc-2.28/posix/Makefile @@ -92,6 +92,7 @@ tests := test-errno tstgetopt testfnm r bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ tst-pathconf tst-rxspencer-no-utf8 \ @@ -23,7 +46,7 @@ Index: glibc-2.27/posix/Makefile tst-posix_spawn-fd tst-posix_spawn-setsid \ tst-posix_fadvise tst-posix_fadvise64 \ tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \ -@@ -165,7 +166,8 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh $(objpfx)wordexp-test +@@ -166,7 +167,8 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh endif LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \ @@ -33,10 +56,10 @@ Index: glibc-2.27/posix/Makefile include ../gen-locales.mk $(objpfx)bug-regex1.out: $(gen-locales) -Index: glibc-2.27/posix/fnmatch.c +Index: glibc-2.28/posix/fnmatch.c =================================================================== ---- glibc-2.27.orig/posix/fnmatch.c -+++ glibc-2.27/posix/fnmatch.c +--- glibc-2.28.orig/posix/fnmatch.c ++++ glibc-2.28/posix/fnmatch.c @@ -53,7 +53,6 @@ we support a correct implementation only in glibc. */ #ifdef _LIBC @@ -45,10 +68,22 @@ Index: glibc-2.27/posix/fnmatch.c # include "../locale/coll-lookup.h" # include -Index: glibc-2.27/posix/fnmatch_loop.c +@@ -237,6 +236,11 @@ __wcschrnul (const wchar_t *s, wint_t c) + # define MEMPCPY(D, S, N) __wmempcpy (D, S, N) + # define MEMCHR(S, C, N) __wmemchr (S, C, N) + # define STRCOLL(S1, S2) wcscoll (S1, S2) ++# ifdef _LIBC ++# define WMEMCMP(S1, S2, N) __wmemcmp (S1, S2, N) ++# else ++# define WMEMCMP(S1, S2, N) wmemcmp (S1, S2, N) ++# endif + # define WIDE_CHAR_VERSION 1 + /* Change the name the header defines so it doesn't conflict with + the version included above. */ +Index: glibc-2.28/posix/fnmatch_loop.c =================================================================== ---- glibc-2.27.orig/posix/fnmatch_loop.c -+++ glibc-2.27/posix/fnmatch_loop.c +--- glibc-2.28.orig/posix/fnmatch_loop.c ++++ glibc-2.28/posix/fnmatch_loop.c @@ -494,26 +494,12 @@ FCT (const CHAR *pattern, const CHAR *st { int32_t table_size; @@ -73,12 +108,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c - for (strcnt = 0; strcnt < c1; ++strcnt) - str[strcnt] = startp[1 + strcnt]; -#endif -+ int32_t *wextra; ++ CHAR *wextra; +# endif table_size = _NL_CURRENT_WORD (LC_COLLATE, -@@ -525,71 +511,55 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -525,71 +511,54 @@ FCT (const CHAR *pattern, const CHAR *st _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); @@ -126,13 +161,13 @@ Index: glibc-2.27/posix/fnmatch_loop.c + /* Adjust for the alignment. */ + idx = (idx + 3) & ~3; + -+ wextra = (int32_t *) &extra[idx + 4]; ++ wextra = (CHAR *) &extra[idx + 4]; + + if (/* Compare the length of the sequence. */ + c1 == wextra[0] + /* Compare the wide char sequence. */ -+ && memcmp (startp + 1, &wextra[1], -+ c1 * sizeof (UCHAR)) == 0) ++ && WMEMCMP (startp + 1, &wextra[1], ++ c1) == 0) + /* Yep, this is the entry. */ + break; +# else @@ -153,12 +188,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c this is not part of a range. */ -# if WIDE_CHAR_VERSION - int32_t *wextra; -+ if (! is_range - +- - idx += 1 + extra[idx]; - /* Adjust for the alignment. */ - idx = (idx + 3) & ~3; -- ++ if (! is_range + - wextra = (int32_t *) &extra[idx + 4]; -# endif - @@ -173,8 +208,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c - - if ((int32_t) c1 == wextra[idx]) - goto matched; -+ && memcmp (n, &wextra[1], -+ c1 * sizeof (UCHAR)) == 0 ++ && WMEMCMP (n, &wextra[1], c1) == 0 # else - for (c1 = 0; c1 < extra[idx]; ++c1) - if (n[c1] != extra[1 + c1]) @@ -191,7 +225,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c } /* Get the collation sequence value. */ -@@ -597,9 +567,9 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -597,9 +566,9 @@ FCT (const CHAR *pattern, const CHAR *st # if WIDE_CHAR_VERSION cold = wextra[1 + wextra[idx]]; # else @@ -203,7 +237,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c cold = *((int32_t *) &extra[idx]); # endif -@@ -609,10 +579,10 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -609,10 +578,10 @@ FCT (const CHAR *pattern, const CHAR *st { /* No valid character. Match it as a single byte. */ @@ -216,7 +250,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c c = *p++; } else -@@ -620,7 +590,6 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -620,7 +589,6 @@ FCT (const CHAR *pattern, const CHAR *st } } else @@ -224,7 +258,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c #endif { c = FOLD (c); -@@ -712,25 +681,11 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -712,25 +680,11 @@ FCT (const CHAR *pattern, const CHAR *st { int32_t table_size; const int32_t *symb_table; @@ -247,11 +281,11 @@ Index: glibc-2.27/posix/fnmatch_loop.c - representation is UCS4. */ - for (strcnt = 0; strcnt < c1; ++strcnt) - str[strcnt] = startp[1 + strcnt]; -+ int32_t *wextra; ++ CHAR *wextra; # endif table_size = -@@ -743,51 +698,44 @@ FCT (const CHAR *pattern, const CHAR *st +@@ -743,71 +697,63 @@ FCT (const CHAR *pattern, const CHAR *st _NL_CURRENT (LC_COLLATE, _NL_COLLATE_SYMB_EXTRAMB); @@ -312,14 +346,14 @@ Index: glibc-2.27/posix/fnmatch_loop.c + /* Adjust for the alignment. */ + idx = (idx + 3) & ~3; + -+ wextra = (int32_t *) &extra[idx + 4]; ++ wextra = (CHAR *) &extra[idx + 4]; + + if (/* Compare the length of the + sequence. */ + c1 == wextra[0] + /* Compare the wide char sequence. */ -+ && memcmp (startp + 1, &wextra[1], -+ c1 * sizeof (int32_t)) == 0) ++ && WMEMCMP (startp + 1, &wextra[1], ++ c1) == 0) + /* Yep, this is the entry. */ + break; +# else @@ -339,11 +373,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c /* Get the collation sequence value. */ is_seqval = 1; # if WIDE_CHAR_VERSION -@@ -795,19 +743,18 @@ FCT (const CHAR *pattern, const CHAR *st + cend = wextra[1 + wextra[idx]]; # else - /* Adjust for the alignment. */ +- /* Adjust for the alignment. */ idx += 1 + extra[idx]; - idx = (idx + 3) & ~4; ++ /* Adjust for the alignment. */ + idx = (idx + 3) & ~3; cend = *((int32_t *) &extra[idx]); # endif @@ -362,13 +397,13 @@ Index: glibc-2.27/posix/fnmatch_loop.c } else { -Index: glibc-2.27/posix/tst-fnmatch4.c +Index: glibc-2.28/posix/tst-fnmatch4.c =================================================================== --- /dev/null -+++ glibc-2.27/posix/tst-fnmatch4.c -@@ -0,0 +1,51 @@ ++++ glibc-2.28/posix/tst-fnmatch4.c +@@ -0,0 +1,41 @@ +/* Test for fnmatch handling of collating elements -+ Copyright (C) 2015 Free Software Foundation, Inc. ++ Copyright (C) 2019 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 @@ -388,43 +423,33 @@ Index: glibc-2.27/posix/tst-fnmatch4.c +#include +#include +#include ++#include + -+static int ++static void +do_test_locale (const char *locale) +{ -+ const char *pattern = "[[.ch.]]"; ++ TEST_VERIFY_EXIT (setlocale (LC_ALL, locale) != NULL); + -+ if (setlocale (LC_ALL, locale) == NULL) -+ { -+ printf ("could not set locale %s\n", locale); -+ return 1; -+ } -+ -+ if (fnmatch (pattern, "ch", 0) != 0) -+ { -+ printf ("%s didn't match in locale %s\n", pattern, locale); -+ return 1; -+ } -+ -+ return 0; ++ TEST_VERIFY (fnmatch ("[[.ch.]]", "ch", 0) == 0); +} + +static int +do_test (void) +{ -+ return (do_test_locale ("cs_CZ.ISO-8859-2") -+ || do_test_locale ("cs_CZ.UTF-8")); ++ do_test_locale ("cs_CZ.ISO-8859-2"); ++ do_test_locale ("cs_CZ.UTF-8"); ++ ++ return 0; +} + -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" -Index: glibc-2.27/posix/tst-fnmatch5.c ++#include +Index: glibc-2.28/posix/tst-fnmatch5.c =================================================================== --- /dev/null -+++ glibc-2.27/posix/tst-fnmatch5.c -@@ -0,0 +1,53 @@ ++++ glibc-2.28/posix/tst-fnmatch5.c +@@ -0,0 +1,46 @@ +/* Test for fnmatch handling of collating elements -+ Copyright (C) 2015 Free Software Foundation, Inc. ++ Copyright (C) 2019 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 @@ -445,19 +470,17 @@ Index: glibc-2.27/posix/tst-fnmatch5.c +#include +#include +#include ++#include + +#define LENGTH 20000000 + -+char pattern[LENGTH + 7]; ++static char pattern[LENGTH + 7]; + +static int +do_test (void) +{ -+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) -+ { -+ puts ("could not set locale"); -+ return 1; -+ } ++ TEST_VERIFY_EXIT (setlocale (LC_ALL, "en_US.UTF-8") != NULL); ++ + pattern[0] = '['; + pattern[1] = '['; + pattern[2] = '.'; @@ -465,14 +488,74 @@ Index: glibc-2.27/posix/tst-fnmatch5.c + pattern[LENGTH + 3] = '.'; + pattern[LENGTH + 4] = ']'; + pattern[LENGTH + 5] = ']'; -+ int ret = fnmatch (pattern, "a", 0); -+ if (ret == 0) -+ { -+ puts ("fnmatch returned 0 for invalid pattern"); -+ return 1; -+ } ++ TEST_VERIFY (fnmatch (pattern, "a", 0) != 0); ++ + return 0; +} + -+#define TEST_FUNCTION do_test () -+#include "../test-skeleton.c" ++#include +Index: glibc-2.28/sysdeps/i386/i686/multiarch/wmemcmp.c +=================================================================== +--- glibc-2.28.orig/sysdeps/i386/i686/multiarch/wmemcmp.c ++++ glibc-2.28/sysdeps/i386/i686/multiarch/wmemcmp.c +@@ -26,5 +26,6 @@ + # define SYMBOL_NAME wmemcmp + # include "ifunc-ssse3-sse4_2.h" + +-libc_ifunc_redirected (__redirect_wmemcmp, wmemcmp, IFUNC_SELECTOR ()); ++libc_ifunc_redirected (__redirect_wmemcmp, __wmemcmp, IFUNC_SELECTOR ()); ++weak_alias (__wmemcmp, wmemcmp) + #endif +Index: glibc-2.28/sysdeps/s390/multiarch/wmemcmp.c +=================================================================== +--- glibc-2.28.orig/sysdeps/s390/multiarch/wmemcmp.c ++++ glibc-2.28/sysdeps/s390/multiarch/wmemcmp.c +@@ -20,7 +20,8 @@ + # include + # include + +-s390_vx_libc_ifunc2 (__wmemcmp, wmemcmp) ++s390_vx_libc_ifunc (__wmemcmp) ++weak_alias (__wmemcmp, wmemcmp) + + #else + # include +Index: glibc-2.28/sysdeps/x86_64/multiarch/wmemcmp.c +=================================================================== +--- glibc-2.28.orig/sysdeps/x86_64/multiarch/wmemcmp.c ++++ glibc-2.28/sysdeps/x86_64/multiarch/wmemcmp.c +@@ -26,5 +26,6 @@ + # define SYMBOL_NAME wmemcmp + # include "ifunc-memcmp.h" + +-libc_ifunc_redirected (__redirect_wmemcmp, wmemcmp, IFUNC_SELECTOR ()); ++libc_ifunc_redirected (__redirect_wmemcmp, __wmemcmp, IFUNC_SELECTOR ()); ++weak_alias (__wmemcmp, wmemcmp) + #endif +Index: glibc-2.28/wcsmbs/wmemcmp.c +=================================================================== +--- glibc-2.28.orig/wcsmbs/wmemcmp.c ++++ glibc-2.28/wcsmbs/wmemcmp.c +@@ -18,12 +18,12 @@ + + #include + +-#ifndef WMEMCMP +-# define WMEMCMP wmemcmp ++#ifdef WMEMCMP ++# define __wmemcmp WMEMCMP + #endif + + int +-WMEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n) ++__wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n) + { + wchar_t c1; + wchar_t c2; +@@ -81,3 +81,6 @@ WMEMCMP (const wchar_t *s1, const wchar_ + + return 0; + } ++#ifndef WMEMCMP ++weak_alias (__wmemcmp, wmemcmp) ++#endif diff --git a/glibc.changes b/glibc.changes index 76f7998..7ffc50f 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 9 14:21:04 UTC 2019 - schwab@suse.de + +- fnmatch-collating-elements.patch: update +- riscv-flush-icache.patch: fix for compiling against 4.20 headers + ------------------------------------------------------------------- Wed Nov 28 09:52:49 UTC 2018 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index 1716d29..c1b110a 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1,7 +1,7 @@ # # spec file for package glibc # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -292,6 +292,8 @@ Patch1009: pthread-mutex-lock-elision-race.patch Patch1010: x86-haswell-string-flags.patch # PATCH-FIX-UPSTREAM if_nametoindex: Fix descriptor leak for overlong name (CVE-2018-19591, BZ #23927) Patch1011: if-nametoindex-descr-leak.patch +# PATCH-FIX-UPSTREAM riscv: Use __has_include__ to include (BZ #24022) +Patch1012: riscv-flush-icache.patch ### # Patches awaiting upstream approval @@ -513,6 +515,7 @@ makedb: A program to create a database for nss %patch1009 -p1 %patch1010 -p1 %patch1011 -p1 +%patch1012 -p1 %patch2000 -p1 %patch2004 -p1 diff --git a/riscv-flush-icache.patch b/riscv-flush-icache.patch new file mode 100644 index 0000000..bbc876b --- /dev/null +++ b/riscv-flush-icache.patch @@ -0,0 +1,26 @@ +2018-12-31 H.J. Lu + + [BZ #24022] + * sysdeps/unix/sysv/linux/riscv/flush-icache.c: Check if + exists with __has_include__ before including it. + +diff --git a/sysdeps/unix/sysv/linux/riscv/flush-icache.c b/sysdeps/unix/sysv/linux/riscv/flush-icache.c +index d612ef4c6c..0b2042620b 100644 +--- a/sysdeps/unix/sysv/linux/riscv/flush-icache.c ++++ b/sysdeps/unix/sysv/linux/riscv/flush-icache.c +@@ -21,7 +21,11 @@ + #include + #include + #include +-#include ++#if __has_include__ () ++# include ++#else ++# include ++#endif + + typedef int (*func_type) (void *, void *, unsigned long int); + +-- +2.20.1 + From add9e7bf61f0519ffe9a6ccb0d0fcef39947b57cd0a5f1d74f45b880dc596761 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 1 Feb 2019 13:45:56 +0000 Subject: [PATCH 8/8] Accepting request 670585 from home:Andreas_Schwab:Factory - Update to glibc 2.29 * The getcpu wrapper function has been added, which returns the currently used CPU and NUMA node * Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf * The reallocarray function is now declared under _DEFAULT_SOURCE, not just for _GNU_SOURCE, to match BSD environments * For powercp64le ABI, Transactional Lock Elision is now enabled iff kernel indicates that it will abort the transaction prior to entering the kernel (PPC_FEATURE2_HTM_NOSC on hwcap2) * The functions posix_spawn_file_actions_addchdir_np and posix_spawn_file_actions_addfchdir_np have been added, enabling posix_spawn and posix_spawnp to run the new process in a different directory * The popen and system do not run atfork handlers anymore (BZ#17490) * strftime's default formatting of a locale's alternative year (%Ey) has been changed to zero-pad the year to a minimum of two digits, like "%y" * As a GNU extension, the '_' and '-' flags can now be applied to "%EY" to control how the year number is formatted * The glibc.tune tunable namespace has been renamed to glibc.cpu and the tunable glibc.tune.cpu has been renamed to glibc.cpu.name * The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined in , has been corrected to match the type actually used by the Linux kernel * An archaic GNU extension to scanf, under which '%as', '%aS', and '%a[...]' meant to scan a string and allocate space for it with malloc, is now restricted to programs compiled in C89 or C++98 mode with _GNU_SOURCE defined - unwind-ctor.patch, old-getdents64.patch, nss-files-leak.patch, riscv-feholdexcept-setround.patch, OBS-URL: https://build.opensuse.org/request/show/670585 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=516 --- fnmatch-collating-elements.patch | 31 +- gethostid-gethostbyname-failure.patch | 165 ---- glibc-2.28.tar.xz | 3 - glibc-2.28.tar.xz.sig | 16 - glibc-2.29.tar.xz | 3 + glibc-2.29.tar.xz.sig | 11 + glibc-version.diff | 2 +- glibc.changes | 39 + glibc.spec | 52 +- iconv-reset-input-buffer.patch | 9 +- if-nametoindex-descr-leak.patch | 36 - nss-files-leak.patch | 307 -------- old-getdents64.patch | 249 ------ ...ond-broadcast-waiters-after-spinning.patch | 27 - pthread-mutex-lock-elision-race.patch | 717 ------------------ regex-uninit-memory-access.patch | 261 ------- riscv-feholdexcept-setround.patch | 19 - riscv-flush-icache.patch | 26 - spawni-maybe-script-execute.patch | 18 - strstr-huge-needle.patch | 95 --- unwind-ctor.patch | 131 ---- x86-haswell-string-flags.patch | 24 - 22 files changed, 86 insertions(+), 2155 deletions(-) delete mode 100644 gethostid-gethostbyname-failure.patch delete mode 100644 glibc-2.28.tar.xz delete mode 100644 glibc-2.28.tar.xz.sig create mode 100644 glibc-2.29.tar.xz create mode 100644 glibc-2.29.tar.xz.sig delete mode 100644 if-nametoindex-descr-leak.patch delete mode 100644 nss-files-leak.patch delete mode 100644 old-getdents64.patch delete mode 100644 pthread-cond-broadcast-waiters-after-spinning.patch delete mode 100644 pthread-mutex-lock-elision-race.patch delete mode 100644 regex-uninit-memory-access.patch delete mode 100644 riscv-feholdexcept-setround.patch delete mode 100644 riscv-flush-icache.patch delete mode 100644 spawni-maybe-script-execute.patch delete mode 100644 strstr-huge-needle.patch delete mode 100644 unwind-ctor.patch delete mode 100644 x86-haswell-string-flags.patch diff --git a/fnmatch-collating-elements.patch b/fnmatch-collating-elements.patch index a6eba6c..df91e77 100644 --- a/fnmatch-collating-elements.patch +++ b/fnmatch-collating-elements.patch @@ -506,20 +506,31 @@ Index: glibc-2.28/sysdeps/i386/i686/multiarch/wmemcmp.c +libc_ifunc_redirected (__redirect_wmemcmp, __wmemcmp, IFUNC_SELECTOR ()); +weak_alias (__wmemcmp, wmemcmp) #endif -Index: glibc-2.28/sysdeps/s390/multiarch/wmemcmp.c +Index: glibc-2.28/sysdeps/s390/wmemcmp.c =================================================================== ---- glibc-2.28.orig/sysdeps/s390/multiarch/wmemcmp.c -+++ glibc-2.28/sysdeps/s390/multiarch/wmemcmp.c -@@ -20,7 +20,8 @@ - # include +--- glibc-2.28.orig/sysdeps/s390/wmemcmp.c ++++ glibc-2.28/sysdeps/s390/wmemcmp.c +@@ -23,16 +23,17 @@ # include --s390_vx_libc_ifunc2 (__wmemcmp, wmemcmp) -+s390_vx_libc_ifunc (__wmemcmp) -+weak_alias (__wmemcmp, wmemcmp) + # if HAVE_WMEMCMP_C +-extern __typeof (wmemcmp) WMEMCMP_C attribute_hidden; ++extern __typeof (__wmemcmp) WMEMCMP_C attribute_hidden; + # endif - #else - # include + # if HAVE_WMEMCMP_Z13 +-extern __typeof (wmemcmp) WMEMCMP_Z13 attribute_hidden; ++extern __typeof (__wmemcmp) WMEMCMP_Z13 attribute_hidden; + # endif + +-s390_libc_ifunc_expr (wmemcmp, wmemcmp, ++s390_libc_ifunc_expr (__wmemcmp, __wmemcmp, + (HAVE_WMEMCMP_Z13 && (hwcap & HWCAP_S390_VX)) + ? WMEMCMP_Z13 + : WMEMCMP_DEFAULT + ) ++weak_alias (__wmemcmp, wmemcmp) + #endif Index: glibc-2.28/sysdeps/x86_64/multiarch/wmemcmp.c =================================================================== --- glibc-2.28.orig/sysdeps/x86_64/multiarch/wmemcmp.c diff --git a/gethostid-gethostbyname-failure.patch b/gethostid-gethostbyname-failure.patch deleted file mode 100644 index 589bb55..0000000 --- a/gethostid-gethostbyname-failure.patch +++ /dev/null @@ -1,165 +0,0 @@ -2018-09-20 Florian Weimer - - * misc/tst-gethostid.c: New file. - * misc/Makefile [$(build-shared)] (tests): Add tst-gethostid. - (tst-gethostid): Link with -ldl. - -2018-09-20 Mingli Yu - - * sysdeps/unix/sysv/linux/gethostid.c (gethostid): Check for NULL - value from gethostbyname_r. - -Index: glibc-2.28/misc/Makefile -=================================================================== ---- glibc-2.28.orig/misc/Makefile -+++ glibc-2.28/misc/Makefile -@@ -86,6 +86,11 @@ tests := tst-dirname tst-tsearch tst-fds - tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \ - tst-preadvwritev2 tst-preadvwritev64v2 - -+# Tests which need libdl. -+ifeq (yes,$(build-shared)) -+tests += tst-gethostid -+endif -+ - tests-internal := tst-atomic tst-atomic-long tst-allocate_once - tests-static := tst-empty - -@@ -145,3 +150,5 @@ tst-allocate_once-ENV = MALLOC_TRACE=$(o - $(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out - $(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \ - $(evaluate-test) -+ -+$(objpfx)tst-gethostid: $(libdl) -Index: glibc-2.28/misc/tst-gethostid.c -=================================================================== ---- /dev/null -+++ glibc-2.28/misc/tst-gethostid.c -@@ -0,0 +1,108 @@ -+/* Basic test for gethostid. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Initial test is run outside a chroot, to increase the likelihood of -+ success. */ -+static void -+outside_chroot (void *closure) -+{ -+ long id = gethostid (); -+ printf ("info: host ID outside chroot: 0x%lx\n", id); -+} -+ -+/* The same, but this time perform a chroot operation. */ -+static void -+in_chroot (void *closure) -+{ -+ const char *chroot_path = closure; -+ xchroot (chroot_path); -+ long id = gethostid (); -+ printf ("info: host ID in chroot: 0x%lx\n", id); -+} -+ -+static int -+do_test (void) -+{ -+ support_isolate_in_subprocess (outside_chroot, NULL); -+ -+ /* Now run the test inside a chroot. */ -+ support_become_root (); -+ if (!support_can_chroot ()) -+ /* Cannot perform further tests. */ -+ return 0; -+ -+ /* Only use nss_files. */ -+ __nss_configure_lookup ("hosts", "files"); -+ -+ /* Load the DSO outside of the chroot. */ -+ xdlopen (LIBNSS_FILES_SO, RTLD_LAZY); -+ -+ char *chroot_dir = support_create_temp_directory ("tst-gethostid-"); -+ support_isolate_in_subprocess (in_chroot, chroot_dir); -+ -+ /* Tests with /etc/hosts in the chroot. */ -+ { -+ char *path = xasprintf ("%s/etc", chroot_dir); -+ add_temp_file (path); -+ xmkdir (path, 0777); -+ free (path); -+ path = xasprintf ("%s/etc/hosts", chroot_dir); -+ add_temp_file (path); -+ -+ FILE *fp = xfopen (path, "w"); -+ xfclose (fp); -+ printf ("info: chroot test with an empty /etc/hosts file\n"); -+ support_isolate_in_subprocess (in_chroot, chroot_dir); -+ -+ char hostname[1024]; -+ int ret = gethostname (hostname, sizeof (hostname)); -+ if (ret < 0) -+ printf ("warning: invalid result from gethostname: %d\n", ret); -+ else if (strlen (hostname) == 0) -+ puts ("warning: gethostname returned empty string"); -+ else -+ { -+ printf ("info: chroot test with IPv6 address in /etc/hosts for: %s\n", -+ hostname); -+ fp = xfopen (path, "w"); -+ /* Use an IPv6 address to induce another lookup failure. */ -+ fprintf (fp, "2001:db8::1 %s\n", hostname); -+ xfclose (fp); -+ support_isolate_in_subprocess (in_chroot, chroot_dir); -+ } -+ free (path); -+ } -+ free (chroot_dir); -+ -+ return 0; -+} -+ -+#include -Index: glibc-2.28/sysdeps/unix/sysv/linux/gethostid.c -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/gethostid.c -+++ glibc-2.28/sysdeps/unix/sysv/linux/gethostid.c -@@ -102,12 +102,12 @@ gethostid (void) - { - int ret = __gethostbyname_r (hostname, &hostbuf, - tmpbuf.data, tmpbuf.length, &hp, &herr); -- if (ret == 0) -+ if (ret == 0 && hp != NULL) - break; - else - { - /* Enlarge the buffer on ERANGE. */ -- if (herr == NETDB_INTERNAL && errno == ERANGE) -+ if (ret != 0 && herr == NETDB_INTERNAL && errno == ERANGE) - { - if (!scratch_buffer_grow (&tmpbuf)) - return 0; diff --git a/glibc-2.28.tar.xz b/glibc-2.28.tar.xz deleted file mode 100644 index 64e7e12..0000000 --- a/glibc-2.28.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b1900051afad76f7a4f73e71413df4826dce085ef8ddb785a945b66d7d513082 -size 16484344 diff --git a/glibc-2.28.tar.xz.sig b/glibc-2.28.tar.xz.sig deleted file mode 100644 index 99e38e1..0000000 --- a/glibc-2.28.tar.xz.sig +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIcBAABAgAGBQJbYVUmAAoJEBZ5K06iU0D43VkP/19+lsSsDZ97QfojgE/lXgJU -5CmHV4Agjhf1MaFSbmDOwFjlMeU7TXkygQ7z9+E8oikRi69bGhFZjeUenr2mcWWi -FKaF4EVYIM+r4nXJJeZVBKgmFZdzjyqklH2P7/koKuqzMuC8zHX8fLYqDhwxpquO -lHGTR7ai5wFgBSfx/CflpAJ6ZVg9FCMA/GA2W9gJU9C3iyCux5LSrF2Oq035bQ0z -3WAHdjqTzLV8SI2B4XEadmjMseLk+AQwJ+xEa5eoZd5qF3TJVzOWRfSNEJC1jd9S -PonzLStU7u/YcDs33jiW+h4heXA8qK5grF6HaBvh8DBkzzJrMLRKBiprgRdt/UBq -jGSTVUlGDCs39QnnOedWOBxza/mmm24nE6cOE8eTq+OUvdwR9uY4ADrx3bCYNJ+N -B15JAkdfJguAYtqEFbXJL7j4ws18sjfphWbdQYZCUxgSZ9BRjrmPM1MFHlv7BDkx -u/gDEYyGZSVcYAAZ6WOdRD5mjTFpN9kx7qxMqCWL9O1L0UL6cIc2tN6ZI+zBI24m -60Nkh1R5zIepmsTxurYGm9vB+YqoR74N4gUz2LHMNRhZBCjGd4DYkriNOHlqLs1q -W72Bn1uDnWqyWaH59HjNyHEh38qiF+4yD8pJIV38+EUJiUROt1f26ZDgtcys1l+5 -7mN5kVcGKT//Sim81yI5 -=nbAu ------END PGP SIGNATURE----- diff --git a/glibc-2.29.tar.xz b/glibc-2.29.tar.xz new file mode 100644 index 0000000..efd959e --- /dev/null +++ b/glibc-2.29.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3eeb8d57e25ca9fc13c2af3dae97754f9f643bc69229546828e3a240e2af04b +size 16515488 diff --git a/glibc-2.29.tar.xz.sig b/glibc-2.29.tar.xz.sig new file mode 100644 index 0000000..056b91e --- /dev/null +++ b/glibc-2.29.tar.xz.sig @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- + +iQEzBAABCAAdFiEEvHxzcmN+wQxX16plecQ9+/HPIYcFAlxTOTQACgkQecQ9+/HP +IYcW+Qf9EeusdF3KQfwpErbtSgoLwthbLWv93f9+r/XIa0oWvAeaU7DHeZf85px2 +OLA0mG+p0D8JIBMXPX1oQUKLA+0mN7jdX9K29q2ibMYMDbHfTTfFhMdP3JDaixvx +XSAHOjvmLPteb1yix5hH0l7GhyWhV4n9GAMUdpOJ8Gbsof78i4eNdlLReQYqH/R7 +frsmuFomNrpy+CMNGxEHpcTrUqkL7x78d/msgaQjDQi1eoqpTWmgzgCjvxv5HMPN +JKMwYTsgLk5cr51lHCDYbLE2ksn84yoMLJQz8dV7JH28EaBlgl1nss1aquX2zUGM +SDtYqhBBGB8d6ijv5x26NbyfFP6bvQ== +=Xdix +-----END PGP SIGNATURE----- diff --git a/glibc-version.diff b/glibc-version.diff index b98f13d..f9e92ec 100644 --- a/glibc-version.diff +++ b/glibc-version.diff @@ -8,7 +8,7 @@ Index: glibc-2.27/csu/version.c static const char banner[] = -"GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\ +"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID").\n\ - Copyright (C) 2018 Free Software Foundation, Inc.\n\ + Copyright (C) 2019 Free Software Foundation, Inc.\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\ PARTICULAR PURPOSE.\n\ diff --git a/glibc.changes b/glibc.changes index 7ffc50f..57b7e2c 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,42 @@ +------------------------------------------------------------------- +Fri Feb 1 10:34:39 UTC 2019 - schwab@suse.de + +- Update to glibc 2.29 + * The getcpu wrapper function has been added, which returns the currently + used CPU and NUMA node + * Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf + * The reallocarray function is now declared under _DEFAULT_SOURCE, not just + for _GNU_SOURCE, to match BSD environments + * For powercp64le ABI, Transactional Lock Elision is now enabled iff kernel + indicates that it will abort the transaction prior to entering the kernel + (PPC_FEATURE2_HTM_NOSC on hwcap2) + * The functions posix_spawn_file_actions_addchdir_np and + posix_spawn_file_actions_addfchdir_np have been added, enabling + posix_spawn and posix_spawnp to run the new process in a different + directory + * The popen and system do not run atfork handlers anymore (BZ#17490) + * strftime's default formatting of a locale's alternative year (%Ey) + has been changed to zero-pad the year to a minimum of two digits, + like "%y" + * As a GNU extension, the '_' and '-' flags can now be applied to + "%EY" to control how the year number is formatted + * The glibc.tune tunable namespace has been renamed to glibc.cpu and the + tunable glibc.tune.cpu has been renamed to glibc.cpu.name + * The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined + in , has been corrected to match the type actually used by + the Linux kernel + * An archaic GNU extension to scanf, under which '%as', '%aS', and '%a[...]' + meant to scan a string and allocate space for it with malloc, is now + restricted to programs compiled in C89 or C++98 mode with _GNU_SOURCE + defined +- unwind-ctor.patch, old-getdents64.patch, nss-files-leak.patch, + riscv-feholdexcept-setround.patch, + pthread-cond-broadcast-waiters-after-spinning.patch, + regex-uninit-memory-access.patch, spawni-maybe-script-execute.patch, + gethostid-gethostbyname-failure.patch, strstr-huge-needle.patch, + pthread-mutex-lock-elision-race.patch, x86-haswell-string-flags.patch, + if-nametoindex-descr-leak.patch, riscv-flush-icache.patch: Removed + ------------------------------------------------------------------- Wed Jan 9 14:21:04 UTC 2019 - schwab@suse.de diff --git a/glibc.spec b/glibc.spec index c1b110a..ab88571 100644 --- a/glibc.spec +++ b/glibc.spec @@ -63,6 +63,7 @@ BuildRequires: libcap-devel BuildRequires: libselinux-devel BuildRequires: makeinfo BuildRequires: pwdutils +BuildRequires: python3-base BuildRequires: systemd-rpm-macros BuildRequires: systemtap-headers BuildRequires: xz @@ -70,7 +71,8 @@ BuildRequires: xz BuildRequires: gcc-c++ BuildRequires: gdb BuildRequires: glibc-devel-static -BuildRequires: libidn2-0 +# BZ #24113 +#BuildRequires: libidn2-0 BuildRequires: libstdc++-devel BuildRequires: python3-pexpect %endif @@ -148,10 +150,10 @@ BuildArch: i686 %define enablekernel 4.15 %endif -Version: 2.28 +Version: 2.29 Release: 0 %if !%{build_snapshot} -%define git_id 3c03baca37fd +%define git_id 56c86f5dd516 %define libversion %version %else %define git_id %(echo %version | sed 's/.*\.g//') @@ -268,32 +270,6 @@ Patch306: glibc-fix-double-loopback.diff ### # Patches from upstream ### -# PATCH-FIX-UPSTREAM Add missing unwind information to ld.so on powerpc32 (BZ #23707) -Patch1000: unwind-ctor.patch -# PATCH-FIX-UPSTREAM Rewrite __old_getdents64 (BZ #23497) -Patch1001: old-getdents64.patch -# PATCH-FIX-UPSTREAM nss_files: Fix file stream leak in aliases lookup (BZ #23521) -Patch1002: nss-files-leak.patch -# PATCH-FIX-UPSTREAM RISC-V: Fix rounding save/restore bug -Patch1003: riscv-feholdexcept-setround.patch -# PATCH-FIX-UPSTREAM pthread_cond_broadcast: Fix waiters-after-spinning case (BZ #23538) -Patch1004: pthread-cond-broadcast-waiters-after-spinning.patch -# PATCH-FIX-UPSTREAM regex: fix uninitialized memory access (BZ #23578) -Patch1005: regex-uninit-memory-access.patch -# PATCH-FIX-UPSTREAM Fix segfault in maybe_script_execute -Patch1006: spawni-maybe-script-execute.patch -# PATCH-FIX-UPSTREAM Linux gethostid: Check for NULL value from gethostbyname_r (BZ #23679) -Patch1007: gethostid-gethostbyname-failure.patch -# PATCH-FIX-UPSTREAM Fix strstr bug with huge needles (BZ #23637) -Patch1008: strstr-huge-needle.patch -# PATCH-FIX-UPSTREAM Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP (BZ #23275) -Patch1009: pthread-mutex-lock-elision-race.patch -# PATCH-FIX-UPSTREAM x86: Fix Haswell CPU string flags (BZ #23709) -Patch1010: x86-haswell-string-flags.patch -# PATCH-FIX-UPSTREAM if_nametoindex: Fix descriptor leak for overlong name (CVE-2018-19591, BZ #23927) -Patch1011: if-nametoindex-descr-leak.patch -# PATCH-FIX-UPSTREAM riscv: Use __has_include__ to include (BZ #24022) -Patch1012: riscv-flush-icache.patch ### # Patches awaiting upstream approval @@ -503,20 +479,6 @@ makedb: A program to create a database for nss %patch304 -p1 %patch306 -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 - %patch2000 -p1 %patch2004 -p1 %patch2005 -p1 @@ -888,9 +850,9 @@ cc-base/elf/ldconfig -vn $destdir # this will not work if we generate them in parallel. # thus we need to run fdupes on /usr/lib/locale/ # Still, on my system this is a speed advantage: - # non-parallel build for install-locales: 9:34mins + # non-parallel build for install-locale-files: 9:34mins # parallel build with fdupes: 7:08mins - make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales + make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locale-files # Avoid hardlinks across subpackages mv %{buildroot}/usr/lib/locale/{en_US,C}.utf8 . %fdupes %{buildroot}/usr/lib/locale diff --git a/iconv-reset-input-buffer.patch b/iconv-reset-input-buffer.patch index ef336ec..80d7597 100644 --- a/iconv-reset-input-buffer.patch +++ b/iconv-reset-input-buffer.patch @@ -17,13 +17,12 @@ Index: glibc-2.27/iconv/Makefile =================================================================== --- glibc-2.27.orig/iconv/Makefile +++ glibc-2.27/iconv/Makefile -@@ -43,7 +43,8 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i - CFLAGS-linereader.c += -DNO_TRANSLITERATION +@@ -44,7 +44,7 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i 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 \ -+ tst-iconv7 + tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \ +- tst-iconv-mt ++ tst-iconv7 tst-iconv-mt others = iconv_prog iconvconfig install-others-programs = $(inst_bindir)/iconv diff --git a/if-nametoindex-descr-leak.patch b/if-nametoindex-descr-leak.patch deleted file mode 100644 index 66e2d01..0000000 --- a/if-nametoindex-descr-leak.patch +++ /dev/null @@ -1,36 +0,0 @@ -2018-11-27 Florian Weimer - - [BZ #23927] - CVE-2018-19591 - * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Avoid - descriptor leak in case of ENODEV error. - -Index: glibc-2.28/sysdeps/unix/sysv/linux/if_index.c -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/if_index.c -+++ glibc-2.28/sysdeps/unix/sysv/linux/if_index.c -@@ -38,11 +38,6 @@ __if_nametoindex (const char *ifname) - return 0; - #else - struct ifreq ifr; -- int fd = __opensock (); -- -- if (fd < 0) -- return 0; -- - if (strlen (ifname) >= IFNAMSIZ) - { - __set_errno (ENODEV); -@@ -50,6 +45,12 @@ __if_nametoindex (const char *ifname) - } - - strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); -+ -+ int fd = __opensock (); -+ -+ if (fd < 0) -+ return 0; -+ - if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0) - { - int saved_errno = errno; diff --git a/nss-files-leak.patch b/nss-files-leak.patch deleted file mode 100644 index 11af9b5..0000000 --- a/nss-files-leak.patch +++ /dev/null @@ -1,307 +0,0 @@ -2018-08-14 Florian Weimer - - [BZ #23521] - [BZ #23522] - * nss/nss_files/files-alias.c (get_next_alias): During :include: - processing, bail out if no room, and close the stream before - returning ERANGE. - * nss/Makefile (tests): Add tst-nss-files-alias-leak. - (tst-nss-files-alias-leak): Link with libdl. - (tst-nss-files-alias-leak.out): Depend on nss_files. - - * nss/tst-nss-files-alias-leak.c: New file. - -Index: glibc-2.28/nss/Makefile -=================================================================== ---- glibc-2.28.orig/nss/Makefile -+++ glibc-2.28/nss/Makefile -@@ -65,6 +65,7 @@ ifeq (yes,$(build-shared)) - tests += tst-nss-files-hosts-erange - tests += tst-nss-files-hosts-multi - tests += tst-nss-files-hosts-getent -+tests += tst-nss-files-alias-leak - endif - - # If we have a thread library then we can test cancellation against -@@ -171,3 +172,5 @@ endif - $(objpfx)tst-nss-files-hosts-erange: $(libdl) - $(objpfx)tst-nss-files-hosts-multi: $(libdl) - $(objpfx)tst-nss-files-hosts-getent: $(libdl) -+$(objpfx)tst-nss-files-alias-leak: $(libdl) -+$(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so -Index: glibc-2.28/nss/nss_files/files-alias.c -=================================================================== ---- glibc-2.28.orig/nss/nss_files/files-alias.c -+++ glibc-2.28/nss/nss_files/files-alias.c -@@ -221,6 +221,13 @@ get_next_alias (FILE *stream, const char - { - while (! feof_unlocked (listfile)) - { -+ if (room_left < 2) -+ { -+ free (old_line); -+ fclose (listfile); -+ goto no_more_room; -+ } -+ - first_unused[room_left - 1] = '\xff'; - line = fgets_unlocked (first_unused, room_left, - listfile); -@@ -229,6 +236,7 @@ get_next_alias (FILE *stream, const char - if (first_unused[room_left - 1] != '\xff') - { - free (old_line); -+ fclose (listfile); - goto no_more_room; - } - -@@ -256,6 +264,7 @@ get_next_alias (FILE *stream, const char - + __alignof__ (char *))) - { - free (old_line); -+ fclose (listfile); - goto no_more_room; - } - room_left -= ((first_unused - cp) -Index: glibc-2.28/nss/tst-nss-files-alias-leak.c -=================================================================== ---- /dev/null -+++ glibc-2.28/nss/tst-nss-files-alias-leak.c -@@ -0,0 +1,237 @@ -+/* Check for file descriptor leak in alias :include: processing (bug 23521). -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static struct support_chroot *chroot_env; -+ -+/* Number of the aliases for the "many" user. This must be large -+ enough to trigger reallocation for the pointer array, but result in -+ answers below the maximum size tried in do_test. */ -+enum { many_aliases = 30 }; -+ -+static void -+prepare (int argc, char **argv) -+{ -+ chroot_env = support_chroot_create -+ ((struct support_chroot_configuration) { } ); -+ -+ char *path = xasprintf ("%s/etc/aliases", chroot_env->path_chroot); -+ add_temp_file (path); -+ support_write_file_string -+ (path, -+ "user1: :include:/etc/aliases.user1\n" -+ "user2: :include:/etc/aliases.user2\n" -+ "comment: comment1, :include:/etc/aliases.comment\n" -+ "many: :include:/etc/aliases.many\n"); -+ free (path); -+ -+ path = xasprintf ("%s/etc/aliases.user1", chroot_env->path_chroot); -+ add_temp_file (path); -+ support_write_file_string (path, "alias1\n"); -+ free (path); -+ -+ path = xasprintf ("%s/etc/aliases.user2", chroot_env->path_chroot); -+ add_temp_file (path); -+ support_write_file_string (path, "alias1a, alias2\n"); -+ free (path); -+ -+ path = xasprintf ("%s/etc/aliases.comment", chroot_env->path_chroot); -+ add_temp_file (path); -+ support_write_file_string -+ (path, -+ /* The line must be longer than the line with the :include: -+ directive in /etc/aliases. */ -+ "# Long line. ##############################################\n" -+ "comment2\n"); -+ free (path); -+ -+ path = xasprintf ("%s/etc/aliases.many", chroot_env->path_chroot); -+ add_temp_file (path); -+ FILE *fp = xfopen (path, "w"); -+ for (int i = 0; i < many_aliases; ++i) -+ fprintf (fp, "a%d\n", i); -+ TEST_VERIFY_EXIT (! ferror (fp)); -+ xfclose (fp); -+ free (path); -+} -+ -+/* The names of the users to test. */ -+static const char *users[] = { "user1", "user2", "comment", "many" }; -+ -+static void -+check_aliases (int id, const struct aliasent *e) -+{ -+ TEST_VERIFY_EXIT (id >= 0 || id < array_length (users)); -+ const char *name = users[id]; -+ TEST_COMPARE_BLOB (e->alias_name, strlen (e->alias_name), -+ name, strlen (name)); -+ -+ switch (id) -+ { -+ case 0: -+ TEST_COMPARE (e->alias_members_len, 1); -+ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), -+ "alias1", strlen ("alias1")); -+ break; -+ -+ case 1: -+ TEST_COMPARE (e->alias_members_len, 2); -+ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), -+ "alias1a", strlen ("alias1a")); -+ TEST_COMPARE_BLOB (e->alias_members[1], strlen (e->alias_members[1]), -+ "alias2", strlen ("alias2")); -+ break; -+ -+ case 2: -+ TEST_COMPARE (e->alias_members_len, 2); -+ TEST_COMPARE_BLOB (e->alias_members[0], strlen (e->alias_members[0]), -+ "comment1", strlen ("comment1")); -+ TEST_COMPARE_BLOB (e->alias_members[1], strlen (e->alias_members[1]), -+ "comment2", strlen ("comment2")); -+ break; -+ -+ case 3: -+ TEST_COMPARE (e->alias_members_len, many_aliases); -+ for (int i = 0; i < e->alias_members_len; ++i) -+ { -+ char alias[30]; -+ int len = snprintf (alias, sizeof (alias), "a%d", i); -+ TEST_VERIFY_EXIT (len > 0); -+ TEST_COMPARE_BLOB (e->alias_members[i], strlen (e->alias_members[i]), -+ alias, len); -+ } -+ break; -+ } -+} -+ -+static int -+do_test (void) -+{ -+ /* Make sure we don't try to load the module in the chroot. */ -+ if (dlopen (LIBNSS_FILES_SO, RTLD_NOW) == NULL) -+ FAIL_EXIT1 ("could not load " LIBNSS_FILES_SO ": %s", dlerror ()); -+ -+ /* Some of these descriptors will become unavailable if there is a -+ file descriptor leak. 10 is chosen somewhat arbitrarily. The -+ array must be longer than the number of files opened by nss_files -+ at the same time (currently that number is 2). */ -+ int next_descriptors[10]; -+ for (size_t i = 0; i < array_length (next_descriptors); ++i) -+ { -+ next_descriptors[i] = dup (0); -+ TEST_VERIFY_EXIT (next_descriptors[i] > 0); -+ } -+ for (size_t i = 0; i < array_length (next_descriptors); ++i) -+ xclose (next_descriptors[i]); -+ -+ support_become_root (); -+ if (!support_can_chroot ()) -+ return EXIT_UNSUPPORTED; -+ -+ __nss_configure_lookup ("aliases", "files"); -+ -+ xchroot (chroot_env->path_chroot); -+ -+ /* Attempt various buffer sizes. If the operation succeeds, we -+ expect correct data. */ -+ for (int id = 0; id < array_length (users); ++id) -+ { -+ bool found = false; -+ for (size_t size = 1; size <= 1000; ++size) -+ { -+ void *buffer = malloc (size); -+ struct aliasent result; -+ struct aliasent *res; -+ errno = EINVAL; -+ int ret = getaliasbyname_r (users[id], &result, buffer, size, &res); -+ if (ret == 0) -+ { -+ if (res != NULL) -+ { -+ found = true; -+ check_aliases (id, res); -+ } -+ else -+ { -+ support_record_failure (); -+ printf ("error: failed lookup for user \"%s\", size %zu\n", -+ users[id], size); -+ } -+ } -+ else if (ret != ERANGE) -+ { -+ support_record_failure (); -+ printf ("error: invalid return code %d (user \%s\", size %zu)\n", -+ ret, users[id], size); -+ } -+ free (buffer); -+ -+ /* Make sure that we did not have a file descriptor leak. */ -+ for (size_t i = 0; i < array_length (next_descriptors); ++i) -+ { -+ int new_fd = dup (0); -+ if (new_fd != next_descriptors[i]) -+ { -+ support_record_failure (); -+ printf ("error: descriptor %d at index %zu leaked" -+ " (user \"%s\", size %zu)\n", -+ next_descriptors[i], i, users[id], size); -+ -+ /* Close unexpected descriptor, the leak probing -+ descriptors, and the leaked descriptor -+ next_descriptors[i]. */ -+ xclose (new_fd); -+ for (size_t j = 0; j <= i; ++j) -+ xclose (next_descriptors[j]); -+ goto next_size; -+ } -+ } -+ for (size_t i = 0; i < array_length (next_descriptors); ++i) -+ xclose (next_descriptors[i]); -+ -+ next_size: -+ ; -+ } -+ if (!found) -+ { -+ support_record_failure (); -+ printf ("error: user %s not found\n", users[id]); -+ } -+ } -+ -+ support_chroot_free (chroot_env); -+ return 0; -+} -+ -+#define PREPARE prepare -+#include diff --git a/old-getdents64.patch b/old-getdents64.patch deleted file mode 100644 index d7dbf4f..0000000 --- a/old-getdents64.patch +++ /dev/null @@ -1,249 +0,0 @@ -2018-08-10 Florian Weimer - - [BZ #23497] - * sysdeps/unix/sysv/linux/getdents64.c (handle_overflow): New - function. - (__old_getdents64): Use getdents64. Convert entries without - moving them. - * sysdeps/unix/sysv/linux/tst-readdir64-compat.c: New file. - * sysdeps/unix/sysv/linux/Makefile (tests-internal): Add - tst-readdir64-compat. - -Index: glibc-2.28/sysdeps/unix/sysv/linux/Makefile -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/Makefile -+++ glibc-2.28/sysdeps/unix/sysv/linux/Makefile -@@ -161,6 +161,7 @@ inhibit-glue = yes - - ifeq ($(subdir),dirent) - sysdep_routines += getdirentries getdirentries64 -+tests-internal += tst-readdir64-compat - endif - - ifeq ($(subdir),nis) -Index: glibc-2.28/sysdeps/unix/sysv/linux/getdents64.c -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/getdents64.c -+++ glibc-2.28/sysdeps/unix/sysv/linux/getdents64.c -@@ -33,41 +33,80 @@ strong_alias (__getdents64, __getdents) - # include - - # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2) --# include -+# include -+# include - --/* kernel definition of as of 3.2. */ --struct compat_linux_dirent -+static ssize_t -+handle_overflow (int fd, __off64_t offset, ssize_t count) - { -- /* Both d_ino and d_off are compat_ulong_t which are defined in all -- architectures as 'u32'. */ -- uint32_t d_ino; -- uint32_t d_off; -- unsigned short d_reclen; -- char d_name[1]; --}; -+ /* If this is the first entry in the buffer, we can report the -+ error. */ -+ if (count == 0) -+ { -+ __set_errno (EOVERFLOW); -+ return -1; -+ } -+ -+ /* Otherwise, seek to the overflowing entry, so that the next call -+ will report the error, and return the data read so far.. */ -+ if (__lseek64 (fd, offset, SEEK_SET) != 0) -+ return -1; -+ return count; -+} - - ssize_t - __old_getdents64 (int fd, char *buf, size_t nbytes) - { -- ssize_t retval = INLINE_SYSCALL_CALL (getdents, fd, buf, nbytes); -+ /* We do not move the individual directory entries. This is only -+ possible if the target type (struct __old_dirent64) is smaller -+ than the source type. */ -+ _Static_assert (offsetof (struct __old_dirent64, d_name) -+ <= offsetof (struct dirent64, d_name), -+ "__old_dirent64 is larger than dirent64"); -+ _Static_assert (__alignof__ (struct __old_dirent64) -+ <= __alignof__ (struct dirent64), -+ "alignment of __old_dirent64 is larger than dirent64"); - -- /* The kernel added the d_type value after the name. Change this now. */ -- if (retval != -1) -+ ssize_t retval = INLINE_SYSCALL_CALL (getdents64, fd, buf, nbytes); -+ if (retval > 0) - { -- union -- { -- struct compat_linux_dirent k; -- struct dirent u; -- } *kbuf = (void *) buf; -- -- while ((char *) kbuf < buf + retval) -+ char *p = buf; -+ char *end = buf + retval; -+ while (p < end) - { -- char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1); -- memmove (kbuf->u.d_name, kbuf->k.d_name, -- strlen (kbuf->k.d_name) + 1); -- kbuf->u.d_type = d_type; -+ struct dirent64 *source = (struct dirent64 *) p; -+ -+ /* Copy out the fixed-size data. */ -+ __ino_t ino = source->d_ino; -+ __off64_t offset = source->d_off; -+ unsigned int reclen = source->d_reclen; -+ unsigned char type = source->d_type; -+ -+ /* Check for ino_t overflow. */ -+ if (__glibc_unlikely (ino != source->d_ino)) -+ return handle_overflow (fd, offset, p - buf); -+ -+ /* Convert to the target layout. Use a separate struct and -+ memcpy to side-step aliasing issues. */ -+ struct __old_dirent64 result; -+ result.d_ino = ino; -+ result.d_off = offset; -+ result.d_reclen = reclen; -+ result.d_type = type; -+ -+ /* Write the fixed-sized part of the result to the -+ buffer. */ -+ size_t result_name_offset = offsetof (struct __old_dirent64, d_name); -+ memcpy (p, &result, result_name_offset); -+ -+ /* Adjust the position of the name if necessary. Copy -+ everything until the end of the record, including the -+ terminating NUL byte. */ -+ if (result_name_offset != offsetof (struct dirent64, d_name)) -+ memmove (p + result_name_offset, source->d_name, -+ reclen - offsetof (struct dirent64, d_name)); - -- kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen); -+ p += reclen; - } - } - return retval; -Index: glibc-2.28/sysdeps/unix/sysv/linux/tst-readdir64-compat.c -=================================================================== ---- /dev/null -+++ glibc-2.28/sysdeps/unix/sysv/linux/tst-readdir64-compat.c -@@ -0,0 +1,111 @@ -+/* Test readdir64 compatibility symbol. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Copied from . */ -+struct __old_dirent64 -+ { -+ __ino_t d_ino; -+ __off64_t d_off; -+ unsigned short int d_reclen; -+ unsigned char d_type; -+ char d_name[256]; -+ }; -+ -+typedef struct __old_dirent64 *(*compat_readdir64_type) (DIR *); -+ -+#if TEST_COMPAT (libc, GLIBC_2_1, GLIBC_2_2) -+struct __old_dirent64 *compat_readdir64 (DIR *); -+compat_symbol_reference (libc, compat_readdir64, readdir64, GLIBC_2_1); -+#endif -+ -+static int -+do_test (void) -+{ -+#if TEST_COMPAT (libc, GLIBC_2_1, GLIBC_2_2) -+ -+ /* Directory stream using the non-compat readdir64 symbol. The test -+ checks against this. */ -+ DIR *dir_reference = opendir ("."); -+ TEST_VERIFY_EXIT (dir_reference != NULL); -+ DIR *dir_test = opendir ("."); -+ TEST_VERIFY_EXIT (dir_test != NULL); -+ -+ /* This loop assumes that the enumeration order is consistent for -+ two different handles. Nothing should write to the current -+ directory (in the source tree) while this test runs, so there -+ should not be any difference due to races. */ -+ size_t count = 0; -+ while (true) -+ { -+ errno = 0; -+ struct dirent64 *entry_reference = readdir64 (dir_reference); -+ if (entry_reference == NULL && errno != 0) -+ FAIL_EXIT1 ("readdir64 entry %zu: %m\n", count); -+ struct __old_dirent64 *entry_test = compat_readdir64 (dir_test); -+ if (entry_reference == NULL) -+ { -+ if (errno == EOVERFLOW) -+ { -+ TEST_VERIFY (entry_reference->d_ino -+ != (__ino_t) entry_reference->d_ino); -+ printf ("info: inode number overflow at entry %zu\n", count); -+ break; -+ } -+ if (errno != 0) -+ FAIL_EXIT1 ("compat readdir64 entry %zu: %m\n", count); -+ } -+ -+ /* Check that both streams end at the same time. */ -+ if (entry_reference == NULL) -+ { -+ TEST_VERIFY (entry_test == NULL); -+ break; -+ } -+ else -+ TEST_VERIFY_EXIT (entry_test != NULL); -+ -+ /* Check that the entries are the same. */ -+ TEST_COMPARE_BLOB (entry_reference->d_name, -+ strlen (entry_reference->d_name), -+ entry_test->d_name, strlen (entry_test->d_name)); -+ TEST_COMPARE (entry_reference->d_ino, entry_test->d_ino); -+ TEST_COMPARE (entry_reference->d_off, entry_test->d_off); -+ TEST_COMPARE (entry_reference->d_type, entry_test->d_type); -+ TEST_COMPARE (entry_reference->d_reclen, entry_test->d_reclen); -+ -+ ++count; -+ } -+ printf ("info: %zu directory entries found\n", count); -+ TEST_VERIFY (count >= 3); /* ".", "..", and some source files. */ -+ -+ TEST_COMPARE (closedir (dir_test), 0); -+ TEST_COMPARE (closedir (dir_reference), 0); -+#endif -+ return 0; -+} -+ -+#include diff --git a/pthread-cond-broadcast-waiters-after-spinning.patch b/pthread-cond-broadcast-waiters-after-spinning.patch deleted file mode 100644 index 74642b1..0000000 --- a/pthread-cond-broadcast-waiters-after-spinning.patch +++ /dev/null @@ -1,27 +0,0 @@ -2018-08-27 Martin Kuchta - Torvald Riegel - - [BZ #23538] - * nptl/pthread_cond_common.c (__condvar_quiesce_and_switch_g1): - Update r to include the set wake-request flag if waiters are - remaining after spinning. - -Index: glibc-2.28/nptl/pthread_cond_common.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_cond_common.c -+++ glibc-2.28/nptl/pthread_cond_common.c -@@ -405,8 +405,12 @@ __condvar_quiesce_and_switch_g1 (pthread - { - /* There is still a waiter after spinning. Set the wake-request - flag and block. Relaxed MO is fine because this is just about -- this futex word. */ -- r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1); -+ this futex word. -+ -+ Update r to include the set wake-request flag so that the upcoming -+ futex_wait only blocks if the flag is still set (otherwise, we'd -+ violate the basic client-side futex protocol). */ -+ r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1) | 1; - - if ((r >> 1) > 0) - futex_wait_simple (cond->__data.__g_refs + g1, r, private); diff --git a/pthread-mutex-lock-elision-race.patch b/pthread-mutex-lock-elision-race.patch deleted file mode 100644 index 3b7e084..0000000 --- a/pthread-mutex-lock-elision-race.patch +++ /dev/null @@ -1,717 +0,0 @@ -2018-10-17 Stefan Liebler - - [BZ #23275] - * nptl/tst-mutex10.c: New File. - * nptl/Makefile (tests): Add tst-mutex10. - (tst-mutex10-ENV): New variable. - * sysdeps/unix/sysv/linux/s390/force-elision.h: (FORCE_ELISION): - Ensure that elision path is used if elision is available. - * sysdeps/unix/sysv/linux/powerpc/force-elision.h (FORCE_ELISION): - Likewise. - * sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION): - Likewise. - * nptl/pthreadP.h (PTHREAD_MUTEX_TYPE, PTHREAD_MUTEX_TYPE_ELISION) - (PTHREAD_MUTEX_PSHARED): Use atomic_load_relaxed. - * nptl/pthread_mutex_consistent.c (pthread_mutex_consistent): Likewise. - * nptl/pthread_mutex_getprioceiling.c (pthread_mutex_getprioceiling): - Likewise. - * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full) - (__pthread_mutex_cond_lock_adjust): Likewise. - * nptl/pthread_mutex_setprioceiling.c (pthread_mutex_setprioceiling): - Likewise. - * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock): Likewise. - * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Likewise. - * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Likewise. - * sysdeps/nptl/bits/thread-shared-types.h (struct __pthread_mutex_s): - Add comments. - * nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy): - Use atomic_load_relaxed and atomic_store_relaxed. - * nptl/pthread_mutex_init.c (__pthread_mutex_init): - Use atomic_store_relaxed. - -Index: glibc-2.28/nptl/Makefile -=================================================================== ---- glibc-2.28.orig/nptl/Makefile -+++ glibc-2.28/nptl/Makefile -@@ -241,9 +241,9 @@ LDLIBS-tst-minstack-throw = -lstdc++ - - tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ - tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \ -- tst-mutex7 tst-mutex9 tst-mutex5a tst-mutex7a tst-mutex7robust \ -- tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \ -- tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ -+ tst-mutex7 tst-mutex9 tst-mutex10 tst-mutex5a tst-mutex7a \ -+ tst-mutex7robust tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 \ -+ tst-mutexpi5 tst-mutexpi5a tst-mutexpi6 tst-mutexpi7 tst-mutexpi7a \ - tst-mutexpi9 \ - tst-spin1 tst-spin2 tst-spin3 tst-spin4 \ - tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 tst-cond7 \ -@@ -709,6 +709,8 @@ endif - - $(objpfx)tst-compat-forwarder: $(objpfx)tst-compat-forwarder-mod.so - -+tst-mutex10-ENV = GLIBC_TUNABLES=glibc.elision.enable=1 -+ - # The tests here better do not run in parallel - ifneq ($(filter %tests,$(MAKECMDGOALS)),) - .NOTPARALLEL: -Index: glibc-2.28/nptl/pthreadP.h -=================================================================== ---- glibc-2.28.orig/nptl/pthreadP.h -+++ glibc-2.28/nptl/pthreadP.h -@@ -110,19 +110,23 @@ enum - }; - #define PTHREAD_MUTEX_PSHARED_BIT 128 - -+/* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ - #define PTHREAD_MUTEX_TYPE(m) \ -- ((m)->__data.__kind & 127) -+ (atomic_load_relaxed (&((m)->__data.__kind)) & 127) - /* Don't include NO_ELISION, as that type is always the same - as the underlying lock type. */ - #define PTHREAD_MUTEX_TYPE_ELISION(m) \ -- ((m)->__data.__kind & (127|PTHREAD_MUTEX_ELISION_NP)) -+ (atomic_load_relaxed (&((m)->__data.__kind)) \ -+ & (127 | PTHREAD_MUTEX_ELISION_NP)) - - #if LLL_PRIVATE == 0 && LLL_SHARED == 128 - # define PTHREAD_MUTEX_PSHARED(m) \ -- ((m)->__data.__kind & 128) -+ (atomic_load_relaxed (&((m)->__data.__kind)) & 128) - #else - # define PTHREAD_MUTEX_PSHARED(m) \ -- (((m)->__data.__kind & 128) ? LLL_SHARED : LLL_PRIVATE) -+ ((atomic_load_relaxed (&((m)->__data.__kind)) & 128) \ -+ ? LLL_SHARED : LLL_PRIVATE) - #endif - - /* The kernel when waking robust mutexes on exit never uses -Index: glibc-2.28/nptl/pthread_mutex_consistent.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_consistent.c -+++ glibc-2.28/nptl/pthread_mutex_consistent.c -@@ -23,8 +23,11 @@ - int - pthread_mutex_consistent (pthread_mutex_t *mutex) - { -- /* Test whether this is a robust mutex with a dead owner. */ -- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 -+ /* Test whether this is a robust mutex with a dead owner. -+ See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if ((atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 - || mutex->__data.__owner != PTHREAD_MUTEX_INCONSISTENT) - return EINVAL; - -Index: glibc-2.28/nptl/pthread_mutex_destroy.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_destroy.c -+++ glibc-2.28/nptl/pthread_mutex_destroy.c -@@ -27,12 +27,17 @@ __pthread_mutex_destroy (pthread_mutex_t - { - LIBC_PROBE (mutex_destroy, 1, mutex); - -- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if ((atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0 - && mutex->__data.__nusers != 0) - return EBUSY; - -- /* Set to an invalid value. */ -- mutex->__data.__kind = -1; -+ /* Set to an invalid value. Relaxed MO is enough as it is undefined behavior -+ if the mutex is used after it has been destroyed. But you can reinitialize -+ it with pthread_mutex_init. */ -+ atomic_store_relaxed (&(mutex->__data.__kind), -1); - - return 0; - } -Index: glibc-2.28/nptl/pthread_mutex_getprioceiling.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_getprioceiling.c -+++ glibc-2.28/nptl/pthread_mutex_getprioceiling.c -@@ -24,7 +24,9 @@ - int - pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling) - { -- if (__builtin_expect ((mutex->__data.__kind -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if (__builtin_expect ((atomic_load_relaxed (&(mutex->__data.__kind)) - & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0, 0)) - return EINVAL; - -Index: glibc-2.28/nptl/pthread_mutex_init.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_init.c -+++ glibc-2.28/nptl/pthread_mutex_init.c -@@ -101,7 +101,7 @@ __pthread_mutex_init (pthread_mutex_t *m - memset (mutex, '\0', __SIZEOF_PTHREAD_MUTEX_T); - - /* Copy the values from the attribute. */ -- mutex->__data.__kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS; -+ int mutex_kind = imutexattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS; - - if ((imutexattr->mutexkind & PTHREAD_MUTEXATTR_FLAG_ROBUST) != 0) - { -@@ -111,17 +111,17 @@ __pthread_mutex_init (pthread_mutex_t *m - return ENOTSUP; - #endif - -- mutex->__data.__kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ mutex_kind |= PTHREAD_MUTEX_ROBUST_NORMAL_NP; - } - - switch (imutexattr->mutexkind & PTHREAD_MUTEXATTR_PROTOCOL_MASK) - { - case PTHREAD_PRIO_INHERIT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: -- mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_INHERIT_NP; -+ mutex_kind |= PTHREAD_MUTEX_PRIO_INHERIT_NP; - break; - - case PTHREAD_PRIO_PROTECT << PTHREAD_MUTEXATTR_PROTOCOL_SHIFT: -- mutex->__data.__kind |= PTHREAD_MUTEX_PRIO_PROTECT_NP; -+ mutex_kind |= PTHREAD_MUTEX_PRIO_PROTECT_NP; - - int ceiling = (imutexattr->mutexkind - & PTHREAD_MUTEXATTR_PRIO_CEILING_MASK) -@@ -145,7 +145,11 @@ __pthread_mutex_init (pthread_mutex_t *m - FUTEX_PRIVATE_FLAG FUTEX_WAKE. */ - if ((imutexattr->mutexkind & (PTHREAD_MUTEXATTR_FLAG_PSHARED - | PTHREAD_MUTEXATTR_FLAG_ROBUST)) != 0) -- mutex->__data.__kind |= PTHREAD_MUTEX_PSHARED_BIT; -+ mutex_kind |= PTHREAD_MUTEX_PSHARED_BIT; -+ -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ atomic_store_relaxed (&(mutex->__data.__kind), mutex_kind); - - /* Default values: mutex not used yet. */ - // mutex->__count = 0; already done by memset -Index: glibc-2.28/nptl/pthread_mutex_lock.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_lock.c -+++ glibc-2.28/nptl/pthread_mutex_lock.c -@@ -62,6 +62,8 @@ static int __pthread_mutex_lock_full (pt - int - __pthread_mutex_lock (pthread_mutex_t *mutex) - { -+ /* See concurrency notes regarding mutex type which is loaded from __kind -+ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ - unsigned int type = PTHREAD_MUTEX_TYPE_ELISION (mutex); - - LIBC_PROBE (mutex_entry, 1, mutex); -@@ -350,8 +352,14 @@ __pthread_mutex_lock_full (pthread_mutex - case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: - case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ int kind, robust; -+ { -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); -+ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ } - - if (robust) - { -@@ -502,7 +510,10 @@ __pthread_mutex_lock_full (pthread_mutex - case PTHREAD_MUTEX_PP_NORMAL_NP: - case PTHREAD_MUTEX_PP_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_KIND_MASK_NP; - - oldval = mutex->__data.__lock; - -@@ -607,15 +618,18 @@ hidden_def (__pthread_mutex_lock) - void - __pthread_mutex_cond_lock_adjust (pthread_mutex_t *mutex) - { -- assert ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_INHERIT_NP) != 0); -- assert ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0); -- assert ((mutex->__data.__kind & PTHREAD_MUTEX_PSHARED_BIT) == 0); -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); -+ assert ((mutex_kind & PTHREAD_MUTEX_PRIO_INHERIT_NP) != 0); -+ assert ((mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0); -+ assert ((mutex_kind & PTHREAD_MUTEX_PSHARED_BIT) == 0); - - /* Record the ownership. */ - pid_t id = THREAD_GETMEM (THREAD_SELF, tid); - mutex->__data.__owner = id; - -- if (mutex->__data.__kind == PTHREAD_MUTEX_PI_RECURSIVE_NP) -+ if (mutex_kind == PTHREAD_MUTEX_PI_RECURSIVE_NP) - ++mutex->__data.__count; - } - #endif -Index: glibc-2.28/nptl/pthread_mutex_setprioceiling.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_setprioceiling.c -+++ glibc-2.28/nptl/pthread_mutex_setprioceiling.c -@@ -27,9 +27,10 @@ int - pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling, - int *old_ceiling) - { -- /* The low bits of __kind aren't ever changed after pthread_mutex_init, -- so we don't need a lock yet. */ -- if ((mutex->__data.__kind & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0) -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if ((atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_PRIO_PROTECT_NP) == 0) - return EINVAL; - - /* See __init_sched_fifo_prio. */ -Index: glibc-2.28/nptl/pthread_mutex_timedlock.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_timedlock.c -+++ glibc-2.28/nptl/pthread_mutex_timedlock.c -@@ -53,6 +53,8 @@ __pthread_mutex_timedlock (pthread_mutex - /* We must not check ABSTIME here. If the thread does not block - abstime must not be checked for a valid value. */ - -+ /* See concurrency notes regarding mutex type which is loaded from __kind -+ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ - switch (__builtin_expect (PTHREAD_MUTEX_TYPE_ELISION (mutex), - PTHREAD_MUTEX_TIMED_NP)) - { -@@ -338,8 +340,14 @@ __pthread_mutex_timedlock (pthread_mutex - case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: - case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ int kind, robust; -+ { -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); -+ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ } - - if (robust) - { -@@ -509,7 +517,10 @@ __pthread_mutex_timedlock (pthread_mutex - case PTHREAD_MUTEX_PP_NORMAL_NP: - case PTHREAD_MUTEX_PP_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_KIND_MASK_NP; - - oldval = mutex->__data.__lock; - -Index: glibc-2.28/nptl/pthread_mutex_trylock.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_trylock.c -+++ glibc-2.28/nptl/pthread_mutex_trylock.c -@@ -36,6 +36,8 @@ __pthread_mutex_trylock (pthread_mutex_t - int oldval; - pid_t id = THREAD_GETMEM (THREAD_SELF, tid); - -+ /* See concurrency notes regarding mutex type which is loaded from __kind -+ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ - switch (__builtin_expect (PTHREAD_MUTEX_TYPE_ELISION (mutex), - PTHREAD_MUTEX_TIMED_NP)) - { -@@ -199,8 +201,14 @@ __pthread_mutex_trylock (pthread_mutex_t - case PTHREAD_MUTEX_PI_ROBUST_NORMAL_NP: - case PTHREAD_MUTEX_PI_ROBUST_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ int kind, robust; -+ { -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int mutex_kind = atomic_load_relaxed (&(mutex->__data.__kind)); -+ kind = mutex_kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ robust = mutex_kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ } - - if (robust) - /* Note: robust PI futexes are signaled by setting bit 0. */ -@@ -325,7 +333,10 @@ __pthread_mutex_trylock (pthread_mutex_t - case PTHREAD_MUTEX_PP_NORMAL_NP: - case PTHREAD_MUTEX_PP_ADAPTIVE_NP: - { -- int kind = mutex->__data.__kind & PTHREAD_MUTEX_KIND_MASK_NP; -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int kind = atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_KIND_MASK_NP; - - oldval = mutex->__data.__lock; - -Index: glibc-2.28/nptl/pthread_mutex_unlock.c -=================================================================== ---- glibc-2.28.orig/nptl/pthread_mutex_unlock.c -+++ glibc-2.28/nptl/pthread_mutex_unlock.c -@@ -35,6 +35,8 @@ int - attribute_hidden - __pthread_mutex_unlock_usercnt (pthread_mutex_t *mutex, int decr) - { -+ /* See concurrency notes regarding mutex type which is loaded from __kind -+ in struct __pthread_mutex_s in sysdeps/nptl/bits/thread-shared-types.h. */ - int type = PTHREAD_MUTEX_TYPE_ELISION (mutex); - if (__builtin_expect (type & - ~(PTHREAD_MUTEX_KIND_MASK_NP|PTHREAD_MUTEX_ELISION_FLAGS_NP), 0)) -@@ -222,13 +224,19 @@ __pthread_mutex_unlock_full (pthread_mut - /* If the previous owner died and the caller did not succeed in - making the state consistent, mark the mutex as unrecoverable - and make all waiters. */ -- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0 -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if ((atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0 - && __builtin_expect (mutex->__data.__owner - == PTHREAD_MUTEX_INCONSISTENT, 0)) - pi_notrecoverable: - newowner = PTHREAD_MUTEX_NOTRECOVERABLE; - -- if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0) -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ if ((atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_ROBUST_NORMAL_NP) != 0) - { - continue_pi_robust: - /* Remove mutex from the list. -@@ -251,7 +259,10 @@ __pthread_mutex_unlock_full (pthread_mut - /* Unlock. Load all necessary mutex data before releasing the mutex - to not violate the mutex destruction requirements (see - lll_unlock). */ -- int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP; -+ /* See concurrency notes regarding __kind in struct __pthread_mutex_s -+ in sysdeps/nptl/bits/thread-shared-types.h. */ -+ int robust = atomic_load_relaxed (&(mutex->__data.__kind)) -+ & PTHREAD_MUTEX_ROBUST_NORMAL_NP; - private = (robust - ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex) - : PTHREAD_MUTEX_PSHARED (mutex)); -Index: glibc-2.28/nptl/tst-mutex10.c -=================================================================== ---- /dev/null -+++ glibc-2.28/nptl/tst-mutex10.c -@@ -0,0 +1,109 @@ -+/* Testing race while enabling lock elision. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static pthread_barrier_t barrier; -+static pthread_mutex_t mutex; -+static long long int iteration_count = 1000000; -+static unsigned int thread_count = 3; -+ -+static void * -+thr_func (void *arg) -+{ -+ long long int i; -+ for (i = 0; i < iteration_count; i++) -+ { -+ if ((uintptr_t) arg == 0) -+ { -+ xpthread_mutex_destroy (&mutex); -+ xpthread_mutex_init (&mutex, NULL); -+ } -+ -+ xpthread_barrier_wait (&barrier); -+ -+ /* Test if enabling lock elision works if it is enabled concurrently. -+ There was a race in FORCE_ELISION macro which leads to either -+ pthread_mutex_destroy returning EBUSY as the owner was recorded -+ by pthread_mutex_lock - in "normal mutex" code path - but was not -+ resetted in pthread_mutex_unlock - in "elision" code path. -+ Or it leads to the assertion in nptl/pthread_mutex_lock.c: -+ assert (mutex->__data.__owner == 0); -+ Please ensure that the test is run with lock elision: -+ export GLIBC_TUNABLES=glibc.elision.enable=1 */ -+ xpthread_mutex_lock (&mutex); -+ xpthread_mutex_unlock (&mutex); -+ -+ xpthread_barrier_wait (&barrier); -+ } -+ return NULL; -+} -+ -+static int -+do_test (void) -+{ -+ unsigned int i; -+ printf ("Starting %d threads to run %lld iterations.\n", -+ thread_count, iteration_count); -+ -+ pthread_t *threads = xmalloc (thread_count * sizeof (pthread_t)); -+ xpthread_barrier_init (&barrier, NULL, thread_count); -+ xpthread_mutex_init (&mutex, NULL); -+ -+ for (i = 0; i < thread_count; i++) -+ threads[i] = xpthread_create (NULL, thr_func, (void *) (uintptr_t) i); -+ -+ for (i = 0; i < thread_count; i++) -+ xpthread_join (threads[i]); -+ -+ xpthread_barrier_destroy (&barrier); -+ free (threads); -+ -+ return EXIT_SUCCESS; -+} -+ -+#define OPT_ITERATIONS 10000 -+#define OPT_THREADS 10001 -+#define CMDLINE_OPTIONS \ -+ { "iterations", required_argument, NULL, OPT_ITERATIONS }, \ -+ { "threads", required_argument, NULL, OPT_THREADS }, -+static void -+cmdline_process (int c) -+{ -+ long long int arg = strtoll (optarg, NULL, 0); -+ switch (c) -+ { -+ case OPT_ITERATIONS: -+ if (arg > 0) -+ iteration_count = arg; -+ break; -+ case OPT_THREADS: -+ if (arg > 0 && arg < 100) -+ thread_count = arg; -+ break; -+ } -+} -+#define CMDLINE_PROCESS cmdline_process -+#define TIMEOUT 50 -+#include -Index: glibc-2.28/sysdeps/nptl/bits/thread-shared-types.h -=================================================================== ---- glibc-2.28.orig/sysdeps/nptl/bits/thread-shared-types.h -+++ glibc-2.28/sysdeps/nptl/bits/thread-shared-types.h -@@ -124,7 +124,27 @@ struct __pthread_mutex_s - unsigned int __nusers; - #endif - /* KIND must stay at this position in the structure to maintain -- binary compatibility with static initializers. */ -+ binary compatibility with static initializers. -+ -+ Concurrency notes: -+ The __kind of a mutex is initialized either by the static -+ PTHREAD_MUTEX_INITIALIZER or by a call to pthread_mutex_init. -+ -+ After a mutex has been initialized, the __kind of a mutex is usually not -+ changed. BUT it can be set to -1 in pthread_mutex_destroy or elision can -+ be enabled. This is done concurrently in the pthread_mutex_*lock functions -+ by using the macro FORCE_ELISION. This macro is only defined for -+ architectures which supports lock elision. -+ -+ For elision, there are the flags PTHREAD_MUTEX_ELISION_NP and -+ PTHREAD_MUTEX_NO_ELISION_NP which can be set in addition to the already set -+ type of a mutex. -+ Before a mutex is initialized, only PTHREAD_MUTEX_NO_ELISION_NP can be set -+ with pthread_mutexattr_settype. -+ After a mutex has been initialized, the functions pthread_mutex_*lock can -+ enable elision - if the mutex-type and the machine supports it - by setting -+ the flag PTHREAD_MUTEX_ELISION_NP. This is done concurrently. Afterwards -+ the lock / unlock functions are using specific elision code-paths. */ - int __kind; - __PTHREAD_COMPAT_PADDING_MID - #if __PTHREAD_MUTEX_NUSERS_AFTER_KIND -Index: glibc-2.28/sysdeps/unix/sysv/linux/powerpc/force-elision.h -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/powerpc/force-elision.h -+++ glibc-2.28/sysdeps/unix/sysv/linux/powerpc/force-elision.h -@@ -18,9 +18,45 @@ - - /* Automatically enable elision for existing user lock kinds. */ - #define FORCE_ELISION(m, s) \ -- if (__pthread_force_elision \ -- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ if (__pthread_force_elision) \ - { \ -- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ -- s; \ -+ /* See concurrency notes regarding __kind in \ -+ struct __pthread_mutex_s in \ -+ sysdeps/nptl/bits/thread-shared-types.h. \ -+ \ -+ There are the following cases for the kind of a mutex \ -+ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ -+ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ -+ only one of both flags can be set): \ -+ - both flags are not set: \ -+ This is the first lock operation for this mutex. Enable \ -+ elision as it is not enabled so far. \ -+ Note: It can happen that multiple threads are calling e.g. \ -+ pthread_mutex_lock at the same time as the first lock \ -+ operation for this mutex. Then elision is enabled for this \ -+ mutex by multiple threads. Storing with relaxed MO is enough \ -+ as all threads will store the same new value for the kind of \ -+ the mutex. But we have to ensure that we always use the \ -+ elision path regardless if this thread has enabled elision or \ -+ another one. \ -+ \ -+ - PTHREAD_MUTEX_ELISION_NP flag is set: \ -+ Elision was already enabled for this mutex by a previous lock \ -+ operation. See case above. Just use the elision path. \ -+ \ -+ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ -+ Elision was explicitly disabled by pthread_mutexattr_settype. \ -+ Do not use the elision path. \ -+ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ -+ changed after mutex initialization. */ \ -+ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ { \ -+ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ -+ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ -+ } \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ -+ { \ -+ s; \ -+ } \ - } -Index: glibc-2.28/sysdeps/unix/sysv/linux/s390/force-elision.h -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/s390/force-elision.h -+++ glibc-2.28/sysdeps/unix/sysv/linux/s390/force-elision.h -@@ -18,9 +18,45 @@ - - /* Automatically enable elision for existing user lock kinds. */ - #define FORCE_ELISION(m, s) \ -- if (__pthread_force_elision \ -- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ if (__pthread_force_elision) \ - { \ -- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ -- s; \ -+ /* See concurrency notes regarding __kind in \ -+ struct __pthread_mutex_s in \ -+ sysdeps/nptl/bits/thread-shared-types.h. \ -+ \ -+ There are the following cases for the kind of a mutex \ -+ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ -+ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ -+ only one of both flags can be set): \ -+ - both flags are not set: \ -+ This is the first lock operation for this mutex. Enable \ -+ elision as it is not enabled so far. \ -+ Note: It can happen that multiple threads are calling e.g. \ -+ pthread_mutex_lock at the same time as the first lock \ -+ operation for this mutex. Then elision is enabled for this \ -+ mutex by multiple threads. Storing with relaxed MO is enough \ -+ as all threads will store the same new value for the kind of \ -+ the mutex. But we have to ensure that we always use the \ -+ elision path regardless if this thread has enabled elision or \ -+ another one. \ -+ \ -+ - PTHREAD_MUTEX_ELISION_NP flag is set: \ -+ Elision was already enabled for this mutex by a previous lock \ -+ operation. See case above. Just use the elision path. \ -+ \ -+ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ -+ Elision was explicitly disabled by pthread_mutexattr_settype. \ -+ Do not use the elision path. \ -+ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ -+ changed after mutex initialization. */ \ -+ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ { \ -+ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ -+ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ -+ } \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ -+ { \ -+ s; \ -+ } \ - } -Index: glibc-2.28/sysdeps/unix/sysv/linux/x86/force-elision.h -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/x86/force-elision.h -+++ glibc-2.28/sysdeps/unix/sysv/linux/x86/force-elision.h -@@ -18,9 +18,45 @@ - - /* Automatically enable elision for existing user lock kinds. */ - #define FORCE_ELISION(m, s) \ -- if (__pthread_force_elision \ -- && (m->__data.__kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ if (__pthread_force_elision) \ - { \ -- mutex->__data.__kind |= PTHREAD_MUTEX_ELISION_NP; \ -- s; \ -+ /* See concurrency notes regarding __kind in \ -+ struct __pthread_mutex_s in \ -+ sysdeps/nptl/bits/thread-shared-types.h. \ -+ \ -+ There are the following cases for the kind of a mutex \ -+ (The mask PTHREAD_MUTEX_ELISION_FLAGS_NP covers the flags \ -+ PTHREAD_MUTEX_ELISION_NP and PTHREAD_MUTEX_NO_ELISION_NP where \ -+ only one of both flags can be set): \ -+ - both flags are not set: \ -+ This is the first lock operation for this mutex. Enable \ -+ elision as it is not enabled so far. \ -+ Note: It can happen that multiple threads are calling e.g. \ -+ pthread_mutex_lock at the same time as the first lock \ -+ operation for this mutex. Then elision is enabled for this \ -+ mutex by multiple threads. Storing with relaxed MO is enough \ -+ as all threads will store the same new value for the kind of \ -+ the mutex. But we have to ensure that we always use the \ -+ elision path regardless if this thread has enabled elision or \ -+ another one. \ -+ \ -+ - PTHREAD_MUTEX_ELISION_NP flag is set: \ -+ Elision was already enabled for this mutex by a previous lock \ -+ operation. See case above. Just use the elision path. \ -+ \ -+ - PTHREAD_MUTEX_NO_ELISION_NP flag is set: \ -+ Elision was explicitly disabled by pthread_mutexattr_settype. \ -+ Do not use the elision path. \ -+ Note: The flag PTHREAD_MUTEX_NO_ELISION_NP will never be \ -+ changed after mutex initialization. */ \ -+ int mutex_kind = atomic_load_relaxed (&((m)->__data.__kind)); \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_FLAGS_NP) == 0) \ -+ { \ -+ mutex_kind |= PTHREAD_MUTEX_ELISION_NP; \ -+ atomic_store_relaxed (&((m)->__data.__kind), mutex_kind); \ -+ } \ -+ if ((mutex_kind & PTHREAD_MUTEX_ELISION_NP) != 0) \ -+ { \ -+ s; \ -+ } \ - } diff --git a/regex-uninit-memory-access.patch b/regex-uninit-memory-access.patch deleted file mode 100644 index b3ea683..0000000 --- a/regex-uninit-memory-access.patch +++ /dev/null @@ -1,261 +0,0 @@ -2018-08-28 Florian Weimer - - [BZ #23578] - * posix/tst-regcomp-truncated.c: New file. - * posix/Makefile (tests): Add it. - (tst-regcomp-truncated.out): Depend on generated locales. - -2018-08-25 Paul Eggert - - [BZ #23578] - regex: fix uninitialized memory access - I introduced this bug into gnulib in commit - 8335a4d6c7b4448cd0bcb6d0bebf1d456bcfdb17 dated 2006-04-10; - eventually it was merged into glibc. The bug was found by - project-repo and reported here: - https://lists.gnu.org/r/sed-devel/2018-08/msg00017.html - Diagnosis and draft fix reported by Assaf Gordon here: - https://lists.gnu.org/r/bug-gnulib/2018-08/msg00071.html - https://lists.gnu.org/r/bug-gnulib/2018-08/msg00142.html - * posix/regex_internal.c (build_wcs_upper_buffer): - Fix bug when mbrtowc returns 0. - -Index: glibc-2.28/posix/Makefile -=================================================================== ---- glibc-2.28.orig/posix/Makefile -+++ glibc-2.28/posix/Makefile -@@ -96,7 +96,7 @@ tests := test-errno tstgetopt testfnm r - tst-posix_fadvise tst-posix_fadvise64 \ - tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \ - tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \ -- bug-regex38 -+ bug-regex38 tst-regcomp-truncated - tests-internal := bug-regex5 bug-regex20 bug-regex33 \ - tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3 \ - tst-glob_lstat_compat tst-spawn4-compat -@@ -194,6 +194,7 @@ $(objpfx)tst-regex2.out: $(gen-locales) - $(objpfx)tst-regexloc.out: $(gen-locales) - $(objpfx)tst-rxspencer.out: $(gen-locales) - $(objpfx)tst-rxspencer-no-utf8.out: $(gen-locales) -+$(objpfx)tst-regcomp-truncated.out: $(gen-locales) - endif - - # If we will use the generic uname implementation, we must figure out what -Index: glibc-2.28/posix/regex_internal.c -=================================================================== ---- glibc-2.28.orig/posix/regex_internal.c -+++ glibc-2.28/posix/regex_internal.c -@@ -317,7 +317,7 @@ build_wcs_upper_buffer (re_string_t *pst - mbclen = __mbrtowc (&wc, - ((const char *) pstr->raw_mbs + pstr->raw_mbs_idx - + byte_idx), remain_len, &pstr->cur_state); -- if (BE (mbclen < (size_t) -2, 1)) -+ if (BE (0 < mbclen && mbclen < (size_t) -2, 1)) - { - wchar_t wcu = __towupper (wc); - if (wcu != wc) -@@ -386,7 +386,7 @@ build_wcs_upper_buffer (re_string_t *pst - else - p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + src_idx; - mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state); -- if (BE (mbclen < (size_t) -2, 1)) -+ if (BE (0 < mbclen && mbclen < (size_t) -2, 1)) - { - wchar_t wcu = __towupper (wc); - if (wcu != wc) -Index: glibc-2.28/posix/tst-regcomp-truncated.c -=================================================================== ---- /dev/null -+++ glibc-2.28/posix/tst-regcomp-truncated.c -@@ -0,0 +1,191 @@ -+/* Test compilation of truncated regular expressions. -+ Copyright (C) 2018 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 -+ . */ -+ -+/* This test constructs various patterns in an attempt to trigger -+ over-reading the regular expression compiler, such as bug -+ 23578. */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+/* Locales to test. */ -+static const char locales[][17] = -+ { -+ "C", -+ "en_US.UTF-8", -+ "de_DE.ISO-8859-1", -+ }; -+ -+/* Syntax options. Will be combined with other flags. */ -+static const reg_syntax_t syntaxes[] = -+ { -+ RE_SYNTAX_EMACS, -+ RE_SYNTAX_AWK, -+ RE_SYNTAX_GNU_AWK, -+ RE_SYNTAX_POSIX_AWK, -+ RE_SYNTAX_GREP, -+ RE_SYNTAX_EGREP, -+ RE_SYNTAX_POSIX_EGREP, -+ RE_SYNTAX_POSIX_BASIC, -+ RE_SYNTAX_POSIX_EXTENDED, -+ RE_SYNTAX_POSIX_MINIMAL_EXTENDED, -+ }; -+ -+/* Trailing characters placed after the initial character. */ -+static const char trailing_strings[][4] = -+ { -+ "", -+ "[", -+ "\\", -+ "[\\", -+ "(", -+ "(\\", -+ "\\(", -+ }; -+ -+static int -+do_test (void) -+{ -+ /* Staging buffer for the constructed regular expression. */ -+ char buffer[16]; -+ -+ /* Allocation used to detect over-reading by the regular expression -+ compiler. */ -+ struct support_next_to_fault ntf -+ = support_next_to_fault_allocate (sizeof (buffer)); -+ -+ /* Arbitrary Unicode codepoint at which we stop generating -+ characters. We do not probe the whole range because that would -+ take too long due to combinatorical exploision as the result of -+ combination with other flags. */ -+ static const wchar_t last_character = 0xfff; -+ -+ for (size_t locale_idx = 0; locale_idx < array_length (locales); -+ ++ locale_idx) -+ { -+ if (setlocale (LC_ALL, locales[locale_idx]) == NULL) -+ { -+ support_record_failure (); -+ printf ("error: setlocale (\"%s\"): %m", locales[locale_idx]); -+ continue; -+ } -+ if (test_verbose > 0) -+ printf ("info: testing locale \"%s\"\n", locales[locale_idx]); -+ -+ for (wchar_t wc = 0; wc <= last_character; ++wc) -+ { -+ char *after_wc; -+ if (wc == 0) -+ { -+ /* wcrtomb treats L'\0' in a special way. */ -+ *buffer = '\0'; -+ after_wc = &buffer[1]; -+ } -+ else -+ { -+ mbstate_t ps = { }; -+ size_t ret = wcrtomb (buffer, wc, &ps); -+ if (ret == (size_t) -1) -+ { -+ /* EILSEQ means that the target character set -+ cannot encode the character. */ -+ if (errno != EILSEQ) -+ { -+ support_record_failure (); -+ printf ("error: wcrtomb (0x%x) failed: %m\n", -+ (unsigned) wc); -+ } -+ continue; -+ } -+ TEST_VERIFY_EXIT (ret != 0); -+ after_wc = &buffer[ret]; -+ } -+ -+ for (size_t trailing_idx = 0; -+ trailing_idx < array_length (trailing_strings); -+ ++trailing_idx) -+ { -+ char *after_trailing -+ = stpcpy (after_wc, trailing_strings[trailing_idx]); -+ -+ for (int do_nul = 0; do_nul < 2; ++do_nul) -+ { -+ char *after_nul; -+ if (do_nul) -+ { -+ *after_trailing = '\0'; -+ after_nul = &after_trailing[1]; -+ } -+ else -+ after_nul = after_trailing; -+ -+ size_t length = after_nul - buffer; -+ -+ /* Make sure that the faulting region starts -+ after the used portion of the buffer. */ -+ char *ntf_start = ntf.buffer + sizeof (buffer) - length; -+ memcpy (ntf_start, buffer, length); -+ -+ for (const reg_syntax_t *psyntax = syntaxes; -+ psyntax < array_end (syntaxes); ++psyntax) -+ for (int do_icase = 0; do_icase < 2; ++do_icase) -+ { -+ re_syntax_options = *psyntax; -+ if (do_icase) -+ re_syntax_options |= RE_ICASE; -+ -+ regex_t reg; -+ memset (®, 0, sizeof (reg)); -+ const char *msg = re_compile_pattern -+ (ntf_start, length, ®); -+ if (msg != NULL) -+ { -+ if (test_verbose > 0) -+ { -+ char *quoted = support_quote_blob -+ (buffer, length); -+ printf ("info: compilation failed for pattern" -+ " \"%s\", syntax 0x%lx: %s\n", -+ quoted, re_syntax_options, msg); -+ free (quoted); -+ } -+ } -+ else -+ regfree (®); -+ } -+ } -+ } -+ } -+ } -+ -+ support_next_to_fault_free (&ntf); -+ -+ return 0; -+} -+ -+#include diff --git a/riscv-feholdexcept-setround.patch b/riscv-feholdexcept-setround.patch deleted file mode 100644 index 3dcc00d..0000000 --- a/riscv-feholdexcept-setround.patch +++ /dev/null @@ -1,19 +0,0 @@ -2018-08-03 DJ Delorie - - * sysdeps/riscv/rvf/math_private.h (libc_feholdexcept_setround_riscv): - Move libc_fesetround_riscv after libc_feholdexcept_riscv. - -Index: glibc-2.28/sysdeps/riscv/rvf/math_private.h -=================================================================== ---- glibc-2.28.orig/sysdeps/riscv/rvf/math_private.h -+++ glibc-2.28/sysdeps/riscv/rvf/math_private.h -@@ -72,8 +72,8 @@ libc_fesetround_riscv (int round) - static __always_inline void - libc_feholdexcept_setround_riscv (fenv_t *envp, int round) - { -- libc_fesetround_riscv (round); - libc_feholdexcept_riscv (envp); -+ libc_fesetround_riscv (round); - } - - #define libc_feholdexcept_setround libc_feholdexcept_setround_riscv diff --git a/riscv-flush-icache.patch b/riscv-flush-icache.patch deleted file mode 100644 index bbc876b..0000000 --- a/riscv-flush-icache.patch +++ /dev/null @@ -1,26 +0,0 @@ -2018-12-31 H.J. Lu - - [BZ #24022] - * sysdeps/unix/sysv/linux/riscv/flush-icache.c: Check if - exists with __has_include__ before including it. - -diff --git a/sysdeps/unix/sysv/linux/riscv/flush-icache.c b/sysdeps/unix/sysv/linux/riscv/flush-icache.c -index d612ef4c6c..0b2042620b 100644 ---- a/sysdeps/unix/sysv/linux/riscv/flush-icache.c -+++ b/sysdeps/unix/sysv/linux/riscv/flush-icache.c -@@ -21,7 +21,11 @@ - #include - #include - #include --#include -+#if __has_include__ () -+# include -+#else -+# include -+#endif - - typedef int (*func_type) (void *, void *, unsigned long int); - --- -2.20.1 - diff --git a/spawni-maybe-script-execute.patch b/spawni-maybe-script-execute.patch deleted file mode 100644 index 3a42ef2..0000000 --- a/spawni-maybe-script-execute.patch +++ /dev/null @@ -1,18 +0,0 @@ -2018-09-06 Stefan Liebler - - * sysdeps/unix/sysv/linux/spawni.c (maybe_script_execute): - Increment size of new_argv by one. - -Index: glibc-2.28/sysdeps/unix/sysv/linux/spawni.c -=================================================================== ---- glibc-2.28.orig/sysdeps/unix/sysv/linux/spawni.c -+++ glibc-2.28/sysdeps/unix/sysv/linux/spawni.c -@@ -101,7 +101,7 @@ maybe_script_execute (struct posix_spawn - ptrdiff_t argc = args->argc; - - /* Construct an argument list for the shell. */ -- char *new_argv[argc + 1]; -+ char *new_argv[argc + 2]; - new_argv[0] = (char *) _PATH_BSHELL; - new_argv[1] = (char *) args->file; - if (argc > 1) diff --git a/strstr-huge-needle.patch b/strstr-huge-needle.patch deleted file mode 100644 index c0876e3..0000000 --- a/strstr-huge-needle.patch +++ /dev/null @@ -1,95 +0,0 @@ -2018-09-19 Wilco Dijkstra - - [BZ #23637] - * string/test-strstr.c (pr23637): New function. - (test_main): Add tests with longer needles. - * string/strcasestr.c (AVAILABLE): Fix readahead distance. - * string/strstr.c (AVAILABLE): Likewise. - -Index: glibc-2.28/string/strcasestr.c -=================================================================== ---- glibc-2.28.orig/string/strcasestr.c -+++ glibc-2.28/string/strcasestr.c -@@ -37,8 +37,9 @@ - /* Two-Way algorithm. */ - #define RETURN_TYPE char * - #define AVAILABLE(h, h_l, j, n_l) \ -- (((j) + (n_l) <= (h_l)) || ((h_l) += __strnlen ((void*)((h) + (h_l)), 512), \ -- (j) + (n_l) <= (h_l))) -+ (((j) + (n_l) <= (h_l)) \ -+ || ((h_l) += __strnlen ((void*)((h) + (h_l)), (n_l) + 512), \ -+ (j) + (n_l) <= (h_l))) - #define CHECK_EOL (1) - #define RET0_IF_0(a) if (!a) goto ret0 - #define CANON_ELEMENT(c) TOLOWER (c) -Index: glibc-2.28/string/strstr.c -=================================================================== ---- glibc-2.28.orig/string/strstr.c -+++ glibc-2.28/string/strstr.c -@@ -33,8 +33,9 @@ - - #define RETURN_TYPE char * - #define AVAILABLE(h, h_l, j, n_l) \ -- (((j) + (n_l) <= (h_l)) || ((h_l) += __strnlen ((void*)((h) + (h_l)), 512), \ -- (j) + (n_l) <= (h_l))) -+ (((j) + (n_l) <= (h_l)) \ -+ || ((h_l) += __strnlen ((void*)((h) + (h_l)), (n_l) + 512), \ -+ (j) + (n_l) <= (h_l))) - #define CHECK_EOL (1) - #define RET0_IF_0(a) if (!a) goto ret0 - #define FASTSEARCH(S,C,N) (void*) strchr ((void*)(S), (C)) -Index: glibc-2.28/string/test-strstr.c -=================================================================== ---- glibc-2.28.orig/string/test-strstr.c -+++ glibc-2.28/string/test-strstr.c -@@ -151,6 +151,32 @@ check2 (void) - } - } - -+#define N 1024 -+ -+static void -+pr23637 (void) -+{ -+ char *h = (char*) buf1; -+ char *n = (char*) buf2; -+ -+ for (int i = 0; i < N; i++) -+ { -+ n[i] = 'x'; -+ h[i] = ' '; -+ h[i + N] = 'x'; -+ } -+ -+ n[N] = '\0'; -+ h[N * 2] = '\0'; -+ -+ /* Ensure we don't match at the first 'x'. */ -+ h[0] = 'x'; -+ -+ char *exp_result = stupid_strstr (h, n); -+ FOR_EACH_IMPL (impl, 0) -+ check_result (impl, h, n, exp_result); -+} -+ - static int - test_main (void) - { -@@ -158,6 +184,7 @@ test_main (void) - - check1 (); - check2 (); -+ pr23637 (); - - printf ("%23s", ""); - FOR_EACH_IMPL (impl, 0) -@@ -202,6 +229,9 @@ test_main (void) - do_test (15, 9, hlen, klen, 1); - do_test (15, 15, hlen, klen, 0); - do_test (15, 15, hlen, klen, 1); -+ -+ do_test (15, 15, hlen + klen * 4, klen * 4, 0); -+ do_test (15, 15, hlen + klen * 4, klen * 4, 1); - } - - do_test (0, 0, page_size - 1, 16, 0); diff --git a/unwind-ctor.patch b/unwind-ctor.patch deleted file mode 100644 index ac7a80f..0000000 --- a/unwind-ctor.patch +++ /dev/null @@ -1,131 +0,0 @@ -2018-09-26 Andreas Schwab - - [BZ #23707] - * sysdeps/powerpc/powerpc32/dl-start.S: Add unwind information. - * elf/Makefile (tests): Add tst-unwind-ctor. - (modules-names): Add tst-unwind-ctor-lib. - ($(objpfx)tst-unwind-ctor): Depend on - $(objpfx)tst-unwind-ctor-lib.so. - -Index: glibc-2.28/elf/Makefile -=================================================================== ---- glibc-2.28.orig/elf/Makefile -+++ glibc-2.28/elf/Makefile -@@ -186,7 +186,8 @@ tests += restest1 preloadtest loadfail m - tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \ - tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \ - tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \ -- tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note -+ tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \ -+ tst-unwind-ctor - # reldep9 - tests-internal += loadtest unload unload2 circleload1 \ - neededtest neededtest2 neededtest3 neededtest4 \ -@@ -273,7 +274,7 @@ modules-names = testobj1 testobj2 testob - tst-latepthreadmod $(tst-tls-many-dynamic-modules) \ - tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \ - tst-main1mod tst-libc_dlvsym-dso tst-absolute-sym-lib \ -- tst-absolute-zero-lib tst-big-note-lib -+ tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib - - ifeq (yes,$(have-mtls-dialect-gnu2)) - tests += tst-gnu2-tls1 -@@ -1484,3 +1485,5 @@ tst-libc_dlvsym-static-ENV = \ - $(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so - - $(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so -+ -+$(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so -Index: glibc-2.28/elf/tst-unwind-ctor-lib.c -=================================================================== ---- /dev/null -+++ glibc-2.28/elf/tst-unwind-ctor-lib.c -@@ -0,0 +1,42 @@ -+/* Unit test for _Unwind_Backtrace in a shared object constructor. -+ Copyright (C) 2018 Free Software Foundation, Inc. -+ This file is part of the GNU C Library. -+ -+ The GNU C Library is free software; you can redistribute it and/or -+ modify it under the terms of the GNU Lesser General Public -+ License as published by the Free Software Foundation; either -+ version 2.1 of the License, or (at your option) any later version. -+ -+ The GNU C Library is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ Lesser General Public License for more details. -+ -+ You should have received a copy of the GNU Lesser General Public -+ License along with the GNU C Library; if not, see -+ . */ -+ -+#include -+#include -+ -+static _Unwind_Reason_Code -+callback (struct _Unwind_Context *ctx, void *arg) -+{ -+ return _URC_NO_REASON; -+} -+ -+static void -+__attribute__ ((constructor)) -+do_unwind (void) -+{ -+ /* Arrange for this test to be killed if _Unwind_Backtrace runs into an -+ endless loop. We cannot use the test driver since the test needs to -+ run in a constructor. */ -+ alarm (20); -+ _Unwind_Backtrace (callback, 0); -+} -+ -+void -+dummy (void) -+{ -+} -Index: glibc-2.28/elf/tst-unwind-ctor.c -=================================================================== ---- /dev/null -+++ glibc-2.28/elf/tst-unwind-ctor.c -@@ -0,0 +1,27 @@ -+/* Unit test for _Unwind_Backtrace in a shared object constructor. -+ Copyright (C) 2018 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 -+ . */ -+ -+extern void dummy (void); -+ -+int -+main (void) -+{ -+ /* Just call a dummy function in the shared library. The actual test -+ runs in its constructor. */ -+ dummy (); -+} -Index: glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S -=================================================================== ---- glibc-2.28.orig/sysdeps/powerpc/powerpc32/dl-start.S -+++ glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S -@@ -34,6 +34,9 @@ ENTRY(_start) - _dl_start to save the link register). */ - li r4,0 - addi r1,r1,-16 -+ cfi_adjust_cfa_offset (16) -+/* Mark lr as undefined to stop unwinding. */ -+ cfi_undefined (lr) - stw r4,0(r1) - bl _dl_start@local - diff --git a/x86-haswell-string-flags.patch b/x86-haswell-string-flags.patch deleted file mode 100644 index cfa35a6..0000000 --- a/x86-haswell-string-flags.patch +++ /dev/null @@ -1,24 +0,0 @@ -2018-10-23 Adhemerval Zanella - - [BZ #23709] - * sysdeps/x86/cpu-features.c (init_cpu_features): Set TSX bits - independently of other flags. - -Index: glibc-2.28/sysdeps/x86/cpu-features.c -=================================================================== ---- glibc-2.28.orig/sysdeps/x86/cpu-features.c -+++ glibc-2.28/sysdeps/x86/cpu-features.c -@@ -316,7 +316,13 @@ init_cpu_features (struct cpu_features * - | bit_arch_Fast_Unaligned_Copy - | bit_arch_Prefer_PMINUB_for_stringop); - break; -+ } - -+ /* Disable TSX on some Haswell processors to avoid TSX on kernels that -+ weren't updated with the latest microcode package (which disables -+ broken feature by default). */ -+ switch (model) -+ { - case 0x3f: - /* Xeon E7 v3 with stepping >= 4 has working TSX. */ - if (stepping >= 4)