From c7b30c9b24a3feef881b03104c3b816c7b8ab6b4 Mon Sep 17 00:00:00 2001 From: maqi Date: Tue, 18 Jan 2022 16:18:43 +0800 Subject: [PATCH] update glibc-2.17-325.el7_9.src.rpm --- ...aders-with-the-define-EPOLLEXCLUSIVE.patch | 42 -- 10002-glibc-anolis-tcache.patch | 479 ------------------ glibc-rh1927536.patch | 109 ++++ glibc-rh1993930.patch | 251 +++++++++ glibc.spec | 126 ++++- 5 files changed, 473 insertions(+), 534 deletions(-) delete mode 100644 10001-glibc-anolis-update-headers-with-the-define-EPOLLEXCLUSIVE.patch delete mode 100644 10002-glibc-anolis-tcache.patch create mode 100644 glibc-rh1927536.patch create mode 100644 glibc-rh1993930.patch diff --git a/10001-glibc-anolis-update-headers-with-the-define-EPOLLEXCLUSIVE.patch b/10001-glibc-anolis-update-headers-with-the-define-EPOLLEXCLUSIVE.patch deleted file mode 100644 index f7d0500..0000000 --- a/10001-glibc-anolis-update-headers-with-the-define-EPOLLEXCLUSIVE.patch +++ /dev/null @@ -1,42 +0,0 @@ -From bc2f1d9fe282f49dc4e2e34f4e16e8f2550cbe5e Mon Sep 17 00:00:00 2001 -From: Chunmei Xu -Date: Wed, 15 Apr 2020 19:28:27 +0800 -Subject: [PATCH] update glibc headers with the define EPOLLEXCLUSIVE - -backport from https://github.com/bminor/glibc/commit/981569c74cbb6bafa2ddcefa6dd9dbdc938ff1c8?spm=a2o8d.corp_prod_issue_detail_v2.0.0.39f52ecf5LPs8j - -Signed-off-by: Chunmei Xu ---- - ChangeLog | 5 +++++ - sysdeps/unix/sysv/linux/sys/epoll.h | 2 ++ - 2 files changed, 7 insertions(+) - -diff --git a/ChangeLog b/ChangeLog -index 0f4f951..61a32c1 100644 ---- a/ChangeLog -+++ b/ChangeLog -@@ -1,3 +1,8 @@ -+2016-03-14 Joseph Myers -+ -+ * * sysdeps/unix/sysv/linux/sys/epoll.h (enum EPOLL_EVENTS): Add -+ EPOLLEXCLUSIVE. -+ - 2019-01-01 Joseph Myers - - * sysdeps/unix/sysv/linux/syscall-names.list: Update kernel -diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h -index 6c2f10a..67da9f7 100644 ---- a/sysdeps/unix/sysv/linux/sys/epoll.h -+++ b/sysdeps/unix/sysv/linux/sys/epoll.h -@@ -61,6 +61,8 @@ enum EPOLL_EVENTS - #define EPOLLHUP EPOLLHUP - EPOLLRDHUP = 0x2000, - #define EPOLLRDHUP EPOLLRDHUP -+ EPOLLEXCLUSIVE = 1u << 28, -+#define EPOLLEXCLUSIVE EPOLLEXCLUSIVE - EPOLLWAKEUP = 1u << 29, - #define EPOLLWAKEUP EPOLLWAKEUP - EPOLLONESHOT = 1u << 30, --- -1.8.3.1 - diff --git a/10002-glibc-anolis-tcache.patch b/10002-glibc-anolis-tcache.patch deleted file mode 100644 index 0b8176c..0000000 --- a/10002-glibc-anolis-tcache.patch +++ /dev/null @@ -1,479 +0,0 @@ -# TCache backport from glibc 2.26. -# * A per-thread cache has been added to malloc. Access to the cache requires -# no locks and therefore significantly accelerates the fast path to allocate -# and free small amounts of memory. Refilling an empty cache requires locking -# the underlying arena. Performance measurements show significant gains in a -# wide variety of user workloads. Workloads were captured using a special -# instrumented malloc and analyzed with a malloc simulator. Contributed by -# DJ Delorie with the help of Florian Weimer, and Carlos O'Donell. -#Commit ID: -# d5c3fafc: Add per-thread cache to malloc - ---- a/malloc/Makefile 2020-06-15 16:27:45.280396150 +0800 -+++ b/malloc/Makefile 2020-06-15 17:25:17.790755014 +0800 -@@ -169,6 +169,8 @@ - tst-mcheck-ENV = MALLOC_CHECK_=3 - tst-malloc-usable-ENV = MALLOC_CHECK_=3 - -+CPPFLAGS-malloc.c += -DUSE_TCACHE=1 -+ - # Uncomment this for test releases. For public releases it is too expensive. - #CPPFLAGS-malloc.o += -DMALLOC_DEBUG=1 - -diff -ru a/malloc/malloc.c b/malloc/malloc.c ---- a/malloc/malloc.c 2020-06-15 16:35:48.561998295 +0800 -+++ b/malloc/malloc.c 2020-06-15 16:37:06.044822440 +0800 -@@ -295,6 +295,31 @@ - } - #endif - -+#if USE_TCACHE -+/* We want 64 entries. This is an arbitrary limit, which tunables can reduce. */ -+# define TCACHE_MAX_BINS 64 -+# define MAX_TCACHE_SIZE tidx2usize (TCACHE_MAX_BINS-1) -+ -+/* Only used to pre-fill the tunables. */ -+# define tidx2usize(idx) (((size_t) idx) * MALLOC_ALIGNMENT + MINSIZE - SIZE_SZ) -+ -+/* When "x" is from chunksize(). */ -+# define csize2tidx(x) (((x) - MINSIZE + MALLOC_ALIGNMENT - 1) / MALLOC_ALIGNMENT) -+/* When "x" is a user-provided size. */ -+# define usize2tidx(x) csize2tidx (request2size (x)) -+ -+/* With rounding and alignment, the bins are... -+ idx 0 bytes 0..24 (64-bit) or 0..12 (32-bit) -+ idx 1 bytes 25..40 or 13..20 -+ idx 2 bytes 41..56 or 21..28 -+ etc. */ -+ -+/* This is another arbitrary limit, which tunables can change. Each -+ tcache bin will hold at most this number of chunks. */ -+# define TCACHE_FILL_COUNT 7 -+#endif -+ -+ - #include - - /* -@@ -1780,6 +1805,17 @@ - - /* First address handed out by MORECORE/sbrk. */ - char* sbrk_base; -+ -+ #if USE_TCACHE -+ /* Maximum number of buckets to use. */ -+ size_t tcache_bins; -+ size_t tcache_max_bytes; -+ /* Maximum number of chunks in each bucket. */ -+ size_t tcache_count; -+ /* Maximum number of chunks to remove from the unsorted list, which -+ aren't used to prefill the cache. */ -+ size_t tcache_unsorted_limit; -+ #endif - }; - - /* There are several instances of this struct ("arenas") in this -@@ -1805,6 +1841,13 @@ - .trim_threshold = DEFAULT_TRIM_THRESHOLD, - # define NARENAS_FROM_NCORES(n) ((n) * (sizeof(long) == 4 ? 2 : 8)) - .arena_test = NARENAS_FROM_NCORES (1) -+ #if USE_TCACHE -+ , -+ .tcache_count = TCACHE_FILL_COUNT, -+ .tcache_bins = TCACHE_MAX_BINS, -+ .tcache_max_bytes = tidx2usize (TCACHE_MAX_BINS-1), -+ .tcache_unsorted_limit = 0 /* No limit. */ -+ #endif - }; - - -@@ -2888,6 +2931,125 @@ - #endif /* HAVE_MREMAP */ - - /*------------------------ Public wrappers. --------------------------------*/ -+#if USE_TCACHE -+ -+/* We overlay this structure on the user-data portion of a chunk when -+ the chunk is stored in the per-thread cache. */ -+typedef struct tcache_entry -+{ -+ struct tcache_entry *next; -+} tcache_entry; -+ -+/* There is one of these for each thread, which contains the -+ per-thread cache (hence "tcache_perthread_struct"). Keeping -+ overall size low is mildly important. Note that COUNTS and ENTRIES -+ are redundant (we could have just counted the linked list each -+ time), this is for performance reasons. */ -+typedef struct tcache_perthread_struct -+{ -+ char counts[TCACHE_MAX_BINS]; -+ tcache_entry *entries[TCACHE_MAX_BINS]; -+} tcache_perthread_struct; -+ -+static __thread char tcache_shutting_down = 0; -+static __thread tcache_perthread_struct *tcache = NULL; -+ -+/* Caller must ensure that we know tc_idx is valid and there's room -+ for more chunks. */ -+static void -+tcache_put (mchunkptr chunk, size_t tc_idx) -+{ -+ tcache_entry *e = (tcache_entry *) chunk2mem (chunk); -+ assert (tc_idx < TCACHE_MAX_BINS); -+ e->next = tcache->entries[tc_idx]; -+ tcache->entries[tc_idx] = e; -+ ++(tcache->counts[tc_idx]); -+} -+ -+/* Caller must ensure that we know tc_idx is valid and there's -+ available chunks to remove. */ -+static void * -+tcache_get (size_t tc_idx) -+{ -+ tcache_entry *e = tcache->entries[tc_idx]; -+ assert (tc_idx < TCACHE_MAX_BINS); -+ if(tc_idx < TCACHE_MAX_BINS){ -+ assert (tcache->entries[tc_idx] > 0); -+ tcache->entries[tc_idx] = e->next; -+ tcache->counts[tc_idx]-=1; -+ } -+ return (void *) e; -+} -+ -+static void __attribute__ ((section ("__libc_thread_freeres_fn"))) -+tcache_thread_freeres (void) -+{ -+ int i; -+ tcache_perthread_struct *tcache_tmp = tcache; -+ -+ if (!tcache) -+ return; -+ -+ tcache = NULL; -+ -+ for (i = 0; i < TCACHE_MAX_BINS; ++i) -+ { -+ while (tcache_tmp->entries[i]) -+ { -+ tcache_entry *e = tcache_tmp->entries[i]; -+ tcache_tmp->entries[i] = e->next; -+ __libc_free (e); -+ } -+ } -+ -+ __libc_free (tcache_tmp); -+ -+ tcache_shutting_down = 1; -+} -+text_set_element (__libc_thread_subfreeres, tcache_thread_freeres); -+ -+static void -+tcache_init(void) -+{ -+ mstate ar_ptr; -+ void *victim = 0; -+ const size_t bytes = sizeof (tcache_perthread_struct); -+ -+ if (tcache_shutting_down) -+ return; -+ -+ arena_get (ar_ptr, bytes); -+ victim = _int_malloc (ar_ptr, bytes); -+ if (!victim && ar_ptr != NULL) -+ { -+ ar_ptr = arena_get_retry (ar_ptr, bytes); -+ victim = _int_malloc (ar_ptr, bytes); -+ } -+ -+ -+ if (ar_ptr != NULL) -+ __libc_lock_unlock (ar_ptr->mutex); -+ -+ /* In a low memory situation, we may not be able to allocate memory -+ - in which case, we just keep trying later. However, we -+ typically do this very early, so either there is sufficient -+ memory, or there isn't enough memory to do non-trivial -+ allocations anyway. */ -+ if (victim) -+ { -+ tcache = (tcache_perthread_struct *) victim; -+ memset (tcache, 0, sizeof (tcache_perthread_struct)); -+ } -+ -+} -+ -+#define MAYBE_INIT_TCACHE() \ -+ if (__glibc_unlikely (tcache == NULL)) \ -+ tcache_init(); -+ -+#else -+#define MAYBE_INIT_TCACHE() -+#endif - - void* - __libc_malloc(size_t bytes) -@@ -2899,7 +3061,25 @@ - = force_reg (__malloc_hook); - if (__builtin_expect (hook != NULL, 0)) - return (*hook)(bytes, RETURN_ADDRESS (0)); -- -+ -+#if USE_TCACHE -+ /* int_free also calls request2size, be careful to not pad twice. */ -+ size_t tbytes = request2size (bytes); -+ size_t tc_idx = csize2tidx (tbytes); -+ -+ MAYBE_INIT_TCACHE (); -+ -+ DIAG_PUSH_NEEDS_COMMENT; -+ if (tc_idx < mp_.tcache_bins -+ /*&& tc_idx < TCACHE_MAX_BINS*/ /* to appease gcc */ -+ && tcache -+ && tcache->entries[tc_idx] != NULL) -+ { -+ return tcache_get (tc_idx); -+ } -+ DIAG_POP_NEEDS_COMMENT; -+#endif -+ - arena_get(ar_ptr, bytes); - - victim = _int_malloc(ar_ptr, bytes); -@@ -3333,6 +3513,10 @@ - mchunkptr fwd; /* misc temp for linking */ - mchunkptr bck; /* misc temp for linking */ - -+#if USE_TCACHE -+ size_t tcache_unsorted_count; /* count of unsorted chunks processed */ -+#endif -+ - const char *errstr = NULL; - - /* -@@ -3361,6 +3545,16 @@ - This code is safe to execute even if av is not yet initialized, so we - can try it without checking, which saves some time on this fast path. - */ -+#define REMOVE_FB(fb, victim, pp) \ -+ do \ -+ { \ -+ victim = pp; \ -+ if (victim == NULL) \ -+ break; \ -+ } \ -+ while ((pp = catomic_compare_and_exchange_val_acq (fb, victim->fd, victim)) \ -+ != victim); \ -+ - - if ((unsigned long)(nb) <= (unsigned long)(get_max_fast ())) { - idx = fastbin_index(nb); -@@ -3385,6 +3579,26 @@ - return NULL; - } - check_remalloced_chunk(av, victim, nb); -+#if USE_TCACHE -+ /* While we're here, if we see other chunks of the same size, -+ stash them in the tcache. */ -+ size_t tc_idx = csize2tidx (nb); -+ if (tcache && tc_idx < mp_.tcache_bins) -+ { -+ mchunkptr tc_victim; -+ -+ /* While bin not empty and tcache not full, copy chunks over. */ -+ while (tcache->counts[tc_idx] < mp_.tcache_count -+ && (pp = *fb) != NULL) -+ { -+ REMOVE_FB (fb, tc_victim, pp); -+ if (tc_victim != 0) -+ { -+ tcache_put (tc_victim, tc_idx); -+ } -+ } -+ } -+#endif - void *p = chunk2mem(victim); - alloc_perturb (p, bytes); - return p; -@@ -3420,6 +3634,34 @@ - if (av != &main_arena) - victim->size |= NON_MAIN_ARENA; - check_malloced_chunk(av, victim, nb); -+ -+ #if USE_TCACHE -+ /* While we're here, if we see other chunks of the same size, -+ stash them in the tcache. */ -+ size_t tc_idx = csize2tidx (nb); -+ if (tcache && tc_idx < mp_.tcache_bins) -+ { -+ mchunkptr tc_victim; -+ -+ /* While bin not empty and tcache not full, copy chunks over. */ -+ while (tcache->counts[tc_idx] < mp_.tcache_count -+ && (tc_victim = last (bin)) != bin) -+ { -+ if (tc_victim != 0) -+ { -+ bck = tc_victim->bk; -+ set_inuse_bit_at_offset (tc_victim, nb); -+ if (av != &main_arena) -+ tc_victim->size |= NON_MAIN_ARENA; -+ bin->bk = bck; -+ bck->fd = bin; -+ -+ tcache_put (tc_victim, tc_idx); -+ } -+ } -+ } -+#endif -+ - void *p = chunk2mem(victim); - alloc_perturb (p, bytes); - return p; -@@ -3456,6 +3698,15 @@ - do so and retry. This happens at most once, and only when we would - otherwise need to expand memory to service a "small" request. - */ -+#if USE_TCACHE -+ INTERNAL_SIZE_T tcache_nb = 0; -+ size_t tc_idx = csize2tidx (nb); -+ if (tcache && tc_idx < mp_.tcache_bins) -+ tcache_nb = nb; -+ int return_cached = 0; -+ -+ tcache_unsorted_count = 0; -+#endif - - for(;;) { - -@@ -3517,11 +3768,31 @@ - if (size == nb) { - set_inuse_bit_at_offset(victim, size); - if (av != &main_arena) -- victim->size |= NON_MAIN_ARENA; -+ victim->size |= NON_MAIN_ARENA; //this might be changed into set_non_main_arena (victim); -+ -+#if USE_TCACHE -+ /* Fill cache first, return to user only if cache fills. -+ We may return one of these chunks later. */ -+ if (tcache_nb -+ && tcache->counts[tc_idx] < mp_.tcache_count) -+ { -+ tcache_put (victim, tc_idx); -+ return_cached = 1; -+ continue; -+ } -+ else -+ { -+#endif -+ - check_malloced_chunk(av, victim, nb); - void *p = chunk2mem(victim); - alloc_perturb (p, bytes); - return p; -+ -+ #if USE_TCACHE -+ } -+#endif -+ - } - - /* place chunk in bin */ -@@ -3579,11 +3850,31 @@ - victim->fd = fwd; - fwd->bk = victim; - bck->fd = victim; -+ -+#if USE_TCACHE -+ /* If we've processed as many chunks as we're allowed while -+ filling the cache, return one of the cached ones. */ -+ ++tcache_unsorted_count; -+ if (return_cached -+ && mp_.tcache_unsorted_limit > 0 -+ && tcache_unsorted_count > mp_.tcache_unsorted_limit) -+ { -+ return tcache_get (tc_idx); -+ } -+#endif - - #define MAX_ITERS 10000 - if (++iters >= MAX_ITERS) - break; - } -+ -+ #if USE_TCACHE -+ /* If all the small chunks we found ended up cached, return one now. */ -+ if (return_cached) -+ { -+ return tcache_get (tc_idx); -+ } -+#endif - - /* - If a large request, scan through the chunks of current bin in -@@ -3855,6 +4146,20 @@ - - check_inuse_chunk(av, p); - -+#if USE_TCACHE -+ { -+ size_t tc_idx = csize2tidx (size); -+ -+ if (tcache -+ && tc_idx < mp_.tcache_bins -+ && tcache->counts[tc_idx] < mp_.tcache_count) -+ { -+ tcache_put (p, tc_idx); -+ return; -+ } -+ } -+#endif -+ - /* - If eligible, place chunk on a fastbin so it can be found - and used quickly in malloc. -@@ -4797,6 +5102,44 @@ - } - (void)mutex_unlock(&av->mutex); - return res; -+ -+ //warning: this shoule be add here -+ //but since it wasn't even used in 2.26, I decide to omit -+ /* -+ #if USE_TCACHE -+static inline int -+__always_inline -+do_set_tcache_max (size_t value) -+{ -+ if (value >= 0 && value <= MAX_TCACHE_SIZE) -+ { -+ LIBC_PROBE (memory_tunable_tcache_max_bytes, 2, value, mp_.tcache_max_bytes); -+ mp_.tcache_max_bytes = value; -+ mp_.tcache_bins = csize2tidx (request2size(value)) + 1; -+ } -+ return 1; -+} -+ -+static inline int -+__always_inline -+do_set_tcache_count (size_t value) -+{ -+ LIBC_PROBE (memory_tunable_tcache_count, 2, value, mp_.tcache_count); -+ mp_.tcache_count = value; -+ return 1; -+} -+ -+static inline int -+__always_inline -+do_set_tcache_unsorted_limit (size_t value) -+{ -+ LIBC_PROBE (memory_tunable_tcache_unsorted_limit, 2, value, mp_.tcache_unsorted_limit); -+ mp_.tcache_unsorted_limit = value; -+ return 1; -+} -+#endif -+*/ -+ - } - libc_hidden_def (__libc_mallopt) - diff --git a/glibc-rh1927536.patch b/glibc-rh1927536.patch new file mode 100644 index 0000000..1be9e89 --- /dev/null +++ b/glibc-rh1927536.patch @@ -0,0 +1,109 @@ +Move __isnanl_pseudo to its own file in sysdeps/x86/isnanl-pseudo.c so +that it only links into libc.so. This way it is only available to +functions in libc and should not affect libm. + +diff --git a/include/math.h b/include/math.h +index 4eddc81be0dccad9..c42c8101dd8ebc88 100644 +--- a/include/math.h ++++ b/include/math.h +@@ -7,8 +7,7 @@ + extern int __matherr (struct exception *__exc); + + # if IS_IN (libc) +-extern int __isnanl_pseudo (long double); +-hidden_proto (__isnanl_pseudo) ++extern int __isnanl_pseudo (long double) attribute_hidden; + #endif + + # if IS_IN (libc) || IS_IN (libm) +diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c +index dc83d7a85fb3318b..816396d8fbc79dde 100644 +--- a/sysdeps/i386/fpu/s_isnanl.c ++++ b/sysdeps/i386/fpu/s_isnanl.c +@@ -41,23 +41,3 @@ int __isnanl(long double x) + } + hidden_def (__isnanl) + weak_alias (__isnanl, isnanl) +- +-#if IS_IN (libc) +-/* Exact backport from glibc-2.33, used only in printf_fp.c. */ +-int __isnanl_pseudo (long double x) +-{ +- int32_t se,hx,lx,pn; +- GET_LDOUBLE_WORDS(se,hx,lx,x); +- se = (se & 0x7fff) << 1; +- /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top +- bit of the significand is not set. */ +- pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31; +- /* Clear the significand bit when computing mantissa. */ +- lx |= hx & 0x7fffffff; +- se |= (uint32_t)(lx|(-lx))>>31; +- se = 0xfffe - se; +- +- return (int)(((uint32_t)(se)) >> 16) | pn; +-} +-hidden_def (__isnanl_pseudo) +-#endif +diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile +index f1da941dbbadadb3..d2f7b05db6ff6f72 100644 +--- a/sysdeps/x86/Makefile ++++ b/sysdeps/x86/Makefile +@@ -22,3 +22,7 @@ endif + ifeq ($(subdir),math) + tests += tst-ldbl-nonnormal-printf + endif # $(subdir) == math ++ ++ifeq ($(subdir),stdio-common) ++sysdep_routines += isnanl-pseudo ++endif +diff --git a/sysdeps/x86/isnanl-pseudo.c b/sysdeps/x86/isnanl-pseudo.c +new file mode 100644 +index 0000000000000000..95aba4672ba51a16 +--- /dev/null ++++ b/sysdeps/x86/isnanl-pseudo.c +@@ -0,0 +1,45 @@ ++/* s_isnanl.c -- long double version for i387 of s_isnan.c. ++ * Conversion to long double by Ulrich Drepper, ++ * Cygnus Support, drepper@cygnus.com. ++ */ ++ ++/* ++ * ==================================================== ++ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. ++ * ++ * Developed at SunPro, a Sun Microsystems, Inc. business. ++ * Permission to use, copy, modify, and distribute this ++ * software is freely granted, provided that this notice ++ * is preserved. ++ * ==================================================== ++ */ ++ ++#if defined(LIBM_SCCS) && !defined(lint) ++static char rcsid[] = "$NetBSD: $"; ++#endif ++ ++/* ++ * isnanl(x) returns 1 is x is nan, else 0; ++ * no branching! ++ */ ++ ++#include ++#include ++ ++int ++attribute_hidden ++__isnanl_pseudo(long double x) ++{ ++ int32_t se,hx,lx,pn; ++ GET_LDOUBLE_WORDS(se,hx,lx,x); ++ se = (se & 0x7fff) << 1; ++ /* Detect pseudo-normal numbers, i.e. exponent is non-zero and the top ++ bit of the significand is not set. */ ++ pn = (uint32_t)((~hx & 0x80000000) & (se|(-se)))>>31; ++ /* Clear the significand bit when computing mantissa. */ ++ lx |= hx & 0x7fffffff; ++ se |= (uint32_t)(lx|(-lx))>>31; ++ se = 0xfffe - se; ++ ++ return (int)(((uint32_t)(se)) >> 16) | pn; ++} diff --git a/glibc-rh1993930.patch b/glibc-rh1993930.patch new file mode 100644 index 0000000..45f34c8 --- /dev/null +++ b/glibc-rh1993930.patch @@ -0,0 +1,251 @@ +Downstream-only patch to introduce the +/etc/sysconfig/strcasecmp-nonascii configuration file, which switches +to an implementation of strcasecmp, strcasecmp_l, strncasecmp, +strncasecmp_l that always performs case-conversion as per tolower. + +The original glibc 2.17 version of these functions only ignored +case within the ASCII range due to upstream bug 15736, but it is +too late to change this regression (compared to Red Hat Enterprise +Linux 6) in Red Hat Enterprise Linux 7. + +This patch only covers i686 and x86_64. s390x is not affected. +ppc64le would require additional changes. + +diff --git a/sysdeps/i386/i686/multiarch/init-arch.h b/sysdeps/i386/i686/multiarch/init-arch.h +index cd2d0befee728b50..60d0eed17d004871 100644 +--- a/sysdeps/i386/i686/multiarch/init-arch.h ++++ b/sysdeps/i386/i686/multiarch/init-arch.h +@@ -1 +1,21 @@ + #include ++ ++#ifdef __ASSEMBLER__ ++/* Performan an access system call to check whether the configuration ++ file exists. If it does, load SYMBOL into %eax and jump to LABEL. */ ++# define CHECK_STRCASECMP_CONFIG_FILE(symbol, label) \ ++ pushl %ebx; \ ++ cfi_adjust_cfa_offset (4); \ ++ cfi_rel_offset (%ebx, 0); \ ++ LOAD_PIC_REG (dx); \ ++ movl $__NR_access, %eax; \ ++ lea __sysconfig_strcasecmp_nonascii@GOTOFF(%edx), %ebx; \ ++ xor %ecx, %ecx; \ ++ int $0x80; \ ++ test %eax, %eax; \ ++ lea symbol@GOTOFF(%edx), %eax; \ ++ popl %ebx; \ ++ cfi_adjust_cfa_offset (-4); \ ++ cfi_restore (%ebx); \ ++ jz label ++#endif +diff --git a/sysdeps/i386/i686/multiarch/strcasecmp-c.c b/sysdeps/i386/i686/multiarch/strcasecmp-c.c +index 753c6ec84ab9f8ea..b50c527525a347d0 100644 +--- a/sysdeps/i386/i686/multiarch/strcasecmp-c.c ++++ b/sysdeps/i386/i686/multiarch/strcasecmp-c.c +@@ -10,3 +10,8 @@ strong_alias (__strcasecmp_nonascii, __strcasecmp_ia32) + /* The needs of strcasecmp in libc are minimal, no need to go through + the IFUNC. */ + strong_alias (__strcasecmp_nonascii, __GI___strcasecmp) ++ ++/* Used by the assembler IFUNC selectors. Presence of this file ++ indicates that the C implementation shall be used. */ ++const char __sysconfig_strcasecmp_nonascii[] attribute_hidden = ++ "/etc/sysconfig/strcasecmp-nonascii"; +diff --git a/sysdeps/i386/i686/multiarch/strcasecmp.S b/sysdeps/i386/i686/multiarch/strcasecmp.S +index 7efef3b1b0545b5d..9c21a2d5d8b713a1 100644 +--- a/sysdeps/i386/i686/multiarch/strcasecmp.S ++++ b/sysdeps/i386/i686/multiarch/strcasecmp.S +@@ -23,6 +23,7 @@ + .text + ENTRY(__strcasecmp) + .type __strcasecmp, @gnu_indirect_function ++ CHECK_STRCASECMP_CONFIG_FILE (__strcasecmp_nonascii, 2f) + LOAD_GOT_AND_RTLD_GLOBAL_RO + LOAD_FUNC_GOT_EAX (__strcasecmp_ia32) + HAS_CPU_FEATURE (SSSE3) +diff --git a/sysdeps/i386/i686/multiarch/strcasecmp_l.S b/sysdeps/i386/i686/multiarch/strcasecmp_l.S +index 711c09b0dc1fa62e..512e9bd66ed66b23 100644 +--- a/sysdeps/i386/i686/multiarch/strcasecmp_l.S ++++ b/sysdeps/i386/i686/multiarch/strcasecmp_l.S +@@ -1,6 +1,7 @@ + /* Multiple versions of strcasecmp_l + All versions must be listed in ifunc-impl-list.c. */ + #define STRCMP __strcasecmp_l ++#define STRCMP_NONASCII __strcasecmp_l_nonascii + #define USE_AS_STRCASECMP_L + #include "strcmp.S" + +diff --git a/sysdeps/i386/i686/multiarch/strcmp.S b/sysdeps/i386/i686/multiarch/strcmp.S +index 19967e8db0990c2c..7fc791a18089da6f 100644 +--- a/sysdeps/i386/i686/multiarch/strcmp.S ++++ b/sysdeps/i386/i686/multiarch/strcmp.S +@@ -54,6 +54,9 @@ + .text + ENTRY(STRCMP) + .type STRCMP, @gnu_indirect_function ++#if defined (USE_AS_STRCASECMP_L) || defined (USE_AS_STRNCASECMP_L) ++ CHECK_STRCASECMP_CONFIG_FILE (STRCMP_NONASCII, 2f) ++#endif + LOAD_GOT_AND_RTLD_GLOBAL_RO + LOAD_FUNC_GOT_EAX (__STRCMP_IA32) + HAS_CPU_FEATURE (SSSE3) +diff --git a/sysdeps/i386/i686/multiarch/strncase.S b/sysdeps/i386/i686/multiarch/strncase.S +index 952c7c60994f3023..36495559de590179 100644 +--- a/sysdeps/i386/i686/multiarch/strncase.S ++++ b/sysdeps/i386/i686/multiarch/strncase.S +@@ -23,6 +23,7 @@ + .text + ENTRY(__strncasecmp) + .type __strncasecmp, @gnu_indirect_function ++ CHECK_STRCASECMP_CONFIG_FILE (__strncasecmp_nonascii, 2f) + LOAD_GOT_AND_RTLD_GLOBAL_RO + LOAD_FUNC_GOT_EAX (__strncasecmp_ia32) + HAS_CPU_FEATURE (SSSE3) +diff --git a/sysdeps/i386/i686/multiarch/strncase_l.S b/sysdeps/i386/i686/multiarch/strncase_l.S +index 8a74ee8574c720ae..b77951b26b98b8c8 100644 +--- a/sysdeps/i386/i686/multiarch/strncase_l.S ++++ b/sysdeps/i386/i686/multiarch/strncase_l.S +@@ -1,6 +1,7 @@ + /* Multiple versions of strncasecmp_l + All versions must be listed in ifunc-impl-list.c. */ + #define STRCMP __strncasecmp_l ++#define STRCMP_NONASCII __strncasecmp_l_nonascii + #define USE_AS_STRNCASECMP_L + #include "strcmp.S" + +diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile +index c6766bb2b443a28a..d75ec12e6f1237c9 100644 +--- a/sysdeps/x86_64/Makefile ++++ b/sysdeps/x86_64/Makefile +@@ -14,7 +14,8 @@ tests += tst-mallocalign1 + endif + + ifeq ($(subdir),string) +-sysdep_routines += cacheinfo strcasecmp_l-nonascii strncase_l-nonascii ++sysdep_routines += cacheinfo strcasecmp_l-nonascii strncase_l-nonascii \ ++ strcasecmp-nonascii strncase-nonascii + gen-as-const-headers += locale-defines.sym + endif + +diff --git a/sysdeps/x86_64/multiarch/strcasecmp_l.S b/sysdeps/x86_64/multiarch/strcasecmp_l.S +index 49f5b9fd952d3cdc..0feefe1ac81cefac 100644 +--- a/sysdeps/x86_64/multiarch/strcasecmp_l.S ++++ b/sysdeps/x86_64/multiarch/strcasecmp_l.S +@@ -1,6 +1,7 @@ + /* Multiple versions of strcasecmp and strcasecmp_l + All versions must be listed in ifunc-impl-list.c. */ + #define STRCMP __strcasecmp_l ++#define STRCMP_NONASCII __strcasecmp_l_nonascii + #define USE_AS_STRCASECMP_L + #include "strcmp.S" + +diff --git a/sysdeps/x86_64/multiarch/strcmp.S b/sysdeps/x86_64/multiarch/strcmp.S +index 48b4db8c430a514f..ede41c8f61e8b472 100644 +--- a/sysdeps/x86_64/multiarch/strcmp.S ++++ b/sysdeps/x86_64/multiarch/strcmp.S +@@ -76,6 +76,17 @@ + # endif + #endif + ++/* Performan an access system call to check whether the configuration ++ file exists. If it does, load SYMBOL into %rax and jump to LABEL. */ ++#define CHECK_STRCASECMP_CONFIG_FILE(symbol, label) \ ++ movl $__NR_access, %eax; \ ++ leaq __sysconfig_strcasecmp_nonascii(%rip), %rdi; \ ++ xor %esi, %esi; \ ++ syscall ; \ ++ test %eax, %eax; \ ++ leaq symbol(%rip), %rax; \ ++ jz label ++ + /* Define multiple versions only for the definition in libc. Don't + define multiple versions for strncmp in static library since we + need strncmp before the initialization happened. */ +@@ -83,6 +94,9 @@ + .text + ENTRY(STRCMP) + .type STRCMP, @gnu_indirect_function ++# if defined (USE_AS_STRCASECMP_L) || defined (USE_AS_STRNCASECMP_L) ++ CHECK_STRCASECMP_CONFIG_FILE(STRCMP_NONASCII, 2f) ++# endif + LOAD_RTLD_GLOBAL_RO_RDX + leaq STRCMP_SSE42(%rip), %rax + HAS_CPU_FEATURE (SSE4_2) +@@ -97,6 +111,7 @@ END(STRCMP) + # ifdef USE_AS_STRCASECMP_L + ENTRY(__strcasecmp) + .type __strcasecmp, @gnu_indirect_function ++ CHECK_STRCASECMP_CONFIG_FILE(__strcasecmp_nonascii, 2f) + LOAD_RTLD_GLOBAL_RO_RDX + # ifdef HAVE_AVX_SUPPORT + leaq __strcasecmp_avx(%rip), %rax +@@ -117,6 +132,7 @@ weak_alias (__strcasecmp, strcasecmp) + # ifdef USE_AS_STRNCASECMP_L + ENTRY(__strncasecmp) + .type __strncasecmp, @gnu_indirect_function ++ CHECK_STRCASECMP_CONFIG_FILE(__strncasecmp_nonascii, 2f) + LOAD_RTLD_GLOBAL_RO_RDX + # ifdef HAVE_AVX_SUPPORT + leaq __strncasecmp_avx(%rip), %rax +diff --git a/sysdeps/x86_64/multiarch/strncase_l.S b/sysdeps/x86_64/multiarch/strncase_l.S +index 9c0149788e9c11b5..259ce6b5ef57e178 100644 +--- a/sysdeps/x86_64/multiarch/strncase_l.S ++++ b/sysdeps/x86_64/multiarch/strncase_l.S +@@ -1,6 +1,7 @@ + /* Multiple versions of strncasecmp and strncasecmp_l + All versions must be listed in ifunc-impl-list.c. */ + #define STRCMP __strncasecmp_l ++#define STRCMP_NONASCII __strncasecmp_l_nonascii + #define USE_AS_STRNCASECMP_L + #include "strcmp.S" + +diff --git a/sysdeps/x86_64/strcasecmp-nonascii.c b/sysdeps/x86_64/strcasecmp-nonascii.c +new file mode 100644 +index 0000000000000000..7e81a7bdb6f52c47 +--- /dev/null ++++ b/sysdeps/x86_64/strcasecmp-nonascii.c +@@ -0,0 +1,13 @@ ++#if IS_IN (libc) ++# include ++ ++extern int __strcasecmp_nonascii (const char *__s1, const char *__s2); ++ ++# define __strcasecmp __strcasecmp_nonascii ++# include ++ ++/* Used by the assembler IFUNC selectors. Presence of this file ++ indicates that the C implementation shall be used. */ ++const char __sysconfig_strcasecmp_nonascii[] attribute_hidden = ++ "/etc/sysconfig/strcasecmp-nonascii"; ++#endif +diff --git a/sysdeps/x86_64/strcasecmp_l-nonascii.c b/sysdeps/x86_64/strcasecmp_l-nonascii.c +index 30e8969603ea7817..4abd55ae2a54f94a 100644 +--- a/sysdeps/x86_64/strcasecmp_l-nonascii.c ++++ b/sysdeps/x86_64/strcasecmp_l-nonascii.c +@@ -1,8 +1,10 @@ +-#include ++#if IS_IN (libc) ++# include + + extern int __strcasecmp_l_nonascii (const char *__s1, const char *__s2, + __locale_t __loc); + +-#define __strcasecmp_l __strcasecmp_l_nonascii +-#define USE_IN_EXTENDED_LOCALE_MODEL 1 +-#include ++# define __strcasecmp_l __strcasecmp_l_nonascii ++# define USE_IN_EXTENDED_LOCALE_MODEL 1 ++# include ++#endif +diff --git a/sysdeps/x86_64/strncase-nonascii.c b/sysdeps/x86_64/strncase-nonascii.c +new file mode 100644 +index 0000000000000000..4db45017c189b87a +--- /dev/null ++++ b/sysdeps/x86_64/strncase-nonascii.c +@@ -0,0 +1,7 @@ ++#include ++ ++extern int __strncasecmp_nonascii (const char *__s1, const char *__s2, ++ size_t __n); ++ ++#define __strncasecmp __strncasecmp_nonascii ++#include diff --git a/glibc.spec b/glibc.spec index d56f3a5..8594015 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.17-c758a686 %define glibcversion 2.17 -%define glibcrelease 323.1%{?dist}.1 +%define glibcrelease 325%{?dist} ############################################################################## # We support the following options: # --with/--without, @@ -249,11 +249,6 @@ Patch0068: glibc-rh1349982.patch # These changes were brought forward from RHEL 6 for compatibility Patch0069: glibc-rh1448107.patch -# Armhfp build issue -Patch9997: centos-arm32-NO_LONG_DOUBLE_MATH.patch -Patch9998: glibc-armhfp-ELF_MACHINE_NO_REL-undefined.patch -Patch9999: glibc-rh1256317-armhfp-build-issue.patch - Patch1000: glibc-rh905877.patch Patch1001: glibc-rh958652.patch Patch1002: glibc-rh977870.patch @@ -1645,9 +1640,12 @@ Patch2857: glibc-rh1812119-2.patch Patch2858: glibc-rh1883162.patch Patch2859: glibc-rh1925204-1.patch Patch2860: glibc-rh1925204-2.patch - -Patch10001: 10001-glibc-anolis-update-headers-with-the-define-EPOLLEXCLUSIVE.patch -Patch10002: 10002-glibc-anolis-tcache.patch +Patch2861: glibc-rh1927536.patch +Patch2862: glibc-rh1993930.patch +# Armhfp build issue +Patch9997: centos-arm32-NO_LONG_DOUBLE_MATH.patch +Patch9998: glibc-armhfp-ELF_MACHINE_NO_REL-undefined.patch +Patch9999: glibc-rh1256317-armhfp-build-issue.patch ############################################################################## # End of glibc patches. @@ -3018,6 +3016,8 @@ package or when debugging this package. %patch2858 -p1 %patch2859 -p1 %patch2860 -p1 +%patch2861 -p1 +%patch2862 -p1 %ifarch %{arm} %patch9998 -p1 @@ -3025,8 +3025,6 @@ package or when debugging this package. %patch9997 -p1 %endif -%patch10001 -p1 -%patch10002 -p1 ############################################################################## # %%prep - Additional prep required... ############################################################################## @@ -4213,8 +4211,110 @@ rm -f *.filelist* %endif %changelog -* Thu Sep 09 2021 Hang Zhao <1209176326@qq.com> - 2.17-323.1.1 -- Update to glibc-2.17-323.1.al7.1 +* Thu Aug 19 2021 Florian Weimer - 2.17-325 +- Support /etc/sysconfig/strcasecmp-nonascii for enabling non-ASCII case + conversion in strcasecmp, strncasecmp (#1993930) + +* Fri Mar 26 2021 Siddhesh Poyarekar - 2.17-324 +- Move __isnanl_pseudo into its own file and link only into libc (#1927536) + +* Fri Feb 05 2021 Siddhesh Poyarekar - 2.17-323 +- Fix isnanl check in printf. (#1925204) + +* Wed Jan 06 2021 Carlos O'Donell - 2.17-322 +- Enable file-based IFUNC selection on NVMe devices (#1883162) + +* Wed Jan 06 2021 Carlos O'Donell - 2.17-321 +- CVE-2020-10029: Prevent stack corruption from crafted input in cosl, sinl, + sincosl, and tanl function. (#1812119) + +* Tue Jan 05 2021 Carlos O'Donell - 2.17-320 +- CVE-2020-29573: Harden printf family of functions (#1869380) + +* Tue Jan 05 2021 Carlos O'Donell - 2.17-319 +- Revert fix for #1772307 to improve Intel Xeon performance (#1889977) + +* Tue Jan 05 2021 Carlos O'Donell - 2.17-318 +- CVE-2019-25013: Fix EUC-KR conversion module defect (#1912543) + +* Tue May 12 2020 Florian Weimer - 2.17-317 +- Do not clobber errno in nss_compat (#1834816) + +* Thu Jan 30 2020 Carlos O'Donell - 2.17-316 +- Adjust security hardening changes for 64-bit POWER BE due to + toolchain limitations (#1793853) + +* Wed Jan 29 2020 Florian Weimer - 2.17-315 +- argp: Do not override GCC keywords with macros (#1763325) + +* Wed Jan 29 2020 Florian Weimer - 2.17-314 +- Disable libio vtable validation for interposed pre-2.1 stdio handles (#1775816) + +* Tue Jan 28 2020 Florian Weimer - 2.17-313 +- Remove problematic Obsoletes: (#1795573) + +* Fri Jan 24 2020 Patsy Griffin - 2.17-312 +- Update syscall-names.list to current version 5.4. (#1747465) + +* Tue Jan 21 2020 DJ Delorie - 2.17-311 +- Improve bcopy performance on Intel Haswell (#1772307) + +* Tue Jan 21 2020 DJ Delorie - 2.17-310 +- Filter "ignore" autofs mount entries in getmntent (#1728915) + +* Tue Jan 21 2020 Arjun Shankar - 2.17-309 +- Fix race condition in tst-waitid (#1235112) + +* Tue Jan 21 2020 Arjun Shankar - 2.17-308 +- CVE-2019-19126: rtld: Check __libc_enable_secure before honoring + LD_PREFER_MAP_32BIT_EXEC (#1775599) + +* Tue Oct 22 2019 Florian Weimer - 2.17-307 +- Fix assert after attempting to dlopen main programs (#1740039) + +* Fri Aug 2 2019 Carlos O'Donell - 2.17-306 +- Fix dlopen crash when LD_LIBRARY_PATH is set (#1484832) + +* Thu Aug 1 2019 Florian Weimer - 2.17-305 +- Fix race condition in malloc_info (#1065574) + +* Thu Aug 1 2019 Florian Weimer - 2.17-304 +- Account for size of locale-archive in RPM package (#1714888) + +* Thu Aug 1 2019 Florian Weimer - 2.17-303 +- Do not mark locale archive as %%config (#1717512) + +* Wed Jul 31 2019 DJ Delorie - 2.17-302 +- Allow endpwent without getpwent (#1698015) + +* Wed Jul 31 2019 DJ Delorie - 2.17-301 +- Ensure binary locale files are identical across multilibs (#1691534) + +* Wed Jul 31 2019 DJ Delorie - 2.17-300 +- Fix off-by-one in nscd getservbyport call (#1634021) + +* Tue Jul 30 2019 Patsy Griffin - 2.17-299 +- Update glibc headers for Linux 4.0, 4.1 definitions and + Linux 4.2 netinet/in.h values. (#1579451) + +* Mon Jul 29 2019 Patsy Griffin - 2.17-298 +- Improve NSS testing including new MERGE feature testing (#1636229) + +* Fri Jul 26 2019 Patsy Griffin - 2.17-297 +- Add compiler barriers around modifications of the robust mutex list + for pthread_mutex_trylock. (#1672771) + +* Fri Jul 26 2019 Arjun Shankar - 2.17-296 +- Fix crash in posix/bug-ga2 test when there is no IPv6 interface (#1451308) + +* Fri Jul 26 2019 Arjun Shankar - 2.17-295 +- resolv: Switch DNS servers on all ICMP errors (#1670041) + +* Thu Jul 25 2019 Arjun Shankar - 2.17-294 +- Build glibc with additional hardening (#1406732) + +* Wed Jul 24 2019 Arjun Shankar - 2.17-293 +- iconv: Add support for IBM858 character encoding (#1414263) * Tue Apr 30 2019 Arjun Shankar - 2.17-292 - Avoid iconv hang on invalid multi-byte sequences (#1427734)