update to glibc-2.17-323.1.al7.1

Signed-off-by: zhaohang <1209176326@qq.com>
This commit is contained in:
赵航 2021-09-09 14:23:25 +08:00 committed by Liwei Ge
parent ff0128648f
commit 8c29e492e2
60 changed files with 7244 additions and 176 deletions

View file

@ -0,0 +1,42 @@
From bc2f1d9fe282f49dc4e2e34f4e16e8f2550cbe5e Mon Sep 17 00:00:00 2001
From: Chunmei Xu <xuchunmei@linux.alibaba.com>
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 <xuchunmei@linux.alibaba.com>
---
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 <joseph@codesourcery.com>
+
+ * * sysdeps/unix/sysv/linux/sys/epoll.h (enum EPOLL_EVENTS): Add
+ EPOLLEXCLUSIVE.
+
2019-01-01 Joseph Myers <joseph@codesourcery.com>
* 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

View file

@ -0,0 +1,479 @@
# 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 <malloc/malloc-internal.h>
/*
@@ -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)

View file

@ -0,0 +1,19 @@
diff -Naurp a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
--- a/stdio-common/printf_fp.c 2021-02-03 16:46:26.887807279 +0000
+++ b/stdio-common/printf_fp.c 2021-02-03 16:50:16.604469900 +0000
@@ -151,6 +151,7 @@ static wchar_t *group_number (wchar_t *b
wchar_t thousands_sep, int ngroups)
internal_function;
+#ifndef __NO_LONG_DOUBLE_MATH
static __always_inline int
isnanl_or_pseudo (long double in)
{
@@ -172,6 +173,7 @@ isnanl_or_pseudo (long double in)
return __isnanl (in);
#endif
}
+#endif
int

View file

@ -0,0 +1,36 @@
From patchwork Thu Jul 3 13:26:40 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: ARM: Define ELF_MACHINE_NO_REL
X-Patchwork-Submitter: Will Newton <will.newton@linaro.org>
X-Patchwork-Id: 366862
Message-Id: <1404394000-13429-1-git-send-email-will.newton@linaro.org>
To: libc-alpha@sourceware.org
Date: Thu, 3 Jul 2014 14:26:40 +0100
From: Will Newton <will.newton@linaro.org>
List-Id: <libc-alpha.sourceware.org>
Fix a -Wundef warning on ARM.
ChangeLog:
2014-07-03 Will Newton <will.newton@linaro.org>
* sysdeps/arm/dl-machine.h (ELF_MACHINE_NO_REL): Define.
---
sysdeps/arm/dl-machine.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index c5ffc93..d6b0c52 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -296,6 +296,7 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc,
/* ARM never uses Elf32_Rela relocations for the dynamic linker.
Prelinked libraries may use Elf32_Rela though. */
#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_REL 0
/* Names of the architecture-specific auditing callback functions. */
#define ARCH_LA_PLTENTER arm_gnu_pltenter

38
glibc-rh1065574-1.patch Normal file
View file

@ -0,0 +1,38 @@
commit 8b35e35d0f4eae28a47c23e2aa15ddf570fa86ef
Author: Ondřej Bílka <neleai@seznam.cz>
Date: Fri Nov 1 15:39:26 2013 +0100
Fix malloc_info statistic. Fixes bug 16112
diff --git a/malloc/malloc.c b/malloc/malloc.c
index b47d99ac65344c82..c98b3f79ed38b4f0 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5068,23 +5068,11 @@ malloc_info (int options, FILE *fp)
sizes[i].total = sizes[i].count * sizes[i].to;
}
- mbinptr bin = bin_at (ar_ptr, 1);
- struct malloc_chunk *r = bin->fd;
- if (r != NULL)
- {
- while (r != bin)
- {
- ++sizes[NFASTBINS].count;
- sizes[NFASTBINS].total += r->size;
- sizes[NFASTBINS].from = MIN (sizes[NFASTBINS].from, r->size);
- sizes[NFASTBINS].to = MAX (sizes[NFASTBINS].to, r->size);
- r = r->fd;
- }
- nblocks += sizes[NFASTBINS].count;
- avail += sizes[NFASTBINS].total;
- }
- for (size_t i = 2; i < NBINS; ++i)
+ mbinptr bin;
+ struct malloc_chunk *r;
+
+ for (size_t i = 1; i < NBINS; ++i)
{
bin = bin_at (ar_ptr, i);
r = bin->fd;

236
glibc-rh1065574-2.patch Normal file
View file

@ -0,0 +1,236 @@
This is a partial recreation of this upstream commit, restricted to
the malloc_info function:
commit 6c8dbf00f536d78b1937b5af6f57be47fd376344
Author: Ondřej Bílka <neleai@seznam.cz>
Date: Thu Jan 2 09:38:18 2014 +0100
Reformat malloc to gnu style.
It is not an exact copy because glibc-rh1103856.patch backported
commit 4d653a59ffeae0f46f76a40230e2cfa9587b7e7e ("Add mmap usage in
malloc_info output"), which came after the reformatting upstream.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index c98b3f79ed38b4f0..5c7a27129d66e06a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5023,7 +5023,8 @@ malloc_info (int options, FILE *fp)
size_t total_aspace = 0;
size_t total_aspace_mprotect = 0;
- void mi_arena (mstate ar_ptr)
+ void
+ mi_arena (mstate ar_ptr)
{
fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
@@ -5044,28 +5045,28 @@ malloc_info (int options, FILE *fp)
for (size_t i = 0; i < NFASTBINS; ++i)
{
- mchunkptr p = fastbin (ar_ptr, i);
- if (p != NULL)
- {
- size_t nthissize = 0;
- size_t thissize = chunksize (p);
-
- while (p != NULL)
- {
- ++nthissize;
- p = p->fd;
- }
-
- fastavail += nthissize * thissize;
- nfastblocks += nthissize;
- sizes[i].from = thissize - (MALLOC_ALIGNMENT - 1);
- sizes[i].to = thissize;
- sizes[i].count = nthissize;
- }
- else
- sizes[i].from = sizes[i].to = sizes[i].count = 0;
-
- sizes[i].total = sizes[i].count * sizes[i].to;
+ mchunkptr p = fastbin (ar_ptr, i);
+ if (p != NULL)
+ {
+ size_t nthissize = 0;
+ size_t thissize = chunksize (p);
+
+ while (p != NULL)
+ {
+ ++nthissize;
+ p = p->fd;
+ }
+
+ fastavail += nthissize * thissize;
+ nfastblocks += nthissize;
+ sizes[i].from = thissize - (MALLOC_ALIGNMENT - 1);
+ sizes[i].to = thissize;
+ sizes[i].count = nthissize;
+ }
+ else
+ sizes[i].from = sizes[i].to = sizes[i].count = 0;
+
+ sizes[i].total = sizes[i].count * sizes[i].to;
}
@@ -5074,29 +5075,29 @@ malloc_info (int options, FILE *fp)
for (size_t i = 1; i < NBINS; ++i)
{
- bin = bin_at (ar_ptr, i);
- r = bin->fd;
- sizes[NFASTBINS - 1 + i].from = ~((size_t) 0);
- sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
- = sizes[NFASTBINS - 1 + i].count = 0;
-
- if (r != NULL)
- while (r != bin)
- {
- ++sizes[NFASTBINS - 1 + i].count;
- sizes[NFASTBINS - 1 + i].total += r->size;
- sizes[NFASTBINS - 1 + i].from
- = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
- sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
- r->size);
-
- r = r->fd;
- }
-
- if (sizes[NFASTBINS - 1 + i].count == 0)
- sizes[NFASTBINS - 1 + i].from = 0;
- nblocks += sizes[NFASTBINS - 1 + i].count;
- avail += sizes[NFASTBINS - 1 + i].total;
+ bin = bin_at (ar_ptr, i);
+ r = bin->fd;
+ sizes[NFASTBINS - 1 + i].from = ~((size_t) 0);
+ sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
+ = sizes[NFASTBINS - 1 + i].count = 0;
+
+ if (r != NULL)
+ while (r != bin)
+ {
+ ++sizes[NFASTBINS - 1 + i].count;
+ sizes[NFASTBINS - 1 + i].total += r->size;
+ sizes[NFASTBINS - 1 + i].from
+ = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
+ sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
+ r->size);
+
+ r = r->fd;
+ }
+
+ if (sizes[NFASTBINS - 1 + i].count == 0)
+ sizes[NFASTBINS - 1 + i].from = 0;
+ nblocks += sizes[NFASTBINS - 1 + i].count;
+ avail += sizes[NFASTBINS - 1 + i].total;
}
mutex_unlock (&ar_ptr->mutex);
@@ -5109,51 +5110,51 @@ malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, "\
+ fprintf (fp, " \
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
- sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
+ sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
if (sizes[NFASTBINS].count != 0)
fprintf (fp, "\
<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
- sizes[NFASTBINS].from, sizes[NFASTBINS].to,
- sizes[NFASTBINS].total, sizes[NFASTBINS].count);
+ sizes[NFASTBINS].from, sizes[NFASTBINS].to,
+ sizes[NFASTBINS].total, sizes[NFASTBINS].count);
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
fprintf (fp,
- "</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
- "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
- "<system type=\"current\" size=\"%zu\"/>\n"
- "<system type=\"max\" size=\"%zu\"/>\n",
- nfastblocks, fastavail, nblocks, avail,
- ar_ptr->system_mem, ar_ptr->max_system_mem);
+ "</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<system type=\"current\" size=\"%zu\"/>\n"
+ "<system type=\"max\" size=\"%zu\"/>\n",
+ nfastblocks, fastavail, nblocks, avail,
+ ar_ptr->system_mem, ar_ptr->max_system_mem);
if (ar_ptr != &main_arena)
{
- heap_info *heap = heap_for_ptr(top(ar_ptr));
- fprintf (fp,
- "<aspace type=\"total\" size=\"%zu\"/>\n"
- "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
- heap->size, heap->mprotect_size);
- total_aspace += heap->size;
- total_aspace_mprotect += heap->mprotect_size;
+ heap_info *heap = heap_for_ptr (top (ar_ptr));
+ fprintf (fp,
+ "<aspace type=\"total\" size=\"%zu\"/>\n"
+ "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+ heap->size, heap->mprotect_size);
+ total_aspace += heap->size;
+ total_aspace_mprotect += heap->mprotect_size;
}
else
{
- fprintf (fp,
- "<aspace type=\"total\" size=\"%zu\"/>\n"
- "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
- ar_ptr->system_mem, ar_ptr->system_mem);
- total_aspace += ar_ptr->system_mem;
- total_aspace_mprotect += ar_ptr->system_mem;
+ fprintf (fp,
+ "<aspace type=\"total\" size=\"%zu\"/>\n"
+ "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+ ar_ptr->system_mem, ar_ptr->system_mem);
+ total_aspace += ar_ptr->system_mem;
+ total_aspace_mprotect += ar_ptr->system_mem;
}
fputs ("</heap>\n", fp);
}
- if(__malloc_initialized < 0)
+ if (__malloc_initialized < 0)
ptmalloc_init ();
fputs ("<malloc version=\"1\">\n", fp);
@@ -5168,18 +5169,18 @@ malloc_info (int options, FILE *fp)
while (ar_ptr != &main_arena);
fprintf (fp,
- "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
- "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"mmap\" count=\"%d\" size=\"%zu\"/>\n"
- "<system type=\"current\" size=\"%zu\"/>\n"
- "<system type=\"max\" size=\"%zu\"/>\n"
- "<aspace type=\"total\" size=\"%zu\"/>\n"
- "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
- "</malloc>\n",
- total_nfastblocks, total_fastavail, total_nblocks, total_avail,
+ "<system type=\"current\" size=\"%zu\"/>\n"
+ "<system type=\"max\" size=\"%zu\"/>\n"
+ "<aspace type=\"total\" size=\"%zu\"/>\n"
+ "<aspace type=\"mprotect\" size=\"%zu\"/>\n"
+ "</malloc>\n",
+ total_nfastblocks, total_fastavail, total_nblocks, total_avail,
mp_.n_mmaps, mp_.mmapped_mem,
- total_system, total_max_system,
- total_aspace, total_aspace_mprotect);
+ total_system, total_max_system,
+ total_aspace, total_aspace_mprotect);
return 0;
}

276
glibc-rh1065574-3.patch Normal file
View file

@ -0,0 +1,276 @@
commit 987c02692a88b8c9024cb99187434aad02c3c047
Author: Ondřej Bílka <neleai@seznam.cz>
Date: Fri May 30 13:24:56 2014 +0200
Remove mi_arena nested function.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 5c7a27129d66e06a..c99b26d4a85e1b22 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5023,147 +5023,143 @@ malloc_info (int options, FILE *fp)
size_t total_aspace = 0;
size_t total_aspace_mprotect = 0;
- void
- mi_arena (mstate ar_ptr)
- {
- fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
- size_t nblocks = 0;
- size_t nfastblocks = 0;
- size_t avail = 0;
- size_t fastavail = 0;
- struct
- {
- size_t from;
- size_t to;
- size_t total;
- size_t count;
- } sizes[NFASTBINS + NBINS - 1];
-#define nsizes (sizeof (sizes) / sizeof (sizes[0]))
- mutex_lock (&ar_ptr->mutex);
+ if (__malloc_initialized < 0)
+ ptmalloc_init ();
+
+ fputs ("<malloc version=\"1\">\n", fp);
+
+ /* Iterate over all arenas currently in use. */
+ mstate ar_ptr = &main_arena;
+ do
+ {
+ fprintf (fp, "<heap nr=\"%d\">\n<sizes>\n", n++);
- for (size_t i = 0; i < NFASTBINS; ++i)
+ size_t nblocks = 0;
+ size_t nfastblocks = 0;
+ size_t avail = 0;
+ size_t fastavail = 0;
+ struct
{
- mchunkptr p = fastbin (ar_ptr, i);
- if (p != NULL)
- {
- size_t nthissize = 0;
- size_t thissize = chunksize (p);
-
- while (p != NULL)
- {
- ++nthissize;
- p = p->fd;
- }
-
- fastavail += nthissize * thissize;
- nfastblocks += nthissize;
- sizes[i].from = thissize - (MALLOC_ALIGNMENT - 1);
- sizes[i].to = thissize;
- sizes[i].count = nthissize;
- }
- else
- sizes[i].from = sizes[i].to = sizes[i].count = 0;
-
- sizes[i].total = sizes[i].count * sizes[i].to;
- }
+ size_t from;
+ size_t to;
+ size_t total;
+ size_t count;
+ } sizes[NFASTBINS + NBINS - 1];
+#define nsizes (sizeof (sizes) / sizeof (sizes[0]))
+ mutex_lock (&ar_ptr->mutex);
- mbinptr bin;
- struct malloc_chunk *r;
+ for (size_t i = 0; i < NFASTBINS; ++i)
+ {
+ mchunkptr p = fastbin (ar_ptr, i);
+ if (p != NULL)
+ {
+ size_t nthissize = 0;
+ size_t thissize = chunksize (p);
+
+ while (p != NULL)
+ {
+ ++nthissize;
+ p = p->fd;
+ }
+
+ fastavail += nthissize * thissize;
+ nfastblocks += nthissize;
+ sizes[i].from = thissize - (MALLOC_ALIGNMENT - 1);
+ sizes[i].to = thissize;
+ sizes[i].count = nthissize;
+ }
+ else
+ sizes[i].from = sizes[i].to = sizes[i].count = 0;
- for (size_t i = 1; i < NBINS; ++i)
- {
- bin = bin_at (ar_ptr, i);
- r = bin->fd;
- sizes[NFASTBINS - 1 + i].from = ~((size_t) 0);
- sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
- = sizes[NFASTBINS - 1 + i].count = 0;
-
- if (r != NULL)
- while (r != bin)
- {
- ++sizes[NFASTBINS - 1 + i].count;
- sizes[NFASTBINS - 1 + i].total += r->size;
- sizes[NFASTBINS - 1 + i].from
- = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
- sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
- r->size);
-
- r = r->fd;
- }
-
- if (sizes[NFASTBINS - 1 + i].count == 0)
- sizes[NFASTBINS - 1 + i].from = 0;
- nblocks += sizes[NFASTBINS - 1 + i].count;
- avail += sizes[NFASTBINS - 1 + i].total;
- }
+ sizes[i].total = sizes[i].count * sizes[i].to;
+ }
- mutex_unlock (&ar_ptr->mutex);
- total_nfastblocks += nfastblocks;
- total_fastavail += fastavail;
+ mbinptr bin;
+ struct malloc_chunk *r;
- total_nblocks += nblocks;
- total_avail += avail;
+ for (size_t i = 1; i < NBINS; ++i)
+ {
+ bin = bin_at (ar_ptr, i);
+ r = bin->fd;
+ sizes[NFASTBINS - 1 + i].from = ~((size_t) 0);
+ sizes[NFASTBINS - 1 + i].to = sizes[NFASTBINS - 1 + i].total
+ = sizes[NFASTBINS - 1 + i].count = 0;
+
+ if (r != NULL)
+ while (r != bin)
+ {
+ ++sizes[NFASTBINS - 1 + i].count;
+ sizes[NFASTBINS - 1 + i].total += r->size;
+ sizes[NFASTBINS - 1 + i].from
+ = MIN (sizes[NFASTBINS - 1 + i].from, r->size);
+ sizes[NFASTBINS - 1 + i].to = MAX (sizes[NFASTBINS - 1 + i].to,
+ r->size);
+
+ r = r->fd;
+ }
- for (size_t i = 0; i < nsizes; ++i)
- if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, " \
-<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
- sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
+ if (sizes[NFASTBINS - 1 + i].count == 0)
+ sizes[NFASTBINS - 1 + i].from = 0;
+ nblocks += sizes[NFASTBINS - 1 + i].count;
+ avail += sizes[NFASTBINS - 1 + i].total;
+ }
- if (sizes[NFASTBINS].count != 0)
- fprintf (fp, "\
-<unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
- sizes[NFASTBINS].from, sizes[NFASTBINS].to,
- sizes[NFASTBINS].total, sizes[NFASTBINS].count);
+ mutex_unlock (&ar_ptr->mutex);
- total_system += ar_ptr->system_mem;
- total_max_system += ar_ptr->max_system_mem;
+ total_nfastblocks += nfastblocks;
+ total_fastavail += fastavail;
- fprintf (fp,
- "</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
- "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
- "<system type=\"current\" size=\"%zu\"/>\n"
- "<system type=\"max\" size=\"%zu\"/>\n",
- nfastblocks, fastavail, nblocks, avail,
- ar_ptr->system_mem, ar_ptr->max_system_mem);
+ total_nblocks += nblocks;
+ total_avail += avail;
- if (ar_ptr != &main_arena)
- {
- heap_info *heap = heap_for_ptr (top (ar_ptr));
- fprintf (fp,
- "<aspace type=\"total\" size=\"%zu\"/>\n"
- "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
- heap->size, heap->mprotect_size);
- total_aspace += heap->size;
- total_aspace_mprotect += heap->mprotect_size;
- }
- else
- {
- fprintf (fp,
- "<aspace type=\"total\" size=\"%zu\"/>\n"
- "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
- ar_ptr->system_mem, ar_ptr->system_mem);
- total_aspace += ar_ptr->system_mem;
- total_aspace_mprotect += ar_ptr->system_mem;
- }
+ for (size_t i = 0; i < nsizes; ++i)
+ if (sizes[i].count != 0 && i != NFASTBINS)
+ fprintf (fp, " \
+ <size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
+ sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);
- fputs ("</heap>\n", fp);
- }
+ if (sizes[NFASTBINS].count != 0)
+ fprintf (fp, "\
+ <unsorted from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
+ sizes[NFASTBINS].from, sizes[NFASTBINS].to,
+ sizes[NFASTBINS].total, sizes[NFASTBINS].count);
- if (__malloc_initialized < 0)
- ptmalloc_init ();
+ total_system += ar_ptr->system_mem;
+ total_max_system += ar_ptr->max_system_mem;
- fputs ("<malloc version=\"1\">\n", fp);
+ fprintf (fp,
+ "</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
+ "<system type=\"current\" size=\"%zu\"/>\n"
+ "<system type=\"max\" size=\"%zu\"/>\n",
+ nfastblocks, fastavail, nblocks, avail,
+ ar_ptr->system_mem, ar_ptr->max_system_mem);
- /* Iterate over all arenas currently in use. */
- mstate ar_ptr = &main_arena;
- do
- {
- mi_arena (ar_ptr);
+ if (ar_ptr != &main_arena)
+ {
+ heap_info *heap = heap_for_ptr (top (ar_ptr));
+ fprintf (fp,
+ "<aspace type=\"total\" size=\"%zu\"/>\n"
+ "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+ heap->size, heap->mprotect_size);
+ total_aspace += heap->size;
+ total_aspace_mprotect += heap->mprotect_size;
+ }
+ else
+ {
+ fprintf (fp,
+ "<aspace type=\"total\" size=\"%zu\"/>\n"
+ "<aspace type=\"mprotect\" size=\"%zu\"/>\n",
+ ar_ptr->system_mem, ar_ptr->system_mem);
+ total_aspace += ar_ptr->system_mem;
+ total_aspace_mprotect += ar_ptr->system_mem;
+ }
+
+ fputs ("</heap>\n", fp);
ar_ptr = ar_ptr->next;
}
while (ar_ptr != &main_arena);

38
glibc-rh1065574-4.patch Normal file
View file

@ -0,0 +1,38 @@
commit c52ff39e8ee052e4a57676d65a27f09bd0a859ad
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Nov 12 22:31:38 2014 +0000
Fix malloc_info namespace (bug 17570).
malloc_info is defined in the same file as malloc and free, but is not
an ISO C function, so should be a weak symbol. This patch makes it
so.
Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).
[BZ #17570]
* malloc/malloc.c (malloc_info): Rename to __malloc_info and
define as weak alias of __malloc_info.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index c99b26d4a85e1b22..18e00315c6edba4d 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5007,7 +5007,7 @@ weak_alias (__posix_memalign, posix_memalign)
int
-malloc_info (int options, FILE *fp)
+__malloc_info (int options, FILE *fp)
{
/* For now, at least. */
if (options != 0)
@@ -5180,6 +5180,7 @@ malloc_info (int options, FILE *fp)
return 0;
}
+weak_alias (__malloc_info, malloc_info)
strong_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc)

31
glibc-rh1065574-5.patch Normal file
View file

@ -0,0 +1,31 @@
This is a partial recreation of this upstream commit, restricted to
the __malloc_info function:
commit 4bf5f2224baa1590f92f7a26930928fe9f7e4b57
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Sep 6 12:49:54 2016 +0200
malloc: Automated part of conversion to __libc_lock
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 18e00315c6edba4d..d2a5e251da4f1191 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5049,7 +5049,7 @@ __malloc_info (int options, FILE *fp)
} sizes[NFASTBINS + NBINS - 1];
#define nsizes (sizeof (sizes) / sizeof (sizes[0]))
- mutex_lock (&ar_ptr->mutex);
+ __libc_lock_lock (ar_ptr->mutex);
for (size_t i = 0; i < NFASTBINS; ++i)
{
@@ -5108,7 +5108,7 @@ __malloc_info (int options, FILE *fp)
avail += sizes[NFASTBINS - 1 + i].total;
}
- mutex_unlock (&ar_ptr->mutex);
+ __libc_lock_unlock (ar_ptr->mutex);
total_nfastblocks += nfastblocks;
total_fastavail += fastavail;

175
glibc-rh1065574-6.patch Normal file
View file

@ -0,0 +1,175 @@
commit 7a9368a1174cb15b9f1d6342e0e10dd90dae238d
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Nov 15 11:39:01 2017 +0100
malloc: Add missing arena lock in malloc_info [BZ #22408]
Obtain the size information while the arena lock is acquired, and only
print it later.
Conflicts:
malloc/Makefile
(Differences in available tests.)
diff --git a/malloc/Makefile b/malloc/Makefile
index 992cec6b03115a76..6f216f423293dc6c 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -31,6 +31,7 @@ tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
tst-malloc-thread-fail tst-malloc-fork-deadlock \
tst-interpose-nothread \
tst-interpose-thread \
+ tst-malloc_info \
tst-interpose-static-nothread \
tst-interpose-static-thread \
tst-scratch_buffer \
@@ -214,3 +215,5 @@ $(objpfx)tst-dynarray-mem: $(objpfx)tst-dynarray.out
tst-dynarray-fail-ENV = MALLOC_TRACE=$(objpfx)tst-dynarray-fail.mtrace
$(objpfx)tst-dynarray-fail-mem: $(objpfx)tst-dynarray-fail.out
$(common-objpfx)malloc/mtrace $(objpfx)tst-dynarray-fail.mtrace > $@
+
+$(objpfx)tst-malloc_info: $(shared-thread-library)
diff --git a/malloc/malloc.c b/malloc/malloc.c
index d2a5e251da4f1191..035f2167be7019d8 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5108,6 +5108,15 @@ __malloc_info (int options, FILE *fp)
avail += sizes[NFASTBINS - 1 + i].total;
}
+ size_t heap_size = 0;
+ size_t heap_mprotect_size = 0;
+ if (ar_ptr != &main_arena)
+ {
+ heap_info *heap = heap_for_ptr (top (ar_ptr));
+ heap_size = heap->size;
+ heap_mprotect_size = heap->mprotect_size;
+ }
+
__libc_lock_unlock (ar_ptr->mutex);
total_nfastblocks += nfastblocks;
@@ -5141,13 +5150,12 @@ __malloc_info (int options, FILE *fp)
if (ar_ptr != &main_arena)
{
- heap_info *heap = heap_for_ptr (top (ar_ptr));
fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
- heap->size, heap->mprotect_size);
- total_aspace += heap->size;
- total_aspace_mprotect += heap->mprotect_size;
+ heap_size, heap_mprotect_size);
+ total_aspace += heap_size;
+ total_aspace_mprotect += heap_mprotect_size;
}
else
{
diff --git a/malloc/tst-malloc_info.c b/malloc/tst-malloc_info.c
new file mode 100644
index 0000000000000000..a25b8cbeae78e710
--- /dev/null
+++ b/malloc/tst-malloc_info.c
@@ -0,0 +1,101 @@
+/* Smoke test for malloc_info.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* The purpose of this test is to provide a quick way to run
+ malloc_info in a multi-threaded process. */
+
+#include <array_length.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <support/support.h>
+#include <support/xthread.h>
+
+/* This barrier is used to have the main thread wait until the helper
+ threads have performed their allocations. */
+static pthread_barrier_t barrier;
+
+enum
+ {
+ /* Number of threads performing allocations. */
+ thread_count = 4,
+
+ /* Amount of memory allocation per thread. This should be large
+ enough to cause the allocation of multiple heaps per arena. */
+ per_thread_allocations
+ = sizeof (void *) == 4 ? 16 * 1024 * 1024 : 128 * 1024 * 1024,
+ };
+
+static void *
+allocation_thread_function (void *closure)
+{
+ struct list
+ {
+ struct list *next;
+ long dummy[4];
+ };
+
+ struct list *head = NULL;
+ size_t allocated = 0;
+ while (allocated < per_thread_allocations)
+ {
+ struct list *new_head = xmalloc (sizeof (*new_head));
+ allocated += sizeof (*new_head);
+ new_head->next = head;
+ head = new_head;
+ }
+
+ xpthread_barrier_wait (&barrier);
+
+ /* Main thread prints first statistics here. */
+
+ xpthread_barrier_wait (&barrier);
+
+ while (head != NULL)
+ {
+ struct list *next_head = head->next;
+ free (head);
+ head = next_head;
+ }
+
+ return NULL;
+}
+
+static int
+do_test (void)
+{
+ xpthread_barrier_init (&barrier, NULL, thread_count + 1);
+
+ pthread_t threads[thread_count];
+ for (size_t i = 0; i < array_length (threads); ++i)
+ threads[i] = xpthread_create (NULL, allocation_thread_function, NULL);
+
+ xpthread_barrier_wait (&barrier);
+ puts ("info: After allocation:");
+ malloc_info (0, stdout);
+
+ xpthread_barrier_wait (&barrier);
+ for (size_t i = 0; i < array_length (threads); ++i)
+ xpthread_join (threads[i]);
+
+ puts ("\ninfo: After deallocation:");
+ malloc_info (0, stdout);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

24
glibc-rh1065574-7.patch Normal file
View file

@ -0,0 +1,24 @@
commit b0f6679bcd738ea244a14acd879d974901e56c8e
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 1 14:06:24 2019 +0200
malloc: Remove unwanted leading whitespace in malloc_info [BZ #24867]
It was introduced in commit 6c8dbf00f536d78b1937b5af6f57be47fd376344
("Reformat malloc to gnu style.").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 035f2167be7019d8..ffa0f7f00152f339 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5127,7 +5127,7 @@ __malloc_info (int options, FILE *fp)
for (size_t i = 0; i < nsizes; ++i)
if (sizes[i].count != 0 && i != NFASTBINS)
- fprintf (fp, " \
+ fprintf (fp, "\
<size from=\"%zu\" to=\"%zu\" total=\"%zu\" count=\"%zu\"/>\n",
sizes[i].from, sizes[i].to, sizes[i].total, sizes[i].count);

60
glibc-rh1235112.patch Normal file
View file

@ -0,0 +1,60 @@
commit a58ad3f801960fa0dc0bb1106eb0d99f7ebd77b1
Author: Roland McGrath <roland@hack.frob.com>
Date: Thu Jun 13 15:09:29 2013 -0700
Fix raciness in waitid test.
diff --git a/posix/tst-waitid.c b/posix/tst-waitid.c
index f8a302ea3153a853..d63ad65fbefc64ad 100644
--- a/posix/tst-waitid.c
+++ b/posix/tst-waitid.c
@@ -145,7 +145,7 @@ do_test (int argc, char *argv[])
/* Give the child a chance to stop. */
sleep (3);
- CHECK_SIGCHLD ("stopped", CLD_STOPPED, SIGSTOP);
+ CHECK_SIGCHLD ("stopped (before waitid)", CLD_STOPPED, SIGSTOP);
/* Now try a wait that should not succeed. */
siginfo_t info;
@@ -227,7 +227,7 @@ do_test (int argc, char *argv[])
expecting_sigchld = 0;
}
else
- CHECK_SIGCHLD ("continued", CLD_CONTINUED, SIGCONT);
+ CHECK_SIGCHLD ("continued (before waitid)", CLD_CONTINUED, SIGCONT);
info.si_signo = 0; /* A successful call sets it to SIGCHLD. */
info.si_pid = -1;
@@ -336,6 +336,13 @@ do_test (int argc, char *argv[])
printf ("kill (%d, SIGSTOP): %m\n", pid);
RETURN (EXIT_FAILURE);
}
+
+ /* Give the child a chance to stop. The waitpid call below will block
+ until it has stopped, but if we are real quick and enter the waitpid
+ system call before the SIGCHLD has been generated, then it will be
+ discarded and never delivered. */
+ sleep (3);
+
pid_t wpid = waitpid (pid, &fail, WUNTRACED);
if (wpid < 0)
{
@@ -354,7 +361,7 @@ do_test (int argc, char *argv[])
printf ("waitpid WUNTRACED on stopped: status %x\n", fail);
RETURN (EXIT_FAILURE);
}
- CHECK_SIGCHLD ("stopped", CLD_STOPPED, SIGSTOP);
+ CHECK_SIGCHLD ("stopped (after waitpid)", CLD_STOPPED, SIGSTOP);
expecting_sigchld = 1;
if (kill (pid, SIGCONT) != 0)
@@ -372,7 +379,7 @@ do_test (int argc, char *argv[])
expecting_sigchld = 0;
}
else
- CHECK_SIGCHLD ("continued", CLD_CONTINUED, SIGCONT);
+ CHECK_SIGCHLD ("continued (before waitpid)", CLD_CONTINUED, SIGCONT);
wpid = waitpid (pid, &fail, WCONTINUED);
if (wpid < 0)

View file

@ -0,0 +1,11 @@
--- a/sysdeps/unix/arm/sysdep.S 2016-11-05 11:44:45.561945344 +0100
+++ b/sysdeps/unix/arm/sysdep.S 2016-11-05 11:44:19.542069815 +0100
@@ -37,7 +37,7 @@
moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */
#endif
-#ifndef IS_IN_rtld
+#if !IS_IN (rtld)
mov ip, lr
cfi_register (lr, ip)
mov r1, r0

98
glibc-rh1406732-1.patch Normal file
View file

@ -0,0 +1,98 @@
This patch is based on the following upstream commit:
commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Mar 2 14:44:28 2017 +0100
Document and fix --enable-bind-now [BZ #21015]
diff --git a/INSTALL b/INSTALL
index 82b29f5d8746f929..230be71b9d0821c2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -143,6 +143,12 @@ will be used, and CFLAGS sets optimization options for the compiler.
`--enable-lock-elision=yes'
Enable lock elision for pthread mutexes by default.
+'--enable-bind-now'
+ Disable lazy binding for installed shared objects. This provides
+ additional security hardening because it enables full RELRO and a
+ read-only global offset table (GOT), at the cost of slightly
+ increased program load times.
+
`--disable-werror'
By default, the GNU C Library is built with `-Werror'. If you wish
to build without this option (for example, if building with a newer
diff --git a/Makeconfig b/Makeconfig
index f8313c9774d47522..1ad9b6f0d494c027 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -384,6 +384,13 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
LDFLAGS-rtld += $(hashstyle-LDFLAGS)
endif
+# If lazy relocations are disabled, add the -z now flag. Use
+# LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
+# test modules.
+ifeq ($(bind-now),yes)
+LDFLAGS-lib.so += -Wl,-z,now
+endif
+
# Additional libraries to link into every test.
link-extra-libs-tests = $(libsupport)
diff --git a/Makerules b/Makerules
index 9bd7d603fc28a4de..50fe7e48187f0e68 100644
--- a/Makerules
+++ b/Makerules
@@ -477,7 +477,7 @@ $(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
- $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
+ $(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
endef
@@ -938,7 +938,8 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
ifneq (unknown,$(output-format))
echo > $@.new 'OUTPUT_FORMAT($(output-format))'
else
- $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
+ $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+ $(LDFLAGS.so) $(LDFLAGS-lib.so) \
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
| sed -n -f $< > $@.new
test -s $@.new
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 7930dcd49d77c818..ddb2dc6a3c6500c8 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -65,6 +65,10 @@ modules.so := $(addsuffix .so, $(modules))
include ../Makeconfig
+ifeq ($(bind-now),yes)
+LDFLAGS.so += -Wl,-z,now
+endif
+
ifeq (yes,$(build-shared))
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
diff --git a/manual/install.texi b/manual/install.texi
index 3799cee621ddc4f9..47d832cc59bc695e 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -160,6 +160,12 @@ so that they can be invoked directly.
@item --enable-lock-elision=yes
Enable lock elision for pthread mutexes by default.
+@item --enable-bind-now
+Disable lazy binding for installed shared objects. This provides
+additional security hardening because it enables full RELRO and a
+read-only global offset table (GOT), at the cost of slightly increased
+program load times.
+
@pindex pt_chown
@findex grantpt
@item --enable-pt_chown

96
glibc-rh1406732-2.patch Normal file
View file

@ -0,0 +1,96 @@
This patch is based on the following upstream commit:
commit 94a4e9e4f401ffe829a992820439977ead0a0ce7
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Apr 25 10:41:43 2019 +0200
Extend BIND_NOW to installed programs with --enable-bind-now
Commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix
--enable-bind-now [BZ #21015]") extended BIND_NOW to all installed
shared objects. This change also covers installed programs.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/INSTALL b/INSTALL
index 230be71b9d0821c2..277ea46d9c25a9ae 100644
--- a/INSTALL
+++ b/INSTALL
@@ -144,10 +144,10 @@ will be used, and CFLAGS sets optimization options for the compiler.
Enable lock elision for pthread mutexes by default.
'--enable-bind-now'
- Disable lazy binding for installed shared objects. This provides
- additional security hardening because it enables full RELRO and a
- read-only global offset table (GOT), at the cost of slightly
- increased program load times.
+ Disable lazy binding for installed shared objects and programs.
+ This provides additional security hardening because it enables full
+ RELRO and a read-only global offset table (GOT), at the cost of
+ slightly increased program load times.
`--disable-werror'
By default, the GNU C Library is built with `-Werror'. If you wish
diff --git a/Makeconfig b/Makeconfig
index 1ad9b6f0d494c027..bc13b39c2ea5708a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -389,6 +389,8 @@ endif
# test modules.
ifeq ($(bind-now),yes)
LDFLAGS-lib.so += -Wl,-z,now
+# Extra flags for dynamically linked non-test main programs.
+link-extra-flags += -Wl,-z,now
endif
# Additional libraries to link into every test.
@@ -405,7 +407,8 @@ ifndef +link-pie
S$(start-installed-name))\
$(+preinit) $(link-extra-libs) \
$(common-objpfx)libc% $(+postinit),$^) \
- $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
+ $(link-extra-libs) $(link-extra-flags) $(link-libc) \
+ $(+postctorS) $(+postinit)
endif
# Command for statically linking programs with the C library.
ifndef +link-static
@@ -419,8 +422,8 @@ ifndef +link-static
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs-static)
+link-static-after-libc = $(+postctorT) $(+postinit)
-+link-static = $(+link-static-before-libc) $(link-libc-static) \
- $(+link-static-after-libc)
++link-static = $(+link-static-before-libc) $(link-extra-flags) \
+ $(link-libc-static) $(+link-static-after-libc)
+link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
$(+link-static-after-libc)
endif
@@ -438,7 +441,8 @@ ifeq (yes,$(build-shared))
$(common-objpfx)libc% $(+postinit),$^) \
$(link-extra-libs)
+link-after-libc = $(+postctor) $(+postinit)
-+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
++link = $(+link-before-libc) $(link-extra-flags) $(link-libc) \
+ $(+link-after-libc)
+link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
else
+link = $(+link-static)
diff --git a/manual/install.texi b/manual/install.texi
index 47d832cc59bc695e..5cacd974ce093ce9 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -161,10 +161,10 @@ so that they can be invoked directly.
Enable lock elision for pthread mutexes by default.
@item --enable-bind-now
-Disable lazy binding for installed shared objects. This provides
-additional security hardening because it enables full RELRO and a
-read-only global offset table (GOT), at the cost of slightly increased
-program load times.
+Disable lazy binding for installed shared objects and programs. This
+provides additional security hardening because it enables full RELRO
+and a read-only global offset table (GOT), at the cost of slightly
+increased program load times.
@pindex pt_chown
@findex grantpt

44
glibc-rh1406732-3.patch Normal file
View file

@ -0,0 +1,44 @@
This patch is based on the following upstream commit:
commit b5ffdc48c20ae865b197b67e5a9068a528fbc198
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Apr 25 10:41:52 2019 +0200
benchtests: Enable BIND_NOW if configured with --enable-bind-now
Benchmarks should reflect distribution build policies, so it makes
sense to honor the BIND_NOW configuration for them.
This commit keeps using $(+link-tests), so that the benchmarks are
linked according to the --enable-hardcoded-path-in-tests configure
option.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 911b6df04cc323ac..bb02d26e1847d424 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -153,12 +153,20 @@ bench-func: $(binaries-bench)
$(PYTHON) scripts/validate_benchout.py $(objpfx)bench.out \
scripts/benchout.schema.json
-$(timing-type) $(binaries-bench) $(binaries-benchset) \
- $(binaries-bench-malloc): %: %.o $(objpfx)json-lib.o \
+ifeq ($(bind-now),yes)
+link-bench-bind-now = -Wl,-z,now
+endif
+
+bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
+ $(binaries-bench-malloc)
+
+$(bench-link-targets): %: %.o $(objpfx)json-lib.o \
$(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
$(+link)
+$(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
+
$(objpfx)bench-%.c: %-inputs $(bench-deps)
{ if [ -n "$($*-INCLUDE)" ]; then \
cat $($*-INCLUDE); \

25
glibc-rh1406732-4.patch Normal file
View file

@ -0,0 +1,25 @@
commit c57afec0a9b318bb691e0f5fa4e9681cf30df7a4
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Apr 26 07:16:56 2019 +0200
elf: Link sotruss-lib.so with BIND_NOW for --enable-bind-now
The audit module itself can be linked with BIND_NOW; it does not
affect its functionality.
This should complete the leftovers from commit
2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix
--enable-bind-now [BZ #21015]").
diff --git a/elf/Makefile b/elf/Makefile
index 2b2662d5cf96c437..cfd039fc9dfb0be7 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -103,6 +103,7 @@ install-others += $(inst_auditdir)/sotruss-lib.so
install-bin-script += sotruss
generated += sotruss
libof-sotruss-lib = extramodules
+LDFLAGS-sotruss-lib.so += $(z-now-$(bind-now))
$(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
$(build-module-asneeded)
$(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \

26
glibc-rh1406732-5.patch Normal file
View file

@ -0,0 +1,26 @@
This patch enables building memusagestat with BIND_NOW enabled.
Upstream, this change was part of the following commit...
commit f9b645b4b0a10c43753296ce3fa40053fa44606a
Author: Mike Frysinger <vapier@gentoo.org>
Date: Wed Apr 24 13:32:22 2019 +0200
memusagestat: use local glibc when linking [BZ #18465]
...but since that commit cannot be backported to RHEL-7, this patch
adds only the BIND_NOW linker flag at the appropriate place instead.
diff --git a/malloc/Makefile b/malloc/Makefile
index 476208cf43d211c9..992cec6b03115a76 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -142,7 +142,7 @@ lib := memusagestat
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
$(objpfx)memusagestat: $(memusagestat-modules:%=$(objpfx)%.o)
- $(LINK.o) -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
+ $(LINK.o) -Wl,-z,now -o $@ $^ $(libgd-LDFLAGS) -lgd -lpng -lz -lm
include ../Rules

43
glibc-rh1406732-6.patch Normal file
View file

@ -0,0 +1,43 @@
This is a downstream only patch for RHEL 7.
See bug 1790475 for the history behind --disable-bind-now for ppc64.
In summary: COPY relocations and BIND_NOW are incompatible on ppc64.
The solution is to globally disable BIND_NOW hardening on ppc64 with
--disable-bind-now and then use a downstream-only patch to partially
enable BIND_NOW hardening for ppc64 to the level of hardening that
works given the toolchain.
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index b11edd77bd2c22d4..47a9e7bcf66a8531 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -1,3 +1,29 @@
+################################################################################
+# Only enabled if we are not building for ppc64le.
+ifeq (,$(filter %le,$(config-machine)))
+# Enable bind-now behaviour by default for POWER. This is a downstream specific
+# change that is required due to a toolchain limitation in handling COPY
+# relocations and BIND_NOW (see rhbz#1790475).
+LDCFLAGS-c.so += -Wl,-z,now
+# Likewise. Take care that this is carefully selected to turn BIND_NOW back on
+# for ld.so without turning it back on for libpthread.so which has the
+# problematic OPD that generates a COPY relocation. Enable these only for the
+# elf subdir which is also used to build libc.so.6. This avoids enabling
+# BIND_NOW for libpthread.
+ifeq ($(subdir),elf)
+z-now-no = -Wl,-z,now
+LDFLAGS-lib.so += -Wl,-z,now
+link-extra-flags += -Wl,-z,now
+endif
+# Likewise. Take care that this is carefully selected to turn BIND_NOW
+# back on for iconv modules to ensure the data-only DSOs have consistently the
+# correct expected flags for DSOs (even if they don't really need them).
+ifeq ($(subdir),iconvdata)
+LDFLAGS.so += -Wl,-z,now
+endif
+endif
+################################################################################
+
ifeq ($(subdir),string)
CFLAGS-memcmp.c += -Wno-uninitialized
endif

423
glibc-rh1414263.patch Normal file
View file

@ -0,0 +1,423 @@
commit 799c8d6905433ad56f26ccab4855b36f1d1ddbfc
Author: Mike FABIAN <mfabian@redhat.com>
Date: Thu Sep 7 15:28:28 2017 +0200
Add new codepage charmaps/IBM858 [BZ #21084]
This code page is identical to code page 850 except that X'D5'
has been changed from LI61 (dotless i) to SC20 (euro symbol).
The code points from /x01 to /x1f in the /localedata/charmaps/IBM858
file have the same mapping as those in localedata/charmaps/ANSI_X3.4-1968.
That means they disagree with with
ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00858.txt
in that range.
For example, localedata/charmaps/IBM858 and localedata/charmaps/ANSI_X3.4-1968 have:
“<U0001> /x01 START OF HEADING (SOH)”
whereas CP00858.txt has:
“01 SS000000 Smiling Face”
That means that CP00858.txt is not really ASCII-compatible and to make
it ASCII-compatible we deviate fro CP00858.txt in the code points from /x01
to /x1f.
[BZ #21084]
* benchtests/strcoll-inputs/filelist#en_US.UTF-8: Add IBM858 and ibm858.c.
* iconvdata/Makefile: Add IBM858.
* iconvdata/gconv-modules: Add IBM858.
* iconvdata/ibm858.c: New file.
* iconvdata/tst-tables.sh: Add IBM858
* localedata/charmaps/IBM858: New file.
# Conflicts:
# benchtests/strcoll-inputs/filelist#en_US.UTF-8
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index c4e6c510d7abc055..7930dcd49d77c818 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -34,9 +34,9 @@ modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
IBM874 CP737 CP775 ISO-2022-KR HP-TURKISH8 HP-THAI8 HP-GREEK8 \
KOI8-R LATIN-GREEK LATIN-GREEK-1 IBM256 IBM273 IBM277 IBM278 \
IBM280 IBM281 IBM284 IBM285 IBM290 IBM297 IBM420 IBM424 \
- IBM437 IBM850 IBM851 IBM852 IBM855 IBM857 IBM860 IBM861 \
- IBM862 IBM863 IBM864 IBM865 IBM868 IBM869 IBM875 IBM880 \
- IBM866 CP1258 IBM922 IBM1124 IBM1129 IBM932 IBM943 \
+ IBM437 IBM850 IBM851 IBM852 IBM855 IBM857 IBM858 IBM860 \
+ IBM861 IBM862 IBM863 IBM864 IBM865 IBM868 IBM869 IBM875 \
+ IBM880 IBM866 CP1258 IBM922 IBM1124 IBM1129 IBM932 IBM943 \
IBM856 IBM930 IBM933 IBM935 IBM937 IBM939 IBM1046 \
IBM1132 IBM1133 IBM1160 IBM1161 IBM1162 IBM1163 IBM1164 \
IBM918 IBM1004 IBM1026 CP1125 CP1250 CP1251 CP1252 CP1253 \
@@ -148,11 +148,11 @@ gen-8bit-modules := iso8859-2 iso8859-3 iso8859-4 iso8859-6 iso8859-9 koi-8 \
gen-8bit-gap-modules := koi8-r latin-greek latin-greek-1 ibm256 ibm273 \
ibm277 ibm278 ibm280 ibm281 ibm284 ibm285 ibm290 \
ibm297 ibm420 ibm424 ibm437 ibm850 ibm851 ibm852 \
- ibm855 ibm857 ibm860 ibm861 ibm862 ibm863 ibm864 \
- ibm865 ibm868 ibm869 ibm875 ibm880 ibm918 ibm1004 \
- ibm1026 cp1125 cp1250 cp1251 cp1252 cp1253 cp1254 \
- cp1256 cp1257 ibm866 iso8859-5 iso8859-7 iso8859-8 \
- iso8859-10 macintosh iec_p27-1 asmo_449 \
+ ibm855 ibm857 ibm858 ibm860 ibm861 ibm862 ibm863 \
+ ibm864 ibm865 ibm868 ibm869 ibm875 ibm880 ibm918 \
+ ibm1004 ibm1026 cp1125 cp1250 cp1251 cp1252 cp1253 \
+ cp1254 cp1256 cp1257 ibm866 iso8859-5 iso8859-7 \
+ iso8859-8 iso8859-10 macintosh iec_p27-1 asmo_449 \
csn_369103 cwi dec-mcs ecma-cyrillic gost_19768-74 \
greek-ccitt greek7 greek7-old inis inis-8 \
inis-cyrillic iso_2033 iso_5427 iso_5427-ext \
diff --git a/iconvdata/gconv-modules b/iconvdata/gconv-modules
index d640ea4eadab2382..039b1b5b385619a8 100644
--- a/iconvdata/gconv-modules
+++ b/iconvdata/gconv-modules
@@ -743,6 +743,13 @@ alias OSF10020352// IBM850//
module IBM850// INTERNAL IBM850 1
module INTERNAL IBM850// IBM850 1
+# from to module cost
+alias CP858// IBM858//
+alias 858// IBM858//
+alias CSPC858MULTILINGUAL// IBM858//
+module IBM858// INTERNAL IBM858 1
+module INTERNAL IBM858// IBM858 1
+
# from to module cost
alias CP851// IBM851//
alias 851// IBM851//
diff --git a/iconvdata/ibm858.c b/iconvdata/ibm858.c
new file mode 100644
index 0000000000000000..ed2a48e3cf79e2b9
--- /dev/null
+++ b/iconvdata/ibm858.c
@@ -0,0 +1,27 @@
+/* Conversion from and to IBM858.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdint.h>
+
+/* Get the conversion table. */
+#define TABLES <ibm858.h>
+
+#define CHARSET_NAME "IBM858//"
+#define HAS_HOLES 1 /* Not all 256 character are defined. */
+
+#include <8bit-gap.c>
diff --git a/iconvdata/tst-tables.sh b/iconvdata/tst-tables.sh
index 77d9d182c7dc2205..2ee6cf0d0b25961b 100755
--- a/iconvdata/tst-tables.sh
+++ b/iconvdata/tst-tables.sh
@@ -125,6 +125,7 @@ cat <<EOF |
IBM855
IBM856
IBM857
+ IBM858
IBM860
IBM861
IBM862
diff --git a/localedata/charmaps/IBM858 b/localedata/charmaps/IBM858
new file mode 100644
index 0000000000000000..d8600e2456c87b48
--- /dev/null
+++ b/localedata/charmaps/IBM858
@@ -0,0 +1,281 @@
+<code_set_name> IBM858
+<comment_char> %
+<escape_char> /
+% version: 1.0
+% source: ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00858.txt, 1998
+
+% source: UNICODE 1.0
+
+% This code page is identical to code page 850 except that X'D5'
+% has been changed from LI61 (dotless i) to SC20 (euro symbol).
+
+% The code points from /x01 to /x1f in this file have the same mapping
+% as those in ANSI_X3.4-1968. That means they disagree with with CP00858.txt
+% in that range. For example, this file and ANSI_X3.4-1968 have:
+% “<U0001> /x01 START OF HEADING (SOH)”
+% whereas CP00858.txt has:
+% “01 SS000000 Smiling Face”
+% That means that CP00858.txt is not really ASCII-compatible and to make
+% it ASCII-compatible we deviate fro CP00858.txt in the code points from /x01
+% to /x1f.
+
+% alias CP858
+% alias 858
+CHARMAP
+<U0000> /x00 NULL (NUL)
+<U0001> /x01 START OF HEADING (SOH)
+<U0002> /x02 START OF TEXT (STX)
+<U0003> /x03 END OF TEXT (ETX)
+<U0004> /x04 END OF TRANSMISSION (EOT)
+<U0005> /x05 ENQUIRY (ENQ)
+<U0006> /x06 ACKNOWLEDGE (ACK)
+<U0007> /x07 BELL (BEL)
+<U0008> /x08 BACKSPACE (BS)
+<U0009> /x09 CHARACTER TABULATION (HT)
+<U000A> /x0a LINE FEED (LF)
+<U000B> /x0b LINE TABULATION (VT)
+<U000C> /x0c FORM FEED (FF)
+<U000D> /x0d CARRIAGE RETURN (CR)
+<U000E> /x0e SHIFT OUT (SO)
+<U000F> /x0f SHIFT IN (SI)
+<U0010> /x10 DATALINK ESCAPE (DLE)
+<U0011> /x11 DEVICE CONTROL ONE (DC1)
+<U0012> /x12 DEVICE CONTROL TWO (DC2)
+<U0013> /x13 DEVICE CONTROL THREE (DC3)
+<U0014> /x14 DEVICE CONTROL FOUR (DC4)
+<U0015> /x15 NEGATIVE ACKNOWLEDGE (NAK)
+<U0016> /x16 SYNCHRONOUS IDLE (SYN)
+<U0017> /x17 END OF TRANSMISSION BLOCK (ETB)
+<U0018> /x18 CANCEL (CAN)
+<U0019> /x19 END OF MEDIUM (EM)
+<U001A> /x1a SUBSTITUTE (SUB)
+<U001B> /x1b ESCAPE (ESC)
+<U001C> /x1c FILE SEPARATOR (IS4)
+<U001D> /x1d GROUP SEPARATOR (IS3)
+<U001E> /x1e RECORD SEPARATOR (IS2)
+<U001F> /x1f UNIT SEPARATOR (IS1)
+<U0020> /x20 SPACE
+<U0021> /x21 EXCLAMATION MARK
+<U0022> /x22 QUOTATION MARK
+<U0023> /x23 NUMBER SIGN
+<U0024> /x24 DOLLAR SIGN
+<U0025> /x25 PERCENT SIGN
+<U0026> /x26 AMPERSAND
+<U0027> /x27 APOSTROPHE
+<U0028> /x28 LEFT PARENTHESIS
+<U0029> /x29 RIGHT PARENTHESIS
+<U002A> /x2a ASTERISK
+<U002B> /x2b PLUS SIGN
+<U002C> /x2c COMMA
+<U002D> /x2d HYPHEN-MINUS
+<U002E> /x2e FULL STOP
+<U002F> /x2f SOLIDUS
+<U0030> /x30 DIGIT ZERO
+<U0031> /x31 DIGIT ONE
+<U0032> /x32 DIGIT TWO
+<U0033> /x33 DIGIT THREE
+<U0034> /x34 DIGIT FOUR
+<U0035> /x35 DIGIT FIVE
+<U0036> /x36 DIGIT SIX
+<U0037> /x37 DIGIT SEVEN
+<U0038> /x38 DIGIT EIGHT
+<U0039> /x39 DIGIT NINE
+<U003A> /x3a COLON
+<U003B> /x3b SEMICOLON
+<U003C> /x3c LESS-THAN SIGN
+<U003D> /x3d EQUALS SIGN
+<U003E> /x3e GREATER-THAN SIGN
+<U003F> /x3f QUESTION MARK
+<U0040> /x40 COMMERCIAL AT
+<U0041> /x41 LATIN CAPITAL LETTER A
+<U0042> /x42 LATIN CAPITAL LETTER B
+<U0043> /x43 LATIN CAPITAL LETTER C
+<U0044> /x44 LATIN CAPITAL LETTER D
+<U0045> /x45 LATIN CAPITAL LETTER E
+<U0046> /x46 LATIN CAPITAL LETTER F
+<U0047> /x47 LATIN CAPITAL LETTER G
+<U0048> /x48 LATIN CAPITAL LETTER H
+<U0049> /x49 LATIN CAPITAL LETTER I
+<U004A> /x4a LATIN CAPITAL LETTER J
+<U004B> /x4b LATIN CAPITAL LETTER K
+<U004C> /x4c LATIN CAPITAL LETTER L
+<U004D> /x4d LATIN CAPITAL LETTER M
+<U004E> /x4e LATIN CAPITAL LETTER N
+<U004F> /x4f LATIN CAPITAL LETTER O
+<U0050> /x50 LATIN CAPITAL LETTER P
+<U0051> /x51 LATIN CAPITAL LETTER Q
+<U0052> /x52 LATIN CAPITAL LETTER R
+<U0053> /x53 LATIN CAPITAL LETTER S
+<U0054> /x54 LATIN CAPITAL LETTER T
+<U0055> /x55 LATIN CAPITAL LETTER U
+<U0056> /x56 LATIN CAPITAL LETTER V
+<U0057> /x57 LATIN CAPITAL LETTER W
+<U0058> /x58 LATIN CAPITAL LETTER X
+<U0059> /x59 LATIN CAPITAL LETTER Y
+<U005A> /x5a LATIN CAPITAL LETTER Z
+<U005B> /x5b LEFT SQUARE BRACKET
+<U005C> /x5c REVERSE SOLIDUS
+<U005D> /x5d RIGHT SQUARE BRACKET
+<U005E> /x5e CIRCUMFLEX ACCENT
+<U005F> /x5f LOW LINE
+<U0060> /x60 GRAVE ACCENT
+<U0061> /x61 LATIN SMALL LETTER A
+<U0062> /x62 LATIN SMALL LETTER B
+<U0063> /x63 LATIN SMALL LETTER C
+<U0064> /x64 LATIN SMALL LETTER D
+<U0065> /x65 LATIN SMALL LETTER E
+<U0066> /x66 LATIN SMALL LETTER F
+<U0067> /x67 LATIN SMALL LETTER G
+<U0068> /x68 LATIN SMALL LETTER H
+<U0069> /x69 LATIN SMALL LETTER I
+<U006A> /x6a LATIN SMALL LETTER J
+<U006B> /x6b LATIN SMALL LETTER K
+<U006C> /x6c LATIN SMALL LETTER L
+<U006D> /x6d LATIN SMALL LETTER M
+<U006E> /x6e LATIN SMALL LETTER N
+<U006F> /x6f LATIN SMALL LETTER O
+<U0070> /x70 LATIN SMALL LETTER P
+<U0071> /x71 LATIN SMALL LETTER Q
+<U0072> /x72 LATIN SMALL LETTER R
+<U0073> /x73 LATIN SMALL LETTER S
+<U0074> /x74 LATIN SMALL LETTER T
+<U0075> /x75 LATIN SMALL LETTER U
+<U0076> /x76 LATIN SMALL LETTER V
+<U0077> /x77 LATIN SMALL LETTER W
+<U0078> /x78 LATIN SMALL LETTER X
+<U0079> /x79 LATIN SMALL LETTER Y
+<U007A> /x7a LATIN SMALL LETTER Z
+<U007B> /x7b LEFT CURLY BRACKET
+<U007C> /x7c VERTICAL LINE
+<U007D> /x7d RIGHT CURLY BRACKET
+<U007E> /x7e TILDE
+<U007F> /x7f DELETE (DEL)
+<U00C7> /x80 LATIN CAPITAL LETTER C WITH CEDILLA
+<U00FC> /x81 LATIN SMALL LETTER U WITH DIAERESIS
+<U00E9> /x82 LATIN SMALL LETTER E WITH ACUTE
+<U00E2> /x83 LATIN SMALL LETTER A WITH CIRCUMFLEX
+<U00E4> /x84 LATIN SMALL LETTER A WITH DIAERESIS
+<U00E0> /x85 LATIN SMALL LETTER A WITH GRAVE
+<U00E5> /x86 LATIN SMALL LETTER A WITH RING ABOVE
+<U00E7> /x87 LATIN SMALL LETTER C WITH CEDILLA
+<U00EA> /x88 LATIN SMALL LETTER E WITH CIRCUMFLEX
+<U00EB> /x89 LATIN SMALL LETTER E WITH DIAERESIS
+<U00E8> /x8a LATIN SMALL LETTER E WITH GRAVE
+<U00EF> /x8b LATIN SMALL LETTER I WITH DIAERESIS
+<U00EE> /x8c LATIN SMALL LETTER I WITH CIRCUMFLEX
+<U00EC> /x8d LATIN SMALL LETTER I WITH GRAVE
+<U00C4> /x8e LATIN CAPITAL LETTER A WITH DIAERESIS
+<U00C5> /x8f LATIN CAPITAL LETTER A WITH RING ABOVE
+<U00C9> /x90 LATIN CAPITAL LETTER E WITH ACUTE
+<U00E6> /x91 LATIN SMALL LETTER AE
+<U00C6> /x92 LATIN CAPITAL LETTER AE
+<U00F4> /x93 LATIN SMALL LETTER O WITH CIRCUMFLEX
+<U00F6> /x94 LATIN SMALL LETTER O WITH DIAERESIS
+<U00F2> /x95 LATIN SMALL LETTER O WITH GRAVE
+<U00FB> /x96 LATIN SMALL LETTER U WITH CIRCUMFLEX
+<U00F9> /x97 LATIN SMALL LETTER U WITH GRAVE
+<U00FF> /x98 LATIN SMALL LETTER Y WITH DIAERESIS
+<U00D6> /x99 LATIN CAPITAL LETTER O WITH DIAERESIS
+<U00DC> /x9a LATIN CAPITAL LETTER U WITH DIAERESIS
+<U00F8> /x9b LATIN SMALL LETTER O WITH STROKE
+<U00A3> /x9c POUND SIGN
+<U00D8> /x9d LATIN CAPITAL LETTER O WITH STROKE
+<U00D7> /x9e MULTIPLICATION SIGN
+<U0192> /x9f LATIN SMALL LETTER F WITH HOOK
+<U00E1> /xa0 LATIN SMALL LETTER A WITH ACUTE
+<U00ED> /xa1 LATIN SMALL LETTER I WITH ACUTE
+<U00F3> /xa2 LATIN SMALL LETTER O WITH ACUTE
+<U00FA> /xa3 LATIN SMALL LETTER U WITH ACUTE
+<U00F1> /xa4 LATIN SMALL LETTER N WITH TILDE
+<U00D1> /xa5 LATIN CAPITAL LETTER N WITH TILDE
+<U00AA> /xa6 FEMININE ORDINAL INDICATOR
+<U00BA> /xa7 MASCULINE ORDINAL INDICATOR
+<U00BF> /xa8 INVERTED QUESTION MARK
+<U00AE> /xa9 REGISTERED SIGN
+<U00AC> /xaa NOT SIGN
+<U00BD> /xab VULGAR FRACTION ONE HALF
+<U00BC> /xac VULGAR FRACTION ONE QUARTER
+<U00A1> /xad INVERTED EXCLAMATION MARK
+<U00AB> /xae LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+<U00BB> /xaf RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+<U2591> /xb0 LIGHT SHADE
+<U2592> /xb1 MEDIUM SHADE
+<U2593> /xb2 DARK SHADE
+<U2502> /xb3 BOX DRAWINGS LIGHT VERTICAL
+<U2524> /xb4 BOX DRAWINGS LIGHT VERTICAL AND LEFT
+<U00C1> /xb5 LATIN CAPITAL LETTER A WITH ACUTE
+<U00C2> /xb6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+<U00C0> /xb7 LATIN CAPITAL LETTER A WITH GRAVE
+<U00A9> /xb8 COPYRIGHT SIGN
+<U2563> /xb9 BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+<U2551> /xba BOX DRAWINGS DOUBLE VERTICAL
+<U2557> /xbb BOX DRAWINGS DOUBLE DOWN AND LEFT
+<U255D> /xbc BOX DRAWINGS DOUBLE UP AND LEFT
+<U00A2> /xbd CENT SIGN
+<U00A5> /xbe YEN SIGN
+<U2510> /xbf BOX DRAWINGS LIGHT DOWN AND LEFT
+<U2514> /xc0 BOX DRAWINGS LIGHT UP AND RIGHT
+<U2534> /xc1 BOX DRAWINGS LIGHT UP AND HORIZONTAL
+<U252C> /xc2 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+<U251C> /xc3 BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+<U2500> /xc4 BOX DRAWINGS LIGHT HORIZONTAL
+<U253C> /xc5 BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+<U00E3> /xc6 LATIN SMALL LETTER A WITH TILDE
+<U00C3> /xc7 LATIN CAPITAL LETTER A WITH TILDE
+<U255A> /xc8 BOX DRAWINGS DOUBLE UP AND RIGHT
+<U2554> /xc9 BOX DRAWINGS DOUBLE DOWN AND RIGHT
+<U2569> /xca BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+<U2566> /xcb BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+<U2560> /xcc BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+<U2550> /xcd BOX DRAWINGS DOUBLE HORIZONTAL
+<U256C> /xce BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+<U00A4> /xcf CURRENCY SIGN
+<U00F0> /xd0 LATIN SMALL LETTER ETH (Icelandic)
+<U00D0> /xd1 LATIN CAPITAL LETTER ETH (Icelandic)
+<U00CA> /xd2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+<U00CB> /xd3 LATIN CAPITAL LETTER E WITH DIAERESIS
+<U00C8> /xd4 LATIN CAPITAL LETTER E WITH GRAVE
+<U20AC> /xd5 EURO SIGN
+<U00CD> /xd6 LATIN CAPITAL LETTER I WITH ACUTE
+<U00CE> /xd7 LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+<U00CF> /xd8 LATIN CAPITAL LETTER I WITH DIAERESIS
+<U2518> /xd9 BOX DRAWINGS LIGHT UP AND LEFT
+<U250C> /xda BOX DRAWINGS LIGHT DOWN AND RIGHT
+<U2588> /xdb FULL BLOCK
+<U2584> /xdc LOWER HALF BLOCK
+<U00A6> /xdd BROKEN BAR
+<U00CC> /xde LATIN CAPITAL LETTER I WITH GRAVE
+<U2580> /xdf UPPER HALF BLOCK
+<U00D3> /xe0 LATIN CAPITAL LETTER O WITH ACUTE
+<U00DF> /xe1 LATIN SMALL LETTER SHARP S (German)
+<U00D4> /xe2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+<U00D2> /xe3 LATIN CAPITAL LETTER O WITH GRAVE
+<U00F5> /xe4 LATIN SMALL LETTER O WITH TILDE
+<U00D5> /xe5 LATIN CAPITAL LETTER O WITH TILDE
+<U00B5> /xe6 MICRO SIGN
+<U00FE> /xe7 LATIN SMALL LETTER THORN (Icelandic)
+<U00DE> /xe8 LATIN CAPITAL LETTER THORN (Icelandic)
+<U00DA> /xe9 LATIN CAPITAL LETTER U WITH ACUTE
+<U00DB> /xea LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+<U00D9> /xeb LATIN CAPITAL LETTER U WITH GRAVE
+<U00FD> /xec LATIN SMALL LETTER Y WITH ACUTE
+<U00DD> /xed LATIN CAPITAL LETTER Y WITH ACUTE
+<U00AF> /xee MACRON
+<U00B4> /xef ACUTE ACCENT
+<U00AD> /xf0 SOFT HYPHEN
+<U00B1> /xf1 PLUS-MINUS SIGN
+<U2017> /xf2 DOUBLE LOW LINE
+<U00BE> /xf3 VULGAR FRACTION THREE QUARTERS
+<U00B6> /xf4 PILCROW SIGN
+<U00A7> /xf5 SECTION SIGN
+<U00F7> /xf6 DIVISION SIGN
+<U00B8> /xf7 CEDILLA
+<U00B0> /xf8 DEGREE SIGN
+<U00A8> /xf9 DIAERESIS
+<U00B7> /xfa MIDDLE DOT
+<U00B9> /xfb SUPERSCRIPT ONE
+<U00B3> /xfc SUPERSCRIPT THREE
+<U00B2> /xfd SUPERSCRIPT TWO
+<U25A0> /xfe BLACK SQUARE
+<U00A0> /xff NO-BREAK SPACE
+END CHARMAP

41
glibc-rh1451308.patch Normal file
View file

@ -0,0 +1,41 @@
commit d62aa75af1941fca6f07e107afc447b7b248e340
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Jul 10 14:15:16 2014 +0530
Fix crash when system has no ipv6 address [BZ #17125]
Here's an updated patch to fix the crash in bug-ga2 when the system
has no configured ipv6 address. I have taken a different approach of
using libc_freeres_fn instead of the libc_freeres_ptr since the former
gives better control over what is freed; we need that since cache may
or may not be allocated using malloc.
Verified that bug-ga2 works correctly in both cases and does not have
memory leaks in either of them.
diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
index 6b28a735a14f1498..757853342d2af5f4 100644
--- a/sysdeps/unix/sysv/linux/check_pf.c
+++ b/sysdeps/unix/sysv/linux/check_pf.c
@@ -62,7 +62,7 @@ static struct cached_data noai6ai_cached =
.in6ailen = 0
};
-libc_freeres_ptr (static struct cached_data *cache);
+static struct cached_data *cache;
__libc_lock_define_initialized (static, lock);
@@ -378,6 +378,12 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6,
*seen_ipv6 = true;
}
+/* Free the cache if it has been allocated. */
+libc_freeres_fn (freecache)
+{
+ if (cache)
+ __free_in6ai (cache->in6ai);
+}
void
__free_in6ai (struct in6addrinfo *ai)

30
glibc-rh1484832.patch Normal file
View file

@ -0,0 +1,30 @@
commit 273cdee86d86e107c0eecef5614f57e37567b54e
Author: Andreas Schwab <schwab@suse.de>
Date: Tue Jan 15 16:39:07 2013 +0100
Fix invalid free of memory allocated during rtld init
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 013efdb3814700d3..6a0005da502c8f37 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -822,6 +822,9 @@ _dl_init_paths (const char *llp)
(const void *) (D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_RUNPATH]->d_un.d_val),
l, "RUNPATH");
+ /* During rtld init the memory is allocated by the stub malloc,
+ prevent any attempt to free it by the normal malloc. */
+ l->l_runpath_dirs.malloced = 0;
/* The RPATH is ignored. */
l->l_rpath_dirs.dirs = (void *) -1;
@@ -838,6 +841,9 @@ _dl_init_paths (const char *llp)
(const void *) (D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_RPATH]->d_un.d_val),
l, "RPATH");
+ /* During rtld init the memory is allocated by the stub
+ malloc, prevent any attempt to free it by the normal
+ malloc. */
l->l_rpath_dirs.malloced = 0;
}
else

112
glibc-rh1579451.patch Normal file
View file

@ -0,0 +1,112 @@
[RHBZ #1579451]
This is a backport of the following two upstream patches:
commit 31545c23277cd54a1edd41c85d8255fb589158e3
Author: Joseph Myers <joseph@codesourcery.com>
Date: Mon Jun 29 14:38:46 2015 +0000
Update headers for Linux 4.0, 4.1 definitions.
This patch updates installed glibc headers for new definitions from
Linux 4.0 and 4.1 that seem relevant to glibc headers. In addition, I
noticed that PF_IB / AF_IB, added in Linux 3.11, were missing for no
obvious reason, so added those as well.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* sysdeps/unix/sysv/linux/bits/in.h (IP_CHECKSUM): New macro.
* sysdeps/unix/sysv/linux/bits/socket.h (PF_IB): Likewise.
(PF_MPLS): Likewise.
(AF_IB): Likewise.
(AF_MPLS): Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h (MS_LAZYTIME): New enum
value and macro.
(MS_RMT_MASK): Include MS_LAZYTIME.
commit 04d9a38bafddb92ab79bc0015533689e15848522
Author: Joseph Myers <joseph@codesourcery.com>
Date: Tue Sep 1 13:47:25 2015 +0000
Add netinet/in.h values from Linux 4.2.
This patch adds new constants from Linux 4.2 to netinet/in.h:
IPPROTO_MPLS and IP_BIND_ADDRESS_NO_PORT (both in
include/uapi/linux/in.h in Linux; one directly in netinet/in.h, one in
bits/in.h in glibc).
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).
* inet/netinet/in.h (IPPROTO_MPLS): New enum value and macro.
* sysdeps/unix/sysv/linux/bits/in.h (IP_BIND_ADDRESS_NO_PORT): New
macro.
diff -Nrup a/inet/netinet/in.h b/inet/netinet/in.h
--- a/inet/netinet/in.h 2019-07-30 12:03:33.082066705 -0400
+++ b/inet/netinet/in.h 2019-07-30 12:22:54.461572719 -0400
@@ -86,6 +86,8 @@ enum
#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
#define IPPROTO_UDPLITE IPPROTO_UDPLITE
+ IPPROTO_MPLS = 137, /* MPLS in IP. */
+#define IPPROTO_MPLS IPPROTO_MPLS
IPPROTO_RAW = 255, /* Raw IP packets. */
#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_MAX
diff -Nrup a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
--- a/sysdeps/unix/sysv/linux/bits/in.h 2019-07-30 12:03:35.863052019 -0400
+++ b/sysdeps/unix/sysv/linux/bits/in.h 2019-07-30 12:51:15.293703728 -0400
@@ -99,6 +99,8 @@
#define IP_MINTTL 21
#define IP_NODEFRAG 22
+#define IP_CHECKSUM 23
+#define IP_BIND_ADDRESS_NO_PORT 24
/* IP_MTU_DISCOVER arguments. */
#define IP_PMTUDISC_DONT 0 /* Never send DF frames. */
diff -Nrup a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
--- a/sysdeps/unix/sysv/linux/bits/socket.h 2019-07-30 12:03:33.757063141 -0400
+++ b/sysdeps/unix/sysv/linux/bits/socket.h 2019-07-30 12:54:02.612870856 -0400
@@ -69,6 +69,8 @@ typedef __socklen_t socklen_t;
#define PF_PPPOX 24 /* PPPoX sockets. */
#define PF_WANPIPE 25 /* Wanpipe API sockets. */
#define PF_LLC 26 /* Linux LLC. */
+#define PF_IB 27 /* Native InfiniBand address. */
+#define PF_MPLS 28 /* MPLS. */
#define PF_CAN 29 /* Controller Area Network. */
#define PF_TIPC 30 /* TIPC sockets. */
#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
@@ -114,6 +116,8 @@ typedef __socklen_t socklen_t;
#define AF_PPPOX PF_PPPOX
#define AF_WANPIPE PF_WANPIPE
#define AF_LLC PF_LLC
+#define AF_IB PF_IB
+#define AF_MPLS PF_MPLS
#define AF_CAN PF_CAN
#define AF_TIPC PF_TIPC
#define AF_BLUETOOTH PF_BLUETOOTH
diff -Nrup a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h
--- a/sysdeps/unix/sysv/linux/sys/mount.h 2012-12-24 22:02:13.000000000 -0500
+++ b/sysdeps/unix/sysv/linux/sys/mount.h 2019-07-30 12:58:23.595571750 -0400
@@ -78,6 +78,8 @@ enum
#define MS_I_VERSION MS_I_VERSION
MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
#define MS_STRICTATIME MS_STRICTATIME
+ MS_LAZYTIME = 1 << 25, /* Update the on-disk [acm]times lazily. */
+#define MS_LAZYTIME MS_LAZYTIME
MS_ACTIVE = 1 << 30,
#define MS_ACTIVE MS_ACTIVE
MS_NOUSER = 1 << 31
@@ -85,7 +87,8 @@ enum
};
/* Flags that can be altered by MS_REMOUNT */
-#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION \
+ |MS_LAZYTIME)
/* Magic mount flag number. Has to be or-ed to the flag values. */

View file

@ -17,7 +17,7 @@ Date: Fri Jun 1 10:43:06 2018 +0200
(cherry picked from commit 4e8a6346cd3da2d88bbad745a1769260d36f2783) (cherry picked from commit 4e8a6346cd3da2d88bbad745a1769260d36f2783)
Backported from the upstream release/2.26/master branch. Backported from the upstream release/2.27/master branch.
diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c diff --git a/debug/vasprintf_chk.c b/debug/vasprintf_chk.c
index a8ca32bad57b4d13..113354749ccf8d9a 100644 index a8ca32bad57b4d13..113354749ccf8d9a 100644

View file

@ -6,7 +6,7 @@ Date: Tue Jul 3 15:54:49 2018 +0200
(cherry picked from commit c402355dfa7807b8e0adb27c009135a7e2b9f1b0) (cherry picked from commit c402355dfa7807b8e0adb27c009135a7e2b9f1b0)
Backported from the upstream release/2.26/master branch. Backported from the upstream release/2.27/master branch.
diff --git a/libio/vtables.c b/libio/vtables.c diff --git a/libio/vtables.c b/libio/vtables.c
index e364ea03edbfa75b..d6478e4bab9050ce 100644 index e364ea03edbfa75b..d6478e4bab9050ce 100644

View file

@ -9,7 +9,7 @@ Date: Tue Jul 3 17:57:14 2018 +0200
Some adjustments were needed for a tricky multi-inclusion issue related Some adjustments were needed for a tricky multi-inclusion issue related
to libioP.h. to libioP.h.
Backported from the upsteam release/2.26/master branch, adjusted for Backported from the upsteam release/2.27/master branch, adjusted for
lack of tests-internal support downstream. lack of tests-internal support downstream.
diff --git a/libio/Makefile b/libio/Makefile diff --git a/libio/Makefile b/libio/Makefile

19
glibc-rh1634021.patch Normal file
View file

@ -0,0 +1,19 @@
commit 8ec3f656d6edf6f16216105131fc8b0542216a5b
Author: Andreas Schwab <schwab@suse.de>
Date: Mon Nov 11 12:24:42 2013 +0100
Fix off-by-one in nscd getservbyport call
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
index c9c890c..7728258 100644
--- a/nscd/nscd_getserv_r.c
+++ b/nscd/nscd_getserv_r.c
@@ -54,7 +54,7 @@ __nscd_getservbyport_r (int port, const char *proto,
portstr[sizeof (portstr) - 1] = '\0';
char *cp = _itoa_word (port, portstr + sizeof (portstr) - 1, 10, 0);
- return nscd_getserv_r (cp, portstr + sizeof (portstr) - cp, proto,
+ return nscd_getserv_r (cp, portstr + sizeof (portstr) - 1 - cp, proto,
GETSERVBYPORT, result_buf, buf, buflen, result);
}

1316
glibc-rh1636229-1.patch Normal file

File diff suppressed because it is too large Load diff

196
glibc-rh1636229-2.patch Normal file
View file

@ -0,0 +1,196 @@
commit a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f
Author: DJ Delorie <dj@redhat.com>
Date: Thu Aug 17 17:58:25 2017 -0400
Update nss tests to new skeleton
* bug17079.c: Update to new test harness.
* test-digits-dots.c: Likewise.
* test-netdb.c: Likewise.
* tst-field.c: Likewise.
* tst-nss-getpwent.c: Likewise.
* tst-nss-static.c: Likewise.
* tst-nss-test1.c: Likewise.
* tst-nss-test2.c: Likewise.
* tst-nss-test3.c: Likewise.
* tst-nss-test4.c: Likewise.
* tst-nss-test5.c: Likewise.
Partial port of this patch - tst-field.c changes not ported.
diff --git a/nss/bug17079.c b/nss/bug17079.c
index 4171c7db55..09d33f018c 100644
--- a/nss/bug17079.c
+++ b/nss/bug17079.c
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <string.h>
+#include <support/support.h>
+
/* Check if two passwd structs contain the same data. */
static bool
equal (const struct passwd *a, const struct passwd *b)
@@ -52,13 +54,13 @@ init_test_items (void)
if (pwd == NULL)
break;
struct passwd *target = test_items + test_count;
- target->pw_name = strdup (pwd->pw_name);
- target->pw_passwd = strdup (pwd->pw_passwd);
+ target->pw_name = xstrdup (pwd->pw_name);
+ target->pw_passwd = xstrdup (pwd->pw_passwd);
target->pw_uid = pwd->pw_uid;
target->pw_gid = pwd->pw_gid;
- target->pw_gecos = strdup (pwd->pw_gecos);
- target->pw_dir = strdup (pwd->pw_dir);
- target->pw_shell = strdup (pwd->pw_shell);
+ target->pw_gecos = xstrdup (pwd->pw_gecos);
+ target->pw_dir = xstrdup (pwd->pw_dir);
+ target->pw_shell = xstrdup (pwd->pw_shell);
}
while (++test_count < MAX_TEST_ITEMS);
endpwent ();
@@ -108,13 +110,7 @@ static void
test_one (const struct passwd *item, size_t buffer_size,
char pad, size_t padding_size)
{
- char *buffer = malloc (buffer_size + padding_size);
- if (buffer == NULL)
- {
- puts ("error: malloc failure");
- errors = true;
- return;
- }
+ char *buffer = xmalloc (buffer_size + padding_size);
struct passwd pwd;
struct passwd *result;
@@ -240,5 +236,4 @@ do_test (void)
return 0;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/test-digits-dots.c b/nss/test-digits-dots.c
index 2685161e65..5b898a932d 100644
--- a/nss/test-digits-dots.c
+++ b/nss/test-digits-dots.c
@@ -21,6 +21,8 @@
#include <netdb.h>
#include <errno.h>
+#include <support/support.h>
+
static int
do_test (void)
{
@@ -34,5 +36,4 @@ do_test (void)
return err == ERANGE && h_err == NETDB_INTERNAL ? EXIT_SUCCESS : EXIT_FAILURE;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-static.c b/nss/tst-nss-static.c
index 98cf073deb..6c3dc07622 100644
--- a/nss/tst-nss-static.c
+++ b/nss/tst-nss-static.c
@@ -1,7 +1,8 @@
/* glibc test for static NSS. */
#include <stdio.h>
-#define TEST_FUNCTION do_test ()
+#include <support/support.h>
+
static int
do_test (void)
{
@@ -12,4 +13,4 @@ do_test (void)
}
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-test2.c b/nss/tst-nss-test2.c
index 11c2edf118..ac45d58c4b 100644
--- a/nss/tst-nss-test2.c
+++ b/nss/tst-nss-test2.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
+#include <support/support.h>
+
#include "nss_test.h"
/* The data in these tables is arbitrary, but the merged data based on
@@ -132,5 +134,4 @@ do_test (void)
return retval;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-test3.c b/nss/tst-nss-test3.c
index 308708f387..5098aae67b 100644
--- a/nss/tst-nss-test3.c
+++ b/nss/tst-nss-test3.c
@@ -20,7 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/signal.h>
+
+#include <support/support.h>
#include "nss_test.h"
@@ -146,5 +147,4 @@ do_test (void)
}
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-test4.c b/nss/tst-nss-test4.c
index 731e0ed10a..6e0ac84acc 100644
--- a/nss/tst-nss-test4.c
+++ b/nss/tst-nss-test4.c
@@ -20,7 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/signal.h>
+
+#include <support/support.h>
#include "nss_test.h"
@@ -133,5 +134,4 @@ do_test (void)
}
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-test5.c b/nss/tst-nss-test5.c
index fef41f08df..8f02cb7779 100644
--- a/nss/tst-nss-test5.c
+++ b/nss/tst-nss-test5.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
+#include <support/support.h>
+
#include "nss_test.h"
/* The specific values and names used here are arbitrary, other than
@@ -104,5 +106,4 @@ do_test (void)
}
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>

294
glibc-rh1636229-3.patch Normal file
View file

@ -0,0 +1,294 @@
This file contains the reworked/backported sections from these two
upstream commits:
commit ae5c498d93d049d9574d3f8f18e62cac64cbdf5c
Author: DJ Delorie <dj@delorie.com>
Date: Mon Jul 17 15:50:43 2017 -0400
Extend NSS test suite
commit a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f
Author: DJ Delorie <dj@redhat.com>
Date: Thu Aug 17 17:58:25 2017 -0400
Update nss tests to new skeleton
diff -Nrup a/nss/Makefile b/nss/Makefile
--- a/nss/Makefile 2019-07-29 22:25:16.482170120 -0400
+++ b/nss/Makefile 2019-07-29 22:37:05.675342258 -0400
@@ -38,8 +38,14 @@ install-bin := getent makedb
makedb-modules = xmalloc hash-string
extra-objs += $(makedb-modules:=.o)
-tests = test-netdb tst-nss-test1 bug17079 tst-nss-getpwent \
- test-digits-dots tst-nss-files-hosts-erange
+tests = test-netdb test-digits-dots tst-nss-getpwent bug17079 \
+ tst-nss-files-hosts-erange \
+ tst-nss-test1 \
+ tst-nss-test2 \
+ tst-nss-test3 \
+ tst-nss-test4 \
+ tst-nss-test5
+
xtests = bug-erange
include ../Makeconfig
@@ -80,6 +86,8 @@ tests-static = tst-nss-static
tests += $(tests-static)
endif
+extra-test-objs += nss_test1.os nss_test2.os
+
include ../Rules
ifeq (yes,$(have-selinux))
@@ -107,13 +115,28 @@ $(objpfx)makedb: $(makedb-modules:%=$(ob
$(inst_vardbdir)/Makefile: db-Makefile $(+force)
$(do-install)
+libnss_test1.so-no-z-defs = 1
+libnss_test2.so-no-z-defs = 1
+
+rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
+
libof-nss_test1 = extramodules
+libof-nss_test2 = extramodules
$(objpfx)/libnss_test1.so: $(objpfx)nss_test1.os $(link-libc-deps)
$(build-module)
+$(objpfx)/libnss_test2.so: $(objpfx)nss_test2.os $(link-libc-deps)
+ $(build-module)
+$(objpfx)nss_test2.os : nss_test1.c
ifdef libnss_test1.so-version
$(objpfx)/libnss_test1.so$(libnss_test1.so-version): $(objpfx)/libnss_test1.so
$(make-link)
endif
-$(objpfx)tst-nss-test1.out: $(objpfx)/libnss_test1.so$(libnss_test1.so-version)
+ifdef libnss_test2.so-version
+$(objpfx)/libnss_test2.so$(libnss_test2.so-version): $(objpfx)/libnss_test2.so
+ $(make-link)
+endif
+$(patsubst %,$(objpfx)%.out,$(tests)) : \
+ $(objpfx)/libnss_test1.so$(libnss_test1.so-version) \
+ $(objpfx)/libnss_test2.so$(libnss_test2.so-version)
$(objpfx)tst-nss-files-hosts-erange: $(libdl)
diff -Nrup a/nss/tst-nss-getpwent.c b/nss/tst-nss-getpwent.c
--- a/nss/tst-nss-getpwent.c 2019-07-29 16:44:37.670904243 -0400
+++ b/nss/tst-nss-getpwent.c 2019-07-29 16:49:58.538313946 -0400
@@ -21,6 +21,8 @@
#include <stdlib.h>
#include <string.h>
+#include <support/support.h>
+
int
do_test (void)
{
@@ -37,22 +39,12 @@ do_test (void)
{
if (first_name == NULL)
{
- first_name = strdup (pw->pw_name);
- if (first_name == NULL)
- {
- printf ("strdup: %m\n");
- return 1;
- }
+ first_name = xstrdup (pw->pw_name);
first_uid = pw->pw_uid;
}
free (last_name);
- last_name = strdup (pw->pw_name);
- if (last_name == NULL)
- {
- printf ("strdup: %m\n");
- return 1;
- }
+ last_name = xstrdup (pw->pw_name);
last_uid = pw->pw_uid;
++count;
}
@@ -112,5 +104,4 @@ do_test (void)
return 0;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff -Nrup a/shlib-versions b/shlib-versions
--- a/shlib-versions 2019-07-29 16:50:46.222077613 -0400
+++ b/shlib-versions 2019-07-29 16:53:04.745391058 -0400
@@ -87,6 +87,7 @@ sh.*-.*-linux.* ld=ld-linux.so.2 GLIBC_
# Tests for NSS. They must have the same NSS_SHLIB_REVISION number as
# the rest.
.*-.*-.* libnss_test1=2
+.*-.*-.* libnss_test2=2
# Version for libnsl with YP and NIS+ functions.
.*-.*-.* libnsl=1
diff -Nrup a/nss/tst-nss-test1.c b/nss/tst-nss-test1.c
--- a/nss/tst-nss-test1.c 2019-07-29 16:54:05.824241220 -0400
+++ b/nss/tst-nss-test1.c 2019-07-29 17:13:55.696765720 -0400
@@ -1,9 +1,51 @@
+/* Basic test of passwd database handling.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
#include <nss.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <support/support.h>
+
+#include "nss_test.h"
+
+static int hook_called = 0;
+
+/* Note: the values chosen here are arbitrary; they need only be
+ unique within the table. However, they do need to match the
+ "pwdids" array further down. */
+static struct passwd pwd_table[] = {
+ PWD (100),
+ PWD (30),
+ PWD (200),
+ PWD (60),
+ PWD (20000),
+ PWD_LAST ()
+ };
+
+void
+_nss_test1_init_hook(test_tables *t)
+{
+ hook_called = 1;
+ t->pwd_table = pwd_table;
+}
static int
do_test (void)
@@ -12,20 +54,26 @@ do_test (void)
__nss_configure_lookup ("passwd", "test1");
+ /* This must match the pwd_table above. */
static const unsigned int pwdids[] = { 100, 30, 200, 60, 20000 };
#define npwdids (sizeof (pwdids) / sizeof (pwdids[0]))
+
setpwent ();
const unsigned int *np = pwdids;
for (struct passwd *p = getpwent (); p != NULL; ++np, p = getpwent ())
- if (p->pw_uid != *np || strncmp (p->pw_name, "name", 4) != 0
- || atol (p->pw_name + 4) != *np)
- {
- printf ("passwd entry %td wrong (%s, %u)\n",
- np - pwdids, p->pw_name, p->pw_uid);
- retval = 1;
- break;
- }
+ {
+ retval += compare_passwds (np-pwdids, p, & pwd_table[np-pwdids]);
+
+ if (p->pw_uid != *np || strncmp (p->pw_name, "name", 4) != 0
+ || atol (p->pw_name + 4) != *np)
+ {
+ printf ("FAIL: passwd entry %td wrong (%s, %u)\n",
+ np - pwdids, p->pw_name, p->pw_uid);
+ retval = 1;
+ break;
+ }
+ }
endpwent ();
@@ -37,14 +85,14 @@ do_test (void)
struct passwd *p = getpwnam (buf);
if (p == NULL || p->pw_uid != pwdids[i] || strcmp (buf, p->pw_name) != 0)
{
- printf ("passwd entry \"%s\" wrong\n", buf);
+ printf ("FAIL: passwd entry \"%s\" wrong\n", buf);
retval = 1;
}
p = getpwuid (pwdids[i]);
if (p == NULL || p->pw_uid != pwdids[i] || strcmp (buf, p->pw_name) != 0)
{
- printf ("passwd entry %u wrong\n", pwdids[i]);
+ printf ("FAIL: passwd entry %u wrong\n", pwdids[i]);
retval = 1;
}
@@ -53,20 +101,25 @@ do_test (void)
p = getpwnam (buf);
if (p != NULL)
{
- printf ("passwd entry \"%s\" wrong\n", buf);
+ printf ("FAIL: passwd entry \"%s\" wrong\n", buf);
retval = 1;
}
p = getpwuid (pwdids[i] + 1);
if (p != NULL)
{
- printf ("passwd entry %u wrong\n", pwdids[i] + 1);
+ printf ("FAIL: passwd entry %u wrong\n", pwdids[i] + 1);
retval = 1;
}
}
+ if (!hook_called)
+ {
+ retval = 1;
+ printf("FAIL: init hook never called\n");
+ }
+
return retval;
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>
diff -Nrup a/nss/test-netdb.c b/nss/test-netdb.c
--- a/nss/test-netdb.c 2019-07-30 15:31:30.468602060 -0400
+++ b/nss/test-netdb.c 2019-07-30 15:37:29.116601115 -0400
@@ -42,6 +42,8 @@
#include <errno.h>
#include "nss.h"
+#include <support/support.h>
+
/*
The following define is necessary for glibc 2.0.6
*/
@@ -179,7 +181,7 @@ test_hosts (void)
while (gethostname (name, namelen) < 0 && errno == ENAMETOOLONG)
{
namelen += 2; /* tiny increments to test a lot */
- name = realloc (name, namelen);
+ name = xrealloc (name, namelen);
}
if (gethostname (name, namelen) == 0)
{
@@ -377,5 +379,4 @@ do_test (void)
return (error_count != 0);
}
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>

21
glibc-rh1636229-4.patch Normal file
View file

@ -0,0 +1,21 @@
NOTE: This is a downstream patch that should not go upstream.
diff -Nrup a/nss/Makefile b/nss/Makefile
--- a/nss/Makefile 2019-07-30 13:28:36.493476963 -0400
+++ b/nss/Makefile 2019-07-30 13:33:14.536086456 -0400
@@ -118,7 +118,14 @@ $(inst_vardbdir)/Makefile: db-Makefile $
libnss_test1.so-no-z-defs = 1
libnss_test2.so-no-z-defs = 1
-rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
+# RHEL 7 glibc tree does not support rtld-tests-LDFLAGS.
+# Instead we directly alter the way the tests are built.
+# rtld-tests-LDFLAGS += -Wl,--dynamic-list=nss_test.ver
+LDFLAGS-tst-nss-test1 += -Wl,-E
+LDFLAGS-tst-nss-test2 += -Wl,-E
+LDFLAGS-tst-nss-test3 += -Wl,-E
+LDFLAGS-tst-nss-test4 += -Wl,-E
+LDFLAGS-tst-nss-test5 += -Wl,-E
libof-nss_test1 = extramodules
libof-nss_test2 = extramodules

104
glibc-rh1670041.patch Normal file
View file

@ -0,0 +1,104 @@
commit 08504de71813ddbd447bfbca4a325cbe8ce8bcda
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Mar 12 11:40:47 2019 +0100
resolv: Enable full ICMP errors for UDP DNS sockets [BZ #24047]
The Linux kernel suppresses some ICMP error messages by default for
UDP sockets. This commit enables full ICMP error reporting,
hopefully resulting in faster failover to working name servers.
diff --git a/resolv/Makefile b/resolv/Makefile
index 033c3c651f0deb1b..133fe5885c5b65b5 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -92,7 +92,7 @@ libresolv-routines := res_comp res_debug \
res_data res_mkquery res_query res_send \
inet_net_ntop inet_net_pton inet_neta base64 \
ns_parse ns_name ns_netint ns_ttl ns_print \
- ns_samedomain ns_date \
+ ns_samedomain ns_date res_enable_icmp \
compat-hooks compat-gethnamaddr
libanl-routines := gai_cancel gai_error gai_misc gai_notify gai_suspend \
diff --git a/resolv/res_enable_icmp.c b/resolv/res_enable_icmp.c
new file mode 100644
index 0000000000000000..bdc9220f08cef71d
--- /dev/null
+++ b/resolv/res_enable_icmp.c
@@ -0,0 +1,37 @@
+/* Enable full ICMP errors on a socket.
+ 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+
+int
+__res_enable_icmp (int family, int fd)
+{
+ int one = 1;
+ switch (family)
+ {
+ case AF_INET:
+ return setsockopt (fd, SOL_IP, IP_RECVERR, &one, sizeof (one));
+ case AF_INET6:
+ return setsockopt (fd, SOL_IPV6, IPV6_RECVERR, &one, sizeof (one));
+ default:
+ __set_errno (EAFNOSUPPORT);
+ return -1;
+ }
+}
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 05c7ba511b0383c1..e57bb12a66b087e4 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -943,6 +943,18 @@ reopen (res_state statp, int *terrno, int ns)
return (-1);
}
+ /* Enable full ICMP error reporting for this
+ socket. */
+ if (__res_enable_icmp (nsap->sa_family,
+ EXT (statp).nssocks[ns]) < 0)
+ {
+ int saved_errno = errno;
+ __res_iclose (statp, false);
+ __set_errno (saved_errno);
+ *terrno = saved_errno;
+ return -1;
+ }
+
/*
* On a 4.3BSD+ machine (client and server,
* actually), sending to a nameserver datagram
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index 32dc44777e311849..d73a2c1b944bcbbe 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -97,4 +97,10 @@ int __res_nopt (struct resolv_context *, int n0,
int __inet_pton_length (int af, const char *src, size_t srclen, void *);
libc_hidden_proto (__inet_pton_length)
+/* The Linux kernel does not enable all ICMP messages on a UDP socket
+ by default. A call this function enables full error reporting for
+ the socket FD. FAMILY must be AF_INET or AF_INET6. Returns 0 on
+ success, -1 on failure. */
+int __res_enable_icmp (int family, int fd) attribute_hidden;
+
#endif /* _RESOLV_INTERNAL_H */

200
glibc-rh1672771.patch Normal file
View file

@ -0,0 +1,200 @@
commit 823624bdc47f1f80109c9c52dee7939b9386d708
Author: Stefan Liebler <stli@linux.ibm.com>
Date: Thu Feb 7 15:18:36 2019 +0100
Add compiler barriers around modifications of the robust mutex list for pthread_mutex_trylock. [BZ #24180]
While debugging a kernel warning, Thomas Gleixner, Sebastian Sewior and
Heiko Carstens found a bug in pthread_mutex_trylock due to misordered
instructions:
140: a5 1b 00 01 oill %r1,1
144: e5 48 a0 f0 00 00 mvghi 240(%r10),0 <--- THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
14a: e3 10 a0 e0 00 24 stg %r1,224(%r10) <--- last THREAD_SETMEM of ENQUEUE_MUTEX_PI
vs (with compiler barriers):
140: a5 1b 00 01 oill %r1,1
144: e3 10 a0 e0 00 24 stg %r1,224(%r10)
14a: e5 48 a0 f0 00 00 mvghi 240(%r10),0
Please have a look at the discussion:
"Re: WARN_ON_ONCE(!new_owner) within wake_futex_pi() triggerede"
(https://lore.kernel.org/lkml/20190202112006.GB3381@osiris/)
This patch is introducing the same compiler barriers and comments
for pthread_mutex_trylock as introduced for pthread_mutex_lock and
pthread_mutex_timedlock by commit 8f9450a0b7a9e78267e8ae1ab1000ebca08e473e
"Add compiler barriers around modifications of the robust mutex list."
ChangeLog:
[BZ #24180]
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
diff -Nrup a/nptl/pthread_mutex_trylock.c b/nptl/pthread_mutex_trylock.c
--- a/nptl/pthread_mutex_trylock.c 2019-07-26 16:43:11.028271897 -0400
+++ b/nptl/pthread_mutex_trylock.c 2019-07-26 17:06:48.708748979 -0400
@@ -95,6 +95,9 @@ __pthread_mutex_trylock (pthread_mutex_t
case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
&mutex->__data.__list.__next);
+ /* We need to set op_pending before starting the operation. Also
+ see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
oldval = mutex->__data.__lock;
do
@@ -120,7 +123,12 @@ __pthread_mutex_trylock (pthread_mutex_t
/* But it is inconsistent unless marked otherwise. */
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
+ /* We must not enqueue the mutex before we have acquired it.
+ Also see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
ENQUEUE_MUTEX (mutex);
+ /* We need to clear op_pending after we enqueue the mutex. */
+ __asm ("" ::: "memory");
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Note that we deliberately exist here. If we fall
@@ -136,6 +144,8 @@ __pthread_mutex_trylock (pthread_mutex_t
int kind = PTHREAD_MUTEX_TYPE (mutex);
if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
{
+ /* We do not need to ensure ordering wrt another memory
+ access. Also see comments at ENQUEUE_MUTEX. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
NULL);
return EDEADLK;
@@ -143,6 +153,8 @@ __pthread_mutex_trylock (pthread_mutex_t
if (kind == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
{
+ /* We do not need to ensure ordering wrt another memory
+ access. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
NULL);
@@ -160,6 +172,10 @@ __pthread_mutex_trylock (pthread_mutex_t
oldval = lll_robust_trylock (mutex->__data.__lock, id);
if (oldval != 0 && (oldval & FUTEX_OWNER_DIED) == 0)
{
+ /* We haven't acquired the lock as it is already acquired by
+ another owner. We do not need to ensure ordering wrt another
+ memory access. */
+
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return EBUSY;
@@ -173,13 +189,20 @@ __pthread_mutex_trylock (pthread_mutex_t
if (oldval == id)
lll_unlock (mutex->__data.__lock,
PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
+ /* FIXME This violates the mutex destruction requirements. See
+ __pthread_mutex_unlock_full. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
}
}
while ((oldval & FUTEX_OWNER_DIED) != 0);
+ /* We must not enqueue the mutex before we have acquired it.
+ Also see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
ENQUEUE_MUTEX (mutex);
+ /* We need to clear op_pending after we enqueue the mutex. */
+ __asm ("" ::: "memory");
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
mutex->__data.__owner = id;
@@ -201,10 +224,15 @@ __pthread_mutex_trylock (pthread_mutex_t
int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP;
if (robust)
- /* Note: robust PI futexes are signaled by setting bit 0. */
- THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
- (void *) (((uintptr_t) &mutex->__data.__list.__next)
- | 1));
+ {
+ /* Note: robust PI futexes are signaled by setting bit 0. */
+ THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+ (void *) (((uintptr_t) &mutex->__data.__list.__next)
+ | 1));
+ /* We need to set op_pending before starting the operation. Also
+ see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
+ }
oldval = mutex->__data.__lock;
@@ -213,12 +241,16 @@ __pthread_mutex_trylock (pthread_mutex_t
{
if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
{
+ /* We do not need to ensure ordering wrt another memory
+ access. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return EDEADLK;
}
if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
{
+ /* We do not need to ensure ordering wrt another memory
+ access. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Just bump the counter. */
@@ -240,6 +272,9 @@ __pthread_mutex_trylock (pthread_mutex_t
{
if ((oldval & FUTEX_OWNER_DIED) == 0)
{
+ /* We haven't acquired the lock as it is already acquired by
+ another owner. We do not need to ensure ordering wrt another
+ memory access. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return EBUSY;
@@ -260,6 +295,9 @@ __pthread_mutex_trylock (pthread_mutex_t
if (INTERNAL_SYSCALL_ERROR_P (e, __err)
&& INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
{
+ /* The kernel has not yet finished the mutex owner death.
+ We do not need to ensure ordering wrt another memory
+ access. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return EBUSY;
@@ -277,7 +315,12 @@ __pthread_mutex_trylock (pthread_mutex_t
/* But it is inconsistent unless marked otherwise. */
mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
+ /* We must not enqueue the mutex before we have acquired it.
+ Also see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
ENQUEUE_MUTEX (mutex);
+ /* We need to clear op_pending after we enqueue the mutex. */
+ __asm ("" ::: "memory");
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
/* Note that we deliberately exit here. If we fall
@@ -300,13 +343,20 @@ __pthread_mutex_trylock (pthread_mutex_t
PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
0, 0);
+ /* To the kernel, this will be visible after the kernel has
+ acquired the mutex in the syscall. */
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
return ENOTRECOVERABLE;
}
if (robust)
{
+ /* We must not enqueue the mutex before we have acquired it.
+ Also see comments at ENQUEUE_MUTEX. */
+ __asm ("" ::: "memory");
ENQUEUE_MUTEX_PI (mutex);
+ /* We need to clear op_pending after we enqueue the mutex. */
+ __asm ("" ::: "memory");
THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
}

46
glibc-rh1691534-1.patch Normal file
View file

@ -0,0 +1,46 @@
commit ac64195ccd4f320659fd0058bc7524c6fd0b37b4
Author: DJ Delorie <dj@redhat.com>
Date: Wed Mar 20 23:56:59 2019 -0400
iconv, localedef: avoid floating point rounding differences [BZ #24372]
Two cases of "int * 1.4" may result in imprecise results, which
in at least one case resulted in i686 and x86-64 producing
different locale files. This replaced that floating point multiply
with integer operations. While the hash table margin is increased
from 40% to 50%, testing shows only 2% increase in overall size
of the locale archive.
https://bugzilla.redhat.com/show_bug.cgi?id=1311954
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index 0201450..1e6066c 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -1079,9 +1079,9 @@ write_output (void)
/* Create the hashing table. We know how many strings we have.
Creating a perfect hash table is not reasonable here. Therefore
- we use open hashing and a table size which is the next prime 40%
+ we use open hashing and a table size which is the next prime 50%
larger than the number of strings. */
- hash_size = next_prime (nnames * 1.4);
+ hash_size = next_prime (nnames + nnames >> 1);
hash_table = (struct hash_entry *) xcalloc (hash_size,
sizeof (struct hash_entry));
/* Fill the hash table. */
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index bb4e2c5..19b23c2 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2401,8 +2401,8 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
runp = runp->next;
}
- /* Add 40% and find the next prime number. */
- elem_size = next_prime (elem_size * 1.4);
+ /* Add 50% and find the next prime number. */
+ elem_size = next_prime (elem_size + elem_size >> 1);
/* Allocate the table. Each entry consists of two words: the hash
value and an index in a secondary table which provides the index

47
glibc-rh1691534-2.patch Normal file
View file

@ -0,0 +1,47 @@
commit 5abcddd7949270998c6e8d99fdbbba821b664f8b
Author: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
Date: Thu Mar 21 17:24:30 2019 -0300
Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
When -Werror=parentheses is in use, iconvconfig.c builds fail with:
iconvconfig.c: In function write_output:
iconvconfig.c:1084:34: error: suggest parentheses around + inside >> [-Werror=parentheses]
hash_size = next_prime (nnames + nnames >> 1);
~~~~~~~^~~~~~~~
This patch adds parentheses to the expression. Not where suggested by
the compiler warning, but where it produces the expected result, i.e.:
where it has the effect of multiplying nnames by 1.5.
Likewise for elem_size in ld-collate.c.
Tested for powerpc64le.
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index 1e6066c..f75e46d 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -1081,7 +1081,7 @@ write_output (void)
Creating a perfect hash table is not reasonable here. Therefore
we use open hashing and a table size which is the next prime 50%
larger than the number of strings. */
- hash_size = next_prime (nnames + nnames >> 1);
+ hash_size = next_prime (nnames + (nnames >> 1));
hash_table = (struct hash_entry *) xcalloc (hash_size,
sizeof (struct hash_entry));
/* Fill the hash table. */
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 19b23c2..6baab6c 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2402,7 +2402,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
runp = runp->next;
}
/* Add 50% and find the next prime number. */
- elem_size = next_prime (elem_size + elem_size >> 1);
+ elem_size = next_prime (elem_size + (elem_size >> 1));
/* Allocate the table. Each entry consists of two words: the hash
value and an index in a secondary table which provides the index

32
glibc-rh1698015.patch Normal file
View file

@ -0,0 +1,32 @@
commit 99135114ba23c3110b7e4e650fabdc5e639746b7
Author: DJ Delorie <dj@redhat.com>
Date: Fri Jun 28 18:30:00 2019 -0500
nss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]
nss_db allows for getpwent et al to be called without a set*ent,
but it only works once. After the last get*ent a set*ent is
required to restart, because the end*ent did not properly reset
the module. Resetting it to NULL allows for a proper restart.
If the database doesn't exist, however, end*ent erroniously called
munmap which set errno.
Note: the test case has not been included in this backport as the
required test harness infrastructure does not exist.
diff --git a/nss/nss_db/db-open.c b/nss/nss_db/db-open.c
index 8a83d6b..3fa11e9 100644
--- a/nss/nss_db/db-open.c
+++ b/nss/nss_db/db-open.c
@@ -63,5 +63,9 @@ internal_setent (const char *file, struct nss_db_map *mapping)
void
internal_endent (struct nss_db_map *mapping)
{
- munmap (mapping->header, mapping->len);
+ if (mapping->header != NULL)
+ {
+ munmap (mapping->header, mapping->len);
+ mapping->header = NULL;
+ }
}

147
glibc-rh1728915-1.patch Normal file
View file

@ -0,0 +1,147 @@
commit 08b7e9988272113ca5640cf5e115ea51449fb392
Author: Ian Kent <ikent@redhat.com>
Date: Mon Sep 2 13:26:14 2019 +0200
Use autofs "ignore" mount hint in getmntent_r/getmntent
Historically autofs mounts were not included in mount table
listings. This is the case in other SysV autofs implementations
and was also the case with Linux autofs.
But now that /etc/mtab is a symlink to the proc filesystem
mount table the autofs mount entries appear in the mount table
on Linux.
Prior to the symlinking of /etc/mtab mount table it was
sufficient to call mount(2) and simply not update /etc/mtab
to exclude autofs mounts from mount listings.
Also, with the symlinking of /etc/mtab we have seen a shift in
usage toward using the proc mount tables directly.
But the autofs mount entries need to be retained when coming
from the proc file system for applications that need them
(largely autofs file system users themselves) so filtering out
these entries within the kernel itself can't be done. So it
needs be done in user space.
There are three reasons to omit the autofs mount entries.
One is that certain types of auto-mounts have an autofs mount
for every entry in their autofs mount map and these maps can
be quite large. This leads to mount table listings containing
a lot of unnecessary entries.
Also, this change in behaviour between autofs implementations
can cause problems for applications that use getmntent(3) in
other OS implementations as well as Linux.
Lastly, there's very little that user space can do with autofs
mount entries since this must be left to the autofs mount owner,
typically the automount daemon. But it can also lead to attempts
to access automount managed paths resulting mounts being triggered
when they aren't needed or mounts staying mounted for much longer
thay they need be. While the point of this change ins't to help
with these problems (and it can be quite a problem) it may be
a welcome side effect.
So the Linux autofs file system has been modified to accept a
pseudo mount option of "ignore" (as is used in other OS
implementations) so that user space can use this as a hint to
skip autofs entries on reading the mount table.
The Linux autofs automount daemon used getmntent(3) itself and
has been modified to use the proc file system directly so that
it can "ignore" mount option.
The use of this mount option is opt-in and a configuration
option has been added which defaults to not use this option
so if there are applications that need these entries, other
than autofs itself, they can be retained. Also, since this
filtering is based on an added mount option earlier versions
of Linux autofs iand other autofs file system users will not
use the option and so won't be affected by the change.
diff -rup a/misc/mntent_r.c b/misc/mntent_r.c
--- a/misc/mntent_r.c 2012-12-24 22:02:13.000000000 -0500
+++ b/misc/mntent_r.c 2020-01-20 15:55:23.417838854 -0500
@@ -18,6 +18,7 @@
#include <alloca.h>
#include <mntent.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <string.h>
@@ -112,26 +113,18 @@ decode_name (char *buf)
return buf;
}
-
-/* Read one mount table entry from STREAM. Returns a pointer to storage
- reused on the next call, or null for EOF or error (use feof/ferror to
- check). */
-struct mntent *
-__getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
+static bool
+get_mnt_entry (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
{
char *cp;
char *head;
- flockfile (stream);
do
{
char *end_ptr;
if (fgets_unlocked (buffer, bufsiz, stream) == NULL)
- {
- funlockfile (stream);
- return NULL;
- }
+ return false;
end_ptr = strchr (buffer, '\n');
if (end_ptr != NULL) /* chop newline */
@@ -173,9 +166,40 @@ __getmntent_r (FILE *stream, struct mnte
case 2:
break;
}
+
+ return true;
+}
+
+/* Read one mount table entry from STREAM. Returns a pointer to storage
+ reused on the next call, or null for EOF or error (use feof/ferror to
+ check). */
+struct mntent *
+__getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
+{
+ struct mntent *result;
+
+ flockfile (stream);
+ while (true)
+ if (get_mnt_entry (stream, mp, buffer, bufsiz))
+ {
+ /* If the file system is autofs look for a mount option hint
+ ("ignore") to skip the entry. */
+ if (strcmp (mp->mnt_type, "autofs") == 0 && __hasmntopt (mp, "ignore"))
+ memset (mp, 0, sizeof (*mp));
+ else
+ {
+ result = mp;
+ break;
+ }
+ }
+ else
+ {
+ result = NULL;
+ break;
+ }
funlockfile (stream);
- return mp;
+ return result;
}
libc_hidden_def (__getmntent_r)
weak_alias (__getmntent_r, getmntent_r)

164
glibc-rh1728915-2.patch Normal file
View file

@ -0,0 +1,164 @@
commit 9a1e7257a4292d3aea45c8317df3956f4331d8ce
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Sep 2 12:40:38 2019 +0200
Add misc/tst-mntent-autofs, testing autofs "ignore" filtering
diff -rupN a/misc/Makefile b/misc/Makefile
--- a/misc/Makefile 2020-01-20 15:48:16.472243494 -0500
+++ b/misc/Makefile 2020-01-20 16:03:01.291550472 -0500
@@ -76,7 +76,8 @@ install-lib := libbsd-compat.a libg.a
gpl2lgpl := error.c error.h
tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
- tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 bug18240
+ tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 bug18240 \
+ tst-mntent-autofs
ifeq ($(run-built-tests),yes)
tests: $(objpfx)tst-error1-mem
endif
diff -rupN a/misc/tst-mntent-autofs.c b/misc/tst-mntent-autofs.c
--- a/misc/tst-mntent-autofs.c 1969-12-31 19:00:00.000000000 -0500
+++ b/misc/tst-mntent-autofs.c 2020-01-20 16:01:37.233483270 -0500
@@ -0,0 +1,141 @@
+/* Test autofs "ignore" filtering for getment_r.
+ 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <errno.h>
+#include <mntent.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/temp_file.h>
+#include <support/xstdio.h>
+#include <support/xunistd.h>
+
+struct test_case
+{
+ const char *line;
+ struct
+ {
+ /* Like struct mntent, but with const pointers. */
+ const char *mnt_fsname;
+ const char *mnt_dir;
+ const char *mnt_type;
+ const char *mnt_opts;
+ int mnt_freq;
+ int mnt_passno;
+ } expected;
+};
+
+static struct test_case test_cases[] =
+ {
+ { "/etc/auto.direct /mnt/auto/1 autofs defaults 0 0",
+ { "/etc/auto.direct", "/mnt/auto/1", "autofs", "defaults", 0, 0 } },
+
+ /* These entries are filtered out. */
+ { "/etc/auto.2 /mnt/auto/2 autofs ignore 0 0", { NULL, } },
+ { "/etc/auto.3 /mnt/auto/3 autofs ignore,other 1 2", { NULL, } },
+ { "/etc/auto.4 /mnt/auto/4 autofs other,ignore 3 4", { NULL, } },
+ { "/etc/auto.5 /mnt/auto/5 autofs opt1,ignore,opt2 5 6", { NULL, } },
+
+ /* Dummy entry to make the desynchronization more obvious. */
+ { "/dev/sda1 / xfs defaults 0 0",
+ { "/dev/sda1", "/", "xfs", "defaults", 0, 0 } },
+
+ /* These are not filtered because the file system is not autofs. */
+ { "/etc/auto.direct /mnt/auto/6 autofs1 ignore 0 0",
+ { "/etc/auto.direct", "/mnt/auto/6", "autofs1", "ignore", 0, 0 } },
+ { "/etc/auto.direct /mnt/auto/7 autofs1 ignore,other 0 0",
+ { "/etc/auto.direct", "/mnt/auto/7", "autofs1", "ignore,other", 0, 0 } },
+ { "/etc/auto.direct /mnt/auto/8 autofs1 other,ignore 0 0",
+ { "/etc/auto.direct", "/mnt/auto/8", "autofs1", "other,ignore", 0, 0 } },
+ { "/etc/auto.direct /mnt/auto/9 autofs1 opt1,ignore,opt2 0 0",
+ { "/etc/auto.direct", "/mnt/auto/9", "autofs1", "opt1,ignore,opt2", } },
+
+ /* These are not filtered because the string "ignore" is not an
+ option name. */
+ { "/etc/auto.direct /mnt/auto/10 autofs noignore 1 2",
+ { "/etc/auto.direct", "/mnt/auto/10", "autofs", "noignore", 1, 2 } },
+ { "/etc/auto.direct /mnt/auto/11 autofs noignore,other 0 0",
+ { "/etc/auto.direct", "/mnt/auto/11", "autofs", "noignore,other", } },
+ { "/etc/auto.direct /mnt/auto/12 autofs other,noignore 0 0",
+ { "/etc/auto.direct", "/mnt/auto/12", "autofs", "other,noignore", } },
+ { "/etc/auto.direct /mnt/auto/13 autofs errors=ignore 0 0",
+ { "/etc/auto.direct", "/mnt/auto/13", "autofs", "errors=ignore", } },
+ { "/etc/auto.direct /mnt/auto/14 autofs errors=ignore,other 0 0",
+ { "/etc/auto.direct", "/mnt/auto/14", "autofs",
+ "errors=ignore,other", } },
+ { "/etc/auto.direct /mnt/auto/15 autofs other,errors=ignore 0 0",
+ { "/etc/auto.direct", "/mnt/auto/15", "autofs",
+ "other,errors=ignore", } },
+
+ /* These are not filtered because the string is escaped. '\151'
+ is 'i', but it is not actually decoded by the parser. */
+ { "/etc/auto.\\151gnore /mnt/auto/16 autofs \\151gnore 0 0",
+ { "/etc/auto.\\151gnore", "/mnt/auto/16", "autofs",
+ "\\151gnore", } },
+ };
+
+static int
+do_test (void)
+{
+ char *path;
+ xclose (create_temp_file ("tst-mntent-autofs-", &path));
+
+ /* Write the test file. */
+ FILE *fp = xfopen (path, "w");
+ for (size_t i = 0; i < array_length (test_cases); ++i)
+ fprintf (fp, "%s\n", test_cases[i].line);
+ xfclose (fp);
+
+ /* Open the test file again, this time for parsing. */
+ fp = setmntent (path, "r");
+ TEST_VERIFY_EXIT (fp != NULL);
+ char buffer[512];
+ struct mntent me;
+
+ for (size_t i = 0; i < array_length (test_cases); ++i)
+ {
+ if (test_cases[i].expected.mnt_type == NULL)
+ continue;
+
+ memset (buffer, 0xcc, sizeof (buffer));
+ memset (&me, 0xcc, sizeof (me));
+ struct mntent *pme = getmntent_r (fp, &me, buffer, sizeof (buffer));
+ TEST_VERIFY_EXIT (pme != NULL);
+ TEST_VERIFY (pme == &me);
+ TEST_COMPARE_STRING (test_cases[i].expected.mnt_fsname, me.mnt_fsname);
+ TEST_COMPARE_STRING (test_cases[i].expected.mnt_dir, me.mnt_dir);
+ TEST_COMPARE_STRING (test_cases[i].expected.mnt_type, me.mnt_type);
+ TEST_COMPARE_STRING (test_cases[i].expected.mnt_opts, me.mnt_opts);
+ TEST_COMPARE (test_cases[i].expected.mnt_freq, me.mnt_freq);
+ TEST_COMPARE (test_cases[i].expected.mnt_passno, me.mnt_passno);
+ }
+
+ TEST_VERIFY (getmntent_r (fp, &me, buffer, sizeof (buffer)) == NULL);
+
+ TEST_COMPARE (feof (fp), 1);
+ TEST_COMPARE (ferror (fp), 0);
+ errno = 0;
+ TEST_COMPARE (endmntent (fp), 1);
+ TEST_COMPARE (errno, 0);
+ free (path);
+ return 0;
+}
+
+#include <support/test-driver.c>

160
glibc-rh1740039-1.patch Normal file
View file

@ -0,0 +1,160 @@
Partial backport of:
commit a42faf59d6d9f82e5293a9ebcc26d9c9e562b12b
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Mon Mar 24 10:58:26 2014 -0700
Fix BZ #16634.
An application that erroneously tries to repeatedly dlopen("a.out", ...)
may hit assertion failure:
Inconsistency detected by ld.so: dl-tls.c: 474: _dl_allocate_tls_init:
Assertion `listp != ((void *)0)' failed!
dlopen() actually fails with "./a.out: cannot dynamically load executable",
but it does so after incrementing dl_tls_max_dtv_idx.
Once we run out of TLS_SLOTINFO_SURPLUS (62), we exit with above assertion
failure.
2014-03-24 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #16634]
* elf/dl-load.c (open_verify): Add mode parameter.
Error early when ET_EXEC and mode does not have __RTLD_OPENEXEC.
(open_path): Change from boolean 'secure' to complete flag 'mode'
(_dl_map_object): Adjust.
* elf/Makefile (tests): Add tst-dlopen-aout.
* elf/tst-dlopen-aout.c: New test.
Only the change to elf/dl-load.c is included here. The upstream test
does not work because it depends on --enable-hardcoded-path-in-tests
(which is not available in this tree, despite being documented in the
manual).
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 6a0005da502c8f37..0ba0712aa5201fa0 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1686,7 +1686,7 @@ print_search_path (struct r_search_path_elem **list,
user might want to know about this. */
static int
open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
- int whatcode, bool *found_other_class, bool free_name)
+ int whatcode, int mode, bool *found_other_class, bool free_name)
{
/* This is the expected ELF header. */
#define ELF32_CLASS ELFCLASS32
@@ -1863,6 +1863,17 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
errstring = N_("only ET_DYN and ET_EXEC can be loaded");
goto call_lose;
}
+ else if (__glibc_unlikely (ehdr->e_type == ET_EXEC
+ && (mode & __RTLD_OPENEXEC) == 0))
+ {
+ /* BZ #16634. It is an error to dlopen ET_EXEC (unless
+ __RTLD_OPENEXEC is explicitly set). We return error here
+ so that code in _dl_map_object_from_fd does not try to set
+ l_tls_modid for this module. */
+
+ errstring = N_("cannot dynamically load executable");
+ goto call_lose;
+ }
else if (__builtin_expect (ehdr->e_phentsize, sizeof (ElfW(Phdr)))
!= sizeof (ElfW(Phdr)))
{
@@ -1964,7 +1975,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
if MAY_FREE_DIRS is true. */
static int
-open_path (const char *name, size_t namelen, int secure,
+open_path (const char *name, size_t namelen, int mode,
struct r_search_path_struct *sps, char **realname,
struct filebuf *fbp, struct link_map *loader, int whatcode,
bool *found_other_class)
@@ -2016,8 +2027,8 @@ open_path (const char *name, size_t namelen, int secure,
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_LIBS, 0))
_dl_debug_printf (" trying file=%s\n", buf);
- fd = open_verify (buf, fbp, loader, whatcode, found_other_class,
- false);
+ fd = open_verify (buf, fbp, loader, whatcode, mode,
+ found_other_class, false);
if (this_dir->status[cnt] == unknown)
{
if (fd != -1)
@@ -2046,7 +2057,7 @@ open_path (const char *name, size_t namelen, int secure,
/* Remember whether we found any existing directory. */
here_any |= this_dir->status[cnt] != nonexisting;
- if (fd != -1 && __builtin_expect (secure, 0)
+ if (fd != -1 && __builtin_expect (mode & __RTLD_SECURE, 0)
&& INTUSE(__libc_enable_secure))
{
/* This is an extra security effort to make sure nobody can
@@ -2236,7 +2247,7 @@ _dl_map_object (struct link_map *loader, const char *name,
for (l = loader; l; l = l->l_loader)
if (cache_rpath (l, &l->l_rpath_dirs, DT_RPATH, "RPATH"))
{
- fd = open_path (name, namelen, mode & __RTLD_SECURE,
+ fd = open_path (name, namelen, mode,
&l->l_rpath_dirs,
&realname, &fb, loader, LA_SER_RUNPATH,
&found_other_class);
@@ -2252,7 +2263,7 @@ _dl_map_object (struct link_map *loader, const char *name,
&& main_map != NULL && main_map->l_type != lt_loaded
&& cache_rpath (main_map, &main_map->l_rpath_dirs, DT_RPATH,
"RPATH"))
- fd = open_path (name, namelen, mode & __RTLD_SECURE,
+ fd = open_path (name, namelen, mode,
&main_map->l_rpath_dirs,
&realname, &fb, loader ?: main_map, LA_SER_RUNPATH,
&found_other_class);
@@ -2260,7 +2271,7 @@ _dl_map_object (struct link_map *loader, const char *name,
/* Try the LD_LIBRARY_PATH environment variable. */
if (fd == -1 && env_path_list.dirs != (void *) -1)
- fd = open_path (name, namelen, mode & __RTLD_SECURE, &env_path_list,
+ fd = open_path (name, namelen, mode, &env_path_list,
&realname, &fb,
loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded,
LA_SER_LIBPATH, &found_other_class);
@@ -2269,7 +2280,7 @@ _dl_map_object (struct link_map *loader, const char *name,
if (fd == -1 && loader != NULL
&& cache_rpath (loader, &loader->l_runpath_dirs,
DT_RUNPATH, "RUNPATH"))
- fd = open_path (name, namelen, mode & __RTLD_SECURE,
+ fd = open_path (name, namelen, mode,
&loader->l_runpath_dirs, &realname, &fb, loader,
LA_SER_RUNPATH, &found_other_class);
@@ -2326,7 +2337,8 @@ _dl_map_object (struct link_map *loader, const char *name,
{
fd = open_verify (cached,
&fb, loader ?: GL(dl_ns)[nsid]._ns_loaded,
- LA_SER_CONFIG, &found_other_class, false);
+ LA_SER_CONFIG, mode, &found_other_class,
+ false);
if (__builtin_expect (fd != -1, 1))
realname = cached;
else
@@ -2341,7 +2353,7 @@ _dl_map_object (struct link_map *loader, const char *name,
&& ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
|| __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
&& rtld_search_dirs.dirs != (void *) -1)
- fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs,
+ fd = open_path (name, namelen, mode, &rtld_search_dirs,
&realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
/* Add another newline when we are tracing the library loading. */
@@ -2359,7 +2371,7 @@ _dl_map_object (struct link_map *loader, const char *name,
else
{
fd = open_verify (realname, &fb,
- loader ?: GL(dl_ns)[nsid]._ns_loaded, 0,
+ loader ?: GL(dl_ns)[nsid]._ns_loaded, 0, mode,
&found_other_class, true);
if (__builtin_expect (fd, 0) == -1)
free (realname);

174
glibc-rh1740039-2.patch Normal file
View file

@ -0,0 +1,174 @@
Partial backport of:
commit 7d3db434f910c23591f748a6d0ac3548af1048bb
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Oct 17 08:51:21 2019 +0200
Rename and split elf/tst-dlopen-aout collection of tests
From the beginning, elf/tst-dlopen-aout has exercised two different
bugs: (a) failure to report errors for a dlopen of the executable
itself in some cases (bug 24900) and (b) incorrect rollback of the
TLS modid allocation in case of a dlopen failure (bug 16634).
This commit replaces the test with elf/tst-dlopen-self for (a) and
elf/tst-dlopen-tlsmodid for (b). The latter tests use the
elf/tst-dlopen-self binaries (or iconv) with dlopen, so they are
no longer self-dlopen tests.
Tested on x86_64-linux-gnu and i686-linux-gnu, with a toolchain that
does not default to PIE.
Only the non-PIE, non-container test elf/tst-dlopen-tlsmodid is
included. The reason is that the self-dlopen fixes and the PIE TLS
modid fix have not been backported, and that container testing support
is missing downstream. The test binary is adjusted to tst-tls10
because tst-dlopen-self does not exist in the backport.
diff --git a/elf/Makefile b/elf/Makefile
index cfd039fc9dfb0be7..c22008b54afc91f5 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -153,7 +153,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
tst-stackguard1 tst-addr1 tst-thrlock \
tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
tst-initorder tst-initorder2 tst-relsort1 tst-ptrguard1 \
- tst-big-note
+ tst-big-note tst-dlopen-tlsmodid
# reldep9
test-srcs = tst-pathopt
selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
@@ -1101,6 +1101,9 @@ $(objpfx)tst-addr1: $(libdl)
$(objpfx)tst-thrlock: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-tlsmodid: $(libdl) $(shared-thread-library)
+$(objpfx)tst-dlopen-tlsmodid.out: $(objpfx)tst-tls10
+
CFLAGS-ifuncmain1pic.c += $(pic-ccflag)
CFLAGS-ifuncmain1picstatic.c += $(pic-ccflag)
CFLAGS-ifuncmain1staticpic.c += $(pic-ccflag)
diff --git a/elf/tst-dlopen-tlsmodid.c b/elf/tst-dlopen-tlsmodid.c
new file mode 100644
index 0000000000000000..c5b1c39369aa610c
--- /dev/null
+++ b/elf/tst-dlopen-tlsmodid.c
@@ -0,0 +1,25 @@
+/* Test case for BZ #16634. Non-PIE version.
+
+ Verify that incorrectly dlopen()ing an executable without
+ __RTLD_OPENEXEC does not cause assertion in ld.so, and that it
+ actually results in an error.
+
+ Copyright (C) 2014-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
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+#define TST_DLOPEN_TLSMODID_PATH "tst-tls10"
+#include "tst-dlopen-tlsmodid.h"
diff --git a/elf/tst-dlopen-tlsmodid.h b/elf/tst-dlopen-tlsmodid.h
new file mode 100644
index 0000000000000000..c747cb14911c72fa
--- /dev/null
+++ b/elf/tst-dlopen-tlsmodid.h
@@ -0,0 +1,87 @@
+/* Common code for tst-dlopen-tlsmodid, tst-dlopen-tlsmodid-pie,
+ tst-dlopen-tlsmodid-container.
+
+ Verify that incorrectly dlopen()ing an executable without
+ __RTLD_OPENEXEC does not cause assertion in ld.so, and that it
+ actually results in an error.
+
+ Copyright (C) 2014-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
+ 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
+ <https://www.gnu.org/licenses/>. */
+
+/* Before including this file, the macro TST_DLOPEN_TLSMODID_PATH must
+ be defined, to specify the path used for the open operation. */
+
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xthread.h>
+
+__thread int x;
+
+void *
+fn (void *p)
+{
+ return p;
+}
+
+/* Call dlopen and check that fails with an error message indicating
+ an attempt to open an ET_EXEC or PIE object. */
+static void
+check_dlopen_failure (void)
+{
+ void *handle = dlopen (TST_DLOPEN_TLSMODID_PATH, RTLD_LAZY);
+ if (handle != NULL)
+ FAIL_EXIT1 ("dlopen succeeded unexpectedly: %s", TST_DLOPEN_TLSMODID_PATH);
+
+ const char *message = dlerror ();
+ TEST_VERIFY_EXIT (message != NULL);
+ if ((strstr (message,
+ "cannot dynamically load position-independent executable")
+ == NULL)
+ && strstr (message, "cannot dynamically load executable") == NULL)
+ FAIL_EXIT1 ("invalid dlopen error message: \"%s\"", message);
+}
+
+static int
+do_test (int argc, char *argv[])
+{
+ int j;
+
+ for (j = 0; j < 100; ++j)
+ {
+ pthread_t thr;
+
+ check_dlopen_failure ();
+
+ /* We create threads to force TLS allocation, which triggers
+ the original bug i.e. running out of surplus slotinfo entries
+ for TLS. */
+ thr = xpthread_create (NULL, fn, NULL);
+ xpthread_join (thr);
+ }
+
+ check_dlopen_failure ();
+
+ return 0;
+}
+
+#define TEST_FUNCTION_ARGV do_test
+#include <support/test-driver.c>

43
glibc-rh1747465-1.patch Normal file
View file

@ -0,0 +1,43 @@
commit 477e739b324349df854209117047779ac3142130
Author: Joseph Myers <joseph@codesourcery.com>
Date: Fri Mar 15 18:18:40 2019 +0000
Update syscall-names.list for Linux 5.0.
This patch updates sysdeps/unix/sysv/linux/syscall-names.list for
Linux 5.0. Based on testing with build-many-glibcs.py, the only new
entry needed is for old_getpagesize (a newly added __NR_* name for an
old syscall on ia64). (Because 5.0 changes how syscall tables are
handled in the kernel, checking diffs wasn't a useful way of looking
for new syscalls in 5.0 as most of the syscall tables were moved to
the new representation without actually adding any syscalls to them.)
Tested with build-many-glibcs.py.
* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 5.0.
(old_getpagesize): New syscall.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index b650dc07cc..0227e52a5f 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -22,8 +22,8 @@
# names are only used if the installed kernel headers also provide
# them.
-# The list of system calls is current as of Linux 4.20.
-kernel 4.20
+# The list of system calls is current as of Linux 5.0.
+kernel 5.0
FAST_atomic_update
FAST_cmpxchg
@@ -261,6 +261,7 @@ nfsservctl
ni_syscall
nice
old_adjtimex
+old_getpagesize
oldfstat
oldlstat
oldolduname

181
glibc-rh1747465-2.patch Normal file
View file

@ -0,0 +1,181 @@
commit 7621676f7a5130c030f7fff1cab72dbf2993b837
Author: Joseph Myers <joseph@codesourcery.com>
Date: Tue May 7 23:57:26 2019 +0000
Update syscall-names.list for Linux 5.1.
This patch updates syscall-names.list for Linux 5.1 (which has many
new syscalls, mainly but not entirely ones for 64-bit time).
Tested with build-many-glibcs.py (before the revert of the move to
Linux 5.1 there; verified there were no tst-syscall-list failures).
* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 5.1.
(clock_adjtime64) New syscall.
(clock_getres_time64) Likewise.
(clock_gettime64) Likewise.
(clock_nanosleep_time64) Likewise.
(clock_settime64) Likewise.
(futex_time64) Likewise.
(io_pgetevents_time64) Likewise.
(io_uring_enter) Likewise.
(io_uring_register) Likewise.
(io_uring_setup) Likewise.
(mq_timedreceive_time64) Likewise.
(mq_timedsend_time64) Likewise.
(pidfd_send_signal) Likewise.
(ppoll_time64) Likewise.
(pselect6_time64) Likewise.
(recvmmsg_time64) Likewise.
(rt_sigtimedwait_time64) Likewise.
(sched_rr_get_interval_time64) Likewise.
(semtimedop_time64) Likewise.
(timer_gettime64) Likewise.
(timer_settime64) Likewise.
(timerfd_gettime64) Likewise.
(timerfd_settime64) Likewise.
(utimensat_time64) Likewise.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 0227e52a5f..2d0354b8b3 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -22,8 +22,8 @@
# names are only used if the installed kernel headers also provide
# them.
-# The list of system calls is current as of Linux 5.0.
-kernel 5.0
+# The list of system calls is current as of Linux 5.1.
+kernel 5.1
FAST_atomic_update
FAST_cmpxchg
@@ -63,10 +63,15 @@ chown
chown32
chroot
clock_adjtime
+clock_adjtime64
clock_getres
+clock_getres_time64
clock_gettime
+clock_gettime64
clock_nanosleep
+clock_nanosleep_time64
clock_settime
+clock_settime64
clone
clone2
close
@@ -128,6 +133,7 @@ ftime
ftruncate
ftruncate64
futex
+futex_time64
futimesat
get_kernel_syms
get_mempolicy
@@ -187,8 +193,12 @@ io_cancel
io_destroy
io_getevents
io_pgetevents
+io_pgetevents_time64
io_setup
io_submit
+io_uring_enter
+io_uring_register
+io_uring_setup
ioctl
ioperm
iopl
@@ -242,7 +252,9 @@ mq_getsetattr
mq_notify
mq_open
mq_timedreceive
+mq_timedreceive_time64
mq_timedsend
+mq_timedsend_time64
mq_unlink
mremap
msgctl
@@ -389,6 +401,7 @@ perf_event_open
perfctr
perfmonctl
personality
+pidfd_send_signal
pipe
pipe2
pivot_root
@@ -397,6 +410,7 @@ pkey_free
pkey_mprotect
poll
ppoll
+ppoll_time64
prctl
pread64
preadv
@@ -407,6 +421,7 @@ process_vm_writev
prof
profil
pselect6
+pselect6_time64
ptrace
putpmsg
pwrite64
@@ -424,6 +439,7 @@ reboot
recv
recvfrom
recvmmsg
+recvmmsg_time64
recvmsg
remap_file_pages
removexattr
@@ -442,6 +458,7 @@ rt_sigqueueinfo
rt_sigreturn
rt_sigsuspend
rt_sigtimedwait
+rt_sigtimedwait_time64
rt_tgsigqueueinfo
rtas
s390_guarded_storage
@@ -457,6 +474,7 @@ sched_getattr
sched_getparam
sched_getscheduler
sched_rr_get_interval
+sched_rr_get_interval_time64
sched_set_affinity
sched_setaffinity
sched_setattr
@@ -470,6 +488,7 @@ semctl
semget
semop
semtimedop
+semtimedop_time64
send
sendfile
sendfile64
@@ -567,11 +586,15 @@ timer_create
timer_delete
timer_getoverrun
timer_gettime
+timer_gettime64
timer_settime
+timer_settime64
timerfd
timerfd_create
timerfd_gettime
+timerfd_gettime64
timerfd_settime
+timerfd_settime64
times
tkill
truncate
@@ -591,6 +614,7 @@ userfaultfd
ustat
utime
utimensat
+utimensat_time64
utimes
utrap_install
vfork

58
glibc-rh1747465-3.patch Normal file
View file

@ -0,0 +1,58 @@
commit 0bb8f8c791862a4ff38a584af23bbb5bf3f90acd
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri May 31 13:52:16 2019 +0200
Linux: Add oddly-named arm syscalls to syscall-names.list
<asm/unistd.h> on arm defines the following macros:
#define __ARM_NR_breakpoint (__ARM_NR_BASE+1)
#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
#define __ARM_NR_usr26 (__ARM_NR_BASE+3)
#define __ARM_NR_usr32 (__ARM_NR_BASE+4)
#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
#define __ARM_NR_get_tls (__ARM_NR_BASE+6)
These do not follow the regular __NR_* naming convention and
have so far been ignored by the syscall-names.list consistency
checks. This commit adds these names to the file, preparing
for the availability of these names in the regular __NR_*
namespace.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 2d0354b8b3..ae8adabb70 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -52,6 +52,7 @@ bdflush
bind
bpf
break
+breakpoint
brk
cachectl
cacheflush
@@ -139,6 +140,7 @@ get_kernel_syms
get_mempolicy
get_robust_list
get_thread_area
+get_tls
getcpu
getcwd
getdents
@@ -499,6 +501,7 @@ set_mempolicy
set_robust_list
set_thread_area
set_tid_address
+set_tls
setdomainname
setfsgid
setfsgid32
@@ -611,6 +614,8 @@ unlinkat
unshare
uselib
userfaultfd
+usr26
+usr32
ustat
utime
utimensat

30
glibc-rh1747465-4.patch Normal file
View file

@ -0,0 +1,30 @@
commit a63b96fbddbf97feaa068a9efed3b5623a1a1e78
Author: Vincent Chen <vincentc@andestech.com>
Date: Wed Jun 26 17:30:11 2019 +0800
Linux: Add nds32 specific syscalls to syscall-names.list
The nds32 creates two specific syscalls, udftrap and fp_udfiex_crtl, in
kernel v5.0 and v5.2, respectively. Add these two syscalls to
syscall-names.list.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index ae8adabb70..95aa3ec7a5 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -121,6 +121,7 @@ finit_module
flistxattr
flock
fork
+fp_udfiex_crtl
free_hugepages
fremovexattr
fsetxattr
@@ -603,6 +604,7 @@ tkill
truncate
truncate64
tuxcall
+udftrap
ugetrlimit
ulimit
umask

52
glibc-rh1747465-5.patch Normal file
View file

@ -0,0 +1,52 @@
commit 1f7097d09ce628878107ed30341cfc1eb3649a81
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Jul 19 08:53:04 2019 +0200
Linux: Update syscall-names.list to Linux 5.2
This adds the system call names fsconfig, fsmount, fsopen, fspick,
move_mount, open_tree.
Tested with build-many-glibcs.py.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 95aa3ec7a5..21bf37c627 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -23,7 +23,7 @@
# them.
# The list of system calls is current as of Linux 5.1.
-kernel 5.1
+kernel 5.2
FAST_atomic_update
FAST_cmpxchg
@@ -124,7 +124,11 @@ fork
fp_udfiex_crtl
free_hugepages
fremovexattr
+fsconfig
fsetxattr
+fsmount
+fsopen
+fspick
fstat
fstat64
fstatat64
@@ -248,6 +252,7 @@ mmap
mmap2
modify_ldt
mount
+move_mount
move_pages
mprotect
mpx
@@ -285,6 +290,7 @@ oldumount
olduname
open
open_by_handle_at
+open_tree
openat
osf_adjtime
osf_afs_syscall

24
glibc-rh1747465-6.patch Normal file
View file

@ -0,0 +1,24 @@
commit 9c37bde5a2067e5b4dc878bac0291d6b207b8add
Author: Joseph Myers <joseph@codesourcery.com>
Date: Fri Aug 2 15:08:02 2019 +0000
Update kernel version in comment in syscall-names.list.
This patch updates the Linux kernel version in a comment in
syscall-names.list to agree with the following "kernel" line.
* sysdeps/unix/sysv/linux/syscall-names.list: Update comment.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index 21bf37c627..9dcdd293d3 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -22,7 +22,7 @@
# names are only used if the installed kernel headers also provide
# them.
-# The list of system calls is current as of Linux 5.1.
+# The list of system calls is current as of Linux 5.2.
kernel 5.2
FAST_atomic_update

47
glibc-rh1747465-7.patch Normal file
View file

@ -0,0 +1,47 @@
commit 0f02b6cfc44af73d4d4363c46b3cbb18b8ff9171
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Sep 18 22:57:46 2019 +0000
Update syscall-names.list for Linux 5.3.
This patch updates syscall-names.list for Linux 5.3, adding two new
syscalls.
Tested with build-many-glibcs.py.
* sysdeps/unix/sysv/linux/syscall-names.list: Update kernel
version to 5.3.
(clone3): New syscall.
(pidfd_open): Likewise.
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
index e2382d3414..b55ffbc2a0 100644
--- a/sysdeps/unix/sysv/linux/syscall-names.list
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
@@ -22,8 +22,8 @@
# names are only used if the installed kernel headers also provide
# them.
-# The list of system calls is current as of Linux 5.2.
-kernel 5.2
+# The list of system calls is current as of Linux 5.3.
+kernel 5.3
FAST_atomic_update
FAST_cmpxchg
@@ -75,6 +75,7 @@ clock_settime
clock_settime64
clone
clone2
+clone3
close
cmpxchg_badaddr
connect
@@ -410,6 +411,7 @@ perf_event_open
perfctr
perfmonctl
personality
+pidfd_open
pidfd_send_signal
pipe
pipe2

50
glibc-rh1747465-8.patch Normal file
View file

@ -0,0 +1,50 @@
commit a331150af65477fc3fa72ab341eed5e0b2daf7f3
Author: Joseph Myers <joseph@codesourcery.com>
Date: Thu Nov 28 20:32:09 2019 +0000
Update syscall-names.list for Linux 5.4.
This patch updates syscall-names.list for Linux 5.4. There are no new
syscalls, so this is just a matter of updating the version number
listed in the file.
Tested with build-many-glibcs.py.
Reworked for (rhbz#1747465)
Also update copyright info to match upstream.
Correct some typos in the comments to match upstream.
diff -Nrup a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
--- a/sysdeps/unix/sysv/linux/syscall-names.list 2020-01-24 12:27:15.212564061 -0500
+++ b/sysdeps/unix/sysv/linux/syscall-names.list 2020-01-24 14:42:30.175256876 -0500
@@ -1,5 +1,5 @@
# List of all known Linux system calls.
-# Copyright (C) 2017-2018 Free Software Foundation, Inc.
+# Copyright (C) 2017-2020 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
@@ -14,16 +14,15 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
-# <http://www.gnu.org/licenses/>.
+# <https://www.gnu.org/licenses/>.
-# This file contains the list of system call names names. It has to
-# remain in alphabetica order. Lines which start with # are treated
-# as comments. This file can list all potential system calls. The
-# names are only used if the installed kernel headers also provide
-# them.
+# This file contains the list of system call names. It has to remain in
+# alphabetical order. Lines which start with # are treated as comments.
+# This file can list all potential system calls. The names are only
+# used if the installed kernel headers also provide them.
-# The list of system calls is current as of Linux 5.3.
-kernel 5.3
+# The list of system calls is current as of Linux 5.4.
+kernel 5.4
FAST_atomic_update
FAST_cmpxchg

123
glibc-rh1763325.patch Normal file
View file

@ -0,0 +1,123 @@
commit 2c820533c61fed175390bc6058afbbe42d2edc37
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Aug 18 11:15:42 2016 +0200
argp: Do not override GCC keywords with macros [BZ #16907]
glibc provides fallback definitions already. It is not necessary to
suppress warnings for unknown attributes because GCC does this
automatically for system headers.
This commit does not sync with gnulib because gnulib has started to use
_GL_* macros in the header file, which are arguably in the gnulib
implementation space and not suitable for an installed glibc header
file.
diff --git a/argp/argp-fmtstream.h b/argp/argp-fmtstream.h
index 61c45bf86b6bf8d5..b8e4e2406ff2784e 100644
--- a/argp/argp-fmtstream.h
+++ b/argp/argp-fmtstream.h
@@ -29,21 +29,6 @@
#include <string.h>
#include <unistd.h>
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
- defined __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
- defined __STRICT_ANSI__
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
#if defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)
/* line_wrap_stream is available, so use that. */
#define ARGP_FMTSTREAM_USE_LINEWRAP
@@ -111,6 +96,8 @@ struct argp_fmtstream
typedef struct argp_fmtstream *argp_fmtstream_t;
+__BEGIN_DECLS
+
/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
written on it with LMARGIN spaces and limits them to RMARGIN columns
total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
@@ -297,6 +284,8 @@ __argp_fmtstream_point (argp_fmtstream_t __fs)
#endif /* __OPTIMIZE__ */
+__END_DECLS
+
#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
#endif /* argp-fmtstream.h */
diff --git a/argp/argp.h b/argp/argp.h
index 37544fe44a102574..61b792909530aaac 100644
--- a/argp/argp.h
+++ b/argp/argp.h
@@ -29,48 +29,12 @@
#define __need_error_t
#include <errno.h>
-#ifndef __THROW
-# define __THROW
-#endif
-#ifndef __NTH
-# define __NTH(fct) fct __THROW
-#endif
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || \
- defined __STRICT_ANSI__
-# define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
- are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || \
- defined __STRICT_ANSI__
-# define __format__ format
-# define __printf__ printf
-# endif
-#endif
-
-/* GCC 2.95 and later have "__restrict"; C99 compilers have
- "restrict", and "configure" may have defined "restrict". */
-#ifndef __restrict
-# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
-# if defined restrict || 199901L <= __STDC_VERSION__
-# define __restrict restrict
-# else
-# define __restrict
-# endif
-# endif
-#endif
-
#ifndef __error_t_defined
typedef int error_t;
# define __error_t_defined
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+__BEGIN_DECLS
/* A description of a particular option. A pointer to an array of
these is passed in the OPTIONS field of an argp structure. Each option
@@ -591,8 +555,6 @@ __NTH (__option_is_end (const struct argp_option *__opt))
# endif
#endif /* Use extern inlines. */
-#ifdef __cplusplus
-}
-#endif
+__END_DECLS
#endif /* argp.h */

24
glibc-rh1775599.patch Normal file
View file

@ -0,0 +1,24 @@
commit d5dfad4326fc683c813df1e37bbf5cf920591c8e
Author: Marcin Kościelnicki <mwk@0x04.net>
Date: Thu Nov 21 00:20:15 2019 +0100
rtld: Check __libc_enable_secure before honoring LD_PREFER_MAP_32BIT_EXEC (CVE-2019-19126) [BZ #25204]
The problem was introduced in glibc 2.23, in commit
b9eb92ab05204df772eb4929eccd018637c9f3e9
("Add Prefer_MAP_32BIT_EXEC to map executable pages with MAP_32BIT").
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
index 1531437359c0ec06..82495780a06d8a05 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
+++ b/sysdeps/unix/sysv/linux/x86_64/64/dl-librecon.h
@@ -31,7 +31,8 @@
environment variable, LD_PREFER_MAP_32BIT_EXEC. */
#define EXTRA_LD_ENVVARS \
case 21: \
- if (memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
+ if (!__libc_enable_secure \
+ && memcmp (envline, "PREFER_MAP_32BIT_EXEC", 21) == 0) \
GLRO(dl_x86_cpu_features).feature[index_Prefer_MAP_32BIT_EXEC] \
|= bit_Prefer_MAP_32BIT_EXEC; \
break;

32
glibc-rh1775816.patch Normal file
View file

@ -0,0 +1,32 @@
commit cb61630ed712d033f54295f776967532d3f4b46a
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Nov 22 22:10:42 2019 +0100
libio: Disable vtable validation for pre-2.1 interposed handles [BZ #25203]
Commit c402355dfa7807b8e0adb27c009135a7e2b9f1b0 ("libio: Disable
vtable validation in case of interposition [BZ #23313]") only covered
the interposable glibc 2.1 handles, in libio/stdfiles.c. The
parallel code in libio/oldstdfiles.c needs similar detection logic.
Fixes (again) commit db3476aff19b75c4fdefbe65fcd5f0a90588ba51
("libio: Implement vtable verification [BZ #20191]").
Change-Id: Ief6f9f17e91d1f7263421c56a7dc018f4f595c21
diff --git a/libio/oldstdfiles.c b/libio/oldstdfiles.c
index 870cb0536c52024f..54d3e354fcbf257e 100644
--- a/libio/oldstdfiles.c
+++ b/libio/oldstdfiles.c
@@ -87,6 +87,11 @@ _IO_check_libio (void)
stdout->_vtable_offset = stderr->_vtable_offset =
((int) sizeof (struct _IO_FILE)
- (int) sizeof (struct _IO_FILE_complete));
+
+ if (_IO_stdin_.vtable != &_IO_old_file_jumps
+ || _IO_stdout_.vtable != &_IO_old_file_jumps
+ || _IO_stderr_.vtable != &_IO_old_file_jumps)
+ IO_set_accept_foreign_vtables (&_IO_vtable_check);
}
}

130
glibc-rh1812119-1.patch Normal file
View file

@ -0,0 +1,130 @@
Based on the following commit, but modified for rhel-7.9.
Added sysdeps/ieee754/ldbl-96/Makefile to contain test case.
Adjust test case to use #include <math_private.h>.
commit 9333498794cde1d5cca518badf79533a24114b6f
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Feb 12 23:31:56 2020 +0000
Avoid ldbl-96 stack corruption from range reduction of pseudo-zero (bug 25487).
Bug 25487 reports stack corruption in ldbl-96 sinl on a pseudo-zero
argument (an representation where all the significand bits, including
the explicit high bit, are zero, but the exponent is not zero, which
is not a valid representation for the long double type).
Although this is not a valid long double representation, existing
practice in this area (see bug 4586, originally marked invalid but
subsequently fixed) is that we still seek to avoid invalid memory
accesses as a result, in case of programs that treat arbitrary binary
data as long double representations, although the invalid
representations of the ldbl-96 format do not need to be consistently
handled the same as any particular valid representation.
This patch makes the range reduction detect pseudo-zero and unnormal
representations that would otherwise go to __kernel_rem_pio2, and
returns a NaN for them instead of continuing with the range reduction
process. (Pseudo-zero and unnormal representations whose unbiased
exponent is less than -1 have already been safely returned from the
function before this point without going through the rest of range
reduction.) Pseudo-zero representations would previously result in
the value passed to __kernel_rem_pio2 being all-zero, which is
definitely unsafe; unnormal representations would previously result in
a value passed whose high bit is zero, which might well be unsafe
since that is not a form of input expected by __kernel_rem_pio2.
Tested for x86_64.
diff -urN a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c
--- a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c 2012-12-24 22:02:13.000000000 -0500
+++ b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c 2021-01-06 20:39:13.502241328 -0500
@@ -210,6 +210,18 @@
return 0;
}
+ if ((i0 & 0x80000000) == 0)
+ {
+ /* Pseudo-zero and unnormal representations are not valid
+ representations of long double. We need to avoid stack
+ corruption in __kernel_rem_pio2, which expects input in a
+ particular normal form, but those representations do not need
+ to be consistently handled like any particular floating-point
+ value. */
+ y[1] = y[0] = __builtin_nanl ("");
+ return 0;
+ }
+
/* Split the 64 bits of the mantissa into three 24-bit integers
stored in a double array. */
exp = j0 - 23;
diff -urN a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
--- a/sysdeps/ieee754/ldbl-96/Makefile 1969-12-31 19:00:00.000000000 -0500
+++ b/sysdeps/ieee754/ldbl-96/Makefile 2021-01-06 20:55:49.163141757 -0500
@@ -0,0 +1,22 @@
+# Makefile for sysdeps/ieee754/ldbl-96.
+# Copyright (C) 2016-2021 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
+# <https://www.gnu.org/licenses/>.
+
+ifeq ($(subdir),math)
+tests += test-sinl-pseudo
+CFLAGS-test-sinl-pseudo.c += -fstack-protector-all
+endif
diff -urN a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c
--- a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c 1969-12-31 19:00:00.000000000 -0500
+++ b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c 2021-01-05 16:27:24.658596782 -0500
@@ -0,0 +1,41 @@
+/* Test sinl for pseudo-zeros and unnormals for ldbl-96 (bug 25487).
+ Copyright (C) 2020 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include <math_private.h>
+#include <stdint.h>
+
+static int
+do_test (void)
+{
+ for (int i = 0; i < 64; i++)
+ {
+ uint64_t sig = i == 63 ? 0 : 1ULL << i;
+ long double ld;
+ SET_LDOUBLE_WORDS (ld, 0x4141,
+ sig >> 32, sig & 0xffffffffULL);
+ /* The requirement is that no stack overflow occurs when the
+ pseudo-zero or unnormal goes through range reduction. */
+ volatile long double ldr;
+ ldr = sinl (ld);
+ (void) ldr;
+ }
+ return 0;
+}
+
+#include <support/test-driver.c>

22
glibc-rh1812119-2.patch Normal file
View file

@ -0,0 +1,22 @@
Based on the following commit, but modified for rhel-7.9.
commit c10acd40262486dac597001aecc20ad9d3bd0e4a
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Feb 13 17:01:15 2020 +0100
math/test-sinl-pseudo: Use stack protector only if available
This fixes commit 9333498794cde1d5cca518bad ("Avoid ldbl-96 stack
corruption from range reduction of pseudo-zero (bug 25487).").
diff -urN a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile
--- a/sysdeps/ieee754/ldbl-96/Makefile 2021-01-06 20:55:49.163141757 -0500
+++ b/sysdeps/ieee754/ldbl-96/Makefile 2021-01-06 20:58:06.612989216 -0500
@@ -18,5 +18,7 @@
ifeq ($(subdir),math)
tests += test-sinl-pseudo
+ifeq ($(have-ssp),yes)
CFLAGS-test-sinl-pseudo.c += -fstack-protector-all
endif
+endif # $(subdir) == math

201
glibc-rh1834816.patch Normal file
View file

@ -0,0 +1,201 @@
commit 790b8dda4455865cb8c3a47801f4304c1a43baf6
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue May 19 14:09:38 2020 +0200
nss_compat: internal_end*ent may clobber errno, hiding ERANGE [BZ #25976]
During cleanup, before returning from get*_r functions, the end*ent
calls must not change errno. Otherwise, an ERANGE error from the
underlying implementation can be hidden, causing unexpected lookup
failures. This commit introduces an internal_end*ent_noerror
function which saves and restore errno, and marks the original
internal_end*ent function as warn_unused_result, so that it is used
only in contexts were errors from it can be handled explicitly.
Reviewed-by: DJ Delorie <dj@redhat.com>
Conflicts:
nss/nss_compat/compat-grp.c
nss/nss_compat/compat-initgroups.c
nss/nss_compat/compat-pwd.c
nss/nss_compat/compat-spwd.c
(Missing backport of nss_compat move.)
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c
index 6f6ce12ff6d9af8b..48e6dea6cdcf65d1 100644
--- a/nis/nss_compat/compat-grp.c
+++ b/nis/nss_compat/compat-grp.c
@@ -191,7 +191,7 @@ _nss_compat_setgrent (int stayopen)
}
-static enum nss_status
+static enum nss_status __attribute_warn_unused_result__
internal_endgrent (ent_t *ent)
{
if (nss_endgrent)
@@ -215,6 +215,15 @@ internal_endgrent (ent_t *ent)
return NSS_STATUS_SUCCESS;
}
+/* Like internal_endgrent, but preserve errno in all cases. */
+static void
+internal_endgrent_noerror (ent_t *ent)
+{
+ int saved_errno = errno;
+ enum nss_status unused __attribute__ ((unused)) = internal_endgrent (ent);
+ __set_errno (saved_errno);
+}
+
enum nss_status
_nss_compat_endgrent (void)
{
@@ -532,7 +541,7 @@ _nss_compat_getgrnam_r (const char *name, struct group *grp,
if (result == NSS_STATUS_SUCCESS)
result = internal_getgrnam_r (name, grp, &ent, buffer, buflen, errnop);
- internal_endgrent (&ent);
+ internal_endgrent_noerror (&ent);
return result;
}
@@ -661,7 +670,7 @@ _nss_compat_getgrgid_r (gid_t gid, struct group *grp,
if (result == NSS_STATUS_SUCCESS)
result = internal_getgrgid_r (gid, grp, &ent, buffer, buflen, errnop);
- internal_endgrent (&ent);
+ internal_endgrent_noerror (&ent);
return result;
}
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 4aa23fda189f7e87..7b3cd1f74155cf72 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -182,7 +182,7 @@ internal_setgrent (ent_t *ent)
}
-static enum nss_status
+static enum nss_status __attribute_warn_unused_result__
internal_endgrent (ent_t *ent)
{
if (ent->stream != NULL)
@@ -206,6 +206,15 @@ internal_endgrent (ent_t *ent)
return NSS_STATUS_SUCCESS;
}
+/* Like internal_endgrent, but preserve errno in all cases. */
+static void
+internal_endgrent_noerror (ent_t *ent)
+{
+ int saved_errno = errno;
+ enum nss_status unused __attribute__ ((unused)) = internal_endgrent (ent);
+ __set_errno (saved_errno);
+}
+
/* Add new group record. */
static void
add_group (long int *start, long int *size, gid_t **groupsp, long int limit,
@@ -569,7 +578,7 @@ _nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
if (use_malloc)
free (tmpbuf);
- internal_endgrent (&intern);
+ internal_endgrent_noerror (&intern);
return status;
}
diff --git a/nis/nss_compat/compat-pwd.c b/nis/nss_compat/compat-pwd.c
index 85b79e084e25f06a..e0cb9cfa2d490d8f 100644
--- a/nis/nss_compat/compat-pwd.c
+++ b/nis/nss_compat/compat-pwd.c
@@ -309,7 +309,7 @@ _nss_compat_setpwent (int stayopen)
}
-static enum nss_status
+static enum nss_status __attribute_warn_unused_result__
internal_endpwent (ent_t *ent)
{
if (nss_endpwent)
@@ -340,6 +340,15 @@ internal_endpwent (ent_t *ent)
return NSS_STATUS_SUCCESS;
}
+/* Like internal_endpwent, but preserve errno in all cases. */
+static void
+internal_endpwent_noerror (ent_t *ent)
+{
+ int saved_errno = errno;
+ enum nss_status unused __attribute__ ((unused)) = internal_endpwent (ent);
+ __set_errno (saved_errno);
+}
+
enum nss_status
_nss_compat_endpwent (void)
{
@@ -872,7 +881,7 @@ _nss_compat_getpwnam_r (const char *name, struct passwd *pwd,
if (result == NSS_STATUS_SUCCESS)
result = internal_getpwnam_r (name, pwd, &ent, buffer, buflen, errnop);
- internal_endpwent (&ent);
+ internal_endpwent_noerror (&ent);
return result;
}
@@ -1111,7 +1120,7 @@ _nss_compat_getpwuid_r (uid_t uid, struct passwd *pwd,
if (result == NSS_STATUS_SUCCESS)
result = internal_getpwuid_r (uid, pwd, &ent, buffer, buflen, errnop);
- internal_endpwent (&ent);
+ internal_endpwent_noerror (&ent);
return result;
}
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c
index c1498c3e1f908f83..8ec5d88d30b4df57 100644
--- a/nis/nss_compat/compat-spwd.c
+++ b/nis/nss_compat/compat-spwd.c
@@ -265,7 +265,7 @@ _nss_compat_setspent (int stayopen)
}
-static enum nss_status
+static enum nss_status __attribute_warn_unused_result__
internal_endspent (ent_t *ent)
{
if (nss_endspent)
@@ -297,6 +297,15 @@ internal_endspent (ent_t *ent)
return NSS_STATUS_SUCCESS;
}
+/* Like internal_endspent, but preserve errno in all cases. */
+static void
+internal_endspent_noerror (ent_t *ent)
+{
+ int saved_errno = errno;
+ enum nss_status unused __attribute__ ((unused)) = internal_endspent (ent);
+ __set_errno (saved_errno);
+}
+
enum nss_status
_nss_compat_endspent (void)
{
@@ -311,7 +320,6 @@ _nss_compat_endspent (void)
return result;
}
-
static enum nss_status
getspent_next_nss_netgr (const char *name, struct spwd *result, ent_t *ent,
char *group, char *buffer, size_t buflen,
@@ -836,7 +844,7 @@ _nss_compat_getspnam_r (const char *name, struct spwd *pwd,
if (result == NSS_STATUS_SUCCESS)
result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
- internal_endspent (&ent);
+ internal_endspent_noerror (&ent);
return result;
}

134
glibc-rh1869380.patch Normal file
View file

@ -0,0 +1,134 @@
This is a custom patch for RHEL 7 to fix CVE-2020-29573 and includes
parts of 41290b6e842a2adfbda77a49abfacb0db2d63bfb, and
681900d29683722b1cb0a8e565a0585846ec5a61.
We had a discussion[1] upstream about the treatment of unnormal long
double numbers in glibc and gcc and there is general consensus that
unnormal numbers (pseudos in general) ought to be treated like NaNs
without the guarantee that they will always be treated correctly in
glibc. That is, there is agreement that we should fix bugs and
security issues arising from such inputs but not guarantee glibc
behaviour with such inputs since the latter would involve extensive
coverage.
Now on to #1869380, this crash in printf manifests itself only in
RHEL-7 and not in any other Red Hat distribution because later
versions of glibc use __builtin_nan from gcc, which always recognizes
pseudos as NaN. Based on that and the recent consensus, the correct
way to fix #1869380 appears to be to treat unnormals as NaN instead of
fixing the unnormal representation as in this patch[2].
[1] https://sourceware.org/pipermail/libc-alpha/2020-November/119949.html
[2] https://sourceware.org/pipermail/libc-alpha/2020-September/117779.html
Co-authored-by: Siddhesh Poyarekar <siddhesh@redhat.com>
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index d0e082494af6b0a3..60b143571065a082 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -151,6 +151,28 @@ static wchar_t *group_number (wchar_t *buf, wchar_t *bufend,
wchar_t thousands_sep, int ngroups)
internal_function;
+static __always_inline int
+isnanl_or_pseudo (long double in)
+{
+#if defined __x86_64__ || defined __i386__
+ union
+ {
+ long double f;
+ struct
+ {
+ uint64_t low;
+ uint64_t high;
+ } u;
+ } ldouble;
+
+ ldouble.f = in;
+
+ return __isnanl (in) || (ldouble.u.low & 0x8000000000000000) == 0;
+#else
+ return __isnanl (in);
+#endif
+}
+
int
__printf_fp_l (FILE *fp, locale_t loc,
@@ -335,7 +357,7 @@ __printf_fp_l (FILE *fp, locale_t loc,
/* Check for special values: not a number or infinity. */
int res;
- if (__isnanl (fpnum.ldbl))
+ if (isnanl_or_pseudo (fpnum.ldbl))
{
is_neg = signbit (fpnum.ldbl);
if (isupper (info->spec))
diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
index c26533245e8a8103..f1da941dbbadadb3 100644
--- a/sysdeps/x86/Makefile
+++ b/sysdeps/x86/Makefile
@@ -18,3 +18,7 @@ sysdep-dl-routines += dl-get-cpu-features
tests += tst-get-cpu-features
tests-static += tst-get-cpu-features-static
endif
+
+ifeq ($(subdir),math)
+tests += tst-ldbl-nonnormal-printf
+endif # $(subdir) == math
diff --git a/sysdeps/x86/tst-ldbl-nonnormal-printf.c b/sysdeps/x86/tst-ldbl-nonnormal-printf.c
new file mode 100644
index 0000000000000000..e4e3e428747488b9
--- /dev/null
+++ b/sysdeps/x86/tst-ldbl-nonnormal-printf.c
@@ -0,0 +1,49 @@
+/* Test printf with x86-specific non-normal long double value.
+ Copyright (C) 2020-2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <string.h>
+#include <support/check.h>
+
+/* Fill the stack with non-zero values. This makes a crash in
+ snprintf more likely. */
+static void __attribute__ ((noinline, noclone))
+fill_stack (void)
+{
+ char buffer[65536];
+ memset (buffer, 0xc0, sizeof (buffer));
+ asm ("" ::: "memory");
+}
+
+static int
+do_test (void)
+{
+ fill_stack ();
+
+ long double value;
+ memcpy (&value, "\x00\x04\x00\x00\x00\x00\x00\x00\x00\x04", 10);
+
+ char buf[30];
+ int ret = snprintf (buf, sizeof (buf), "%Lg", value);
+ TEST_COMPARE (ret, strlen (buf));
+ TEST_COMPARE_STRING (buf, "nan");
+ return 0;
+}
+
+#include <support/test-driver.c>

28
glibc-rh1883162.patch Normal file
View file

@ -0,0 +1,28 @@
Use stat64 to detect presence of file that alters IFUNC selection.
This avoids problems in NVMe drives where 32-bit stat would fail
because the device ID doesn't fit into teh truncated 16-bit dev_t.
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
index 4e2e6fabb39ab600..e3b8167ae0669f00 100644
--- a/sysdeps/x86/cpu-features.h
+++ b/sysdeps/x86/cpu-features.h
@@ -184,11 +184,19 @@
static bool __attribute__ ((unused))
use_unaligned_strstr (void)
{
+# if defined __x86_64__
struct stat unaligned_strstr_etc_sysconfig_file;
+# else
+ struct stat64 unaligned_strstr_etc_sysconfig_file;
+# endif
/* TLS may not have been set up yet, so avoid using stat since it tries to
set errno. */
+# if defined __x86_64__
return INTERNAL_SYSCALL (stat, , 2,
+# else
+ return INTERNAL_SYSCALL (stat64, , 2,
+# endif
ENABLE_STRSTR_UNALIGNED_PATHNAME,
&unaligned_strstr_etc_sysconfig_file) == 0;
}

131
glibc-rh1912543.patch Normal file
View file

@ -0,0 +1,131 @@
commit ee7a3144c9922808181009b7b3e50e852fb4999b
Author: Andreas Schwab <schwab@suse.de>
Date: Mon Dec 21 08:56:43 2020 +0530
Fix buffer overrun in EUC-KR conversion module (bz #24973)
The byte 0xfe as input to the EUC-KR conversion denotes a user-defined
area and is not allowed. The from_euc_kr function used to skip two bytes
when told to skip over the unknown designation, potentially running over
the buffer end.
Conflicts:
iconvdata/Makefile
Textual conflict in iconvdata/Makefile due to tests differences.
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 4ec2741cdc..85009f3390 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -73,7 +73,7 @@ modules.so := $(addsuffix .so, $(modules))
ifeq (yes,$(build-shared))
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
- bug-iconv10 bug-iconv11 bug-iconv12
+ bug-iconv10 bug-iconv11 bug-iconv12 bug-iconv13
ifeq ($(have-thread-library),yes)
tests += bug-iconv3
endif
diff --git a/iconvdata/bug-iconv13.c b/iconvdata/bug-iconv13.c
new file mode 100644
index 0000000000..87aaff398e
--- /dev/null
+++ b/iconvdata/bug-iconv13.c
@@ -0,0 +1,53 @@
+/* bug 24973: Test EUC-KR module
+ Copyright (C) 2020 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <iconv.h>
+#include <stdio.h>
+#include <support/check.h>
+
+static int
+do_test (void)
+{
+ iconv_t cd = iconv_open ("UTF-8//IGNORE", "EUC-KR");
+ TEST_VERIFY_EXIT (cd != (iconv_t) -1);
+
+ /* 0xfe (->0x7e : row 94) and 0xc9 (->0x49 : row 41) are user-defined
+ areas, which are not allowed and should be skipped over due to
+ //IGNORE. The trailing 0xfe also is an incomplete sequence, which
+ should be checked first. */
+ char input[4] = { '\xc9', '\xa1', '\0', '\xfe' };
+ char *inptr = input;
+ size_t insize = sizeof (input);
+ char output[4];
+ char *outptr = output;
+ size_t outsize = sizeof (output);
+
+ /* This used to crash due to buffer overrun. */
+ TEST_VERIFY (iconv (cd, &inptr, &insize, &outptr, &outsize) == (size_t) -1);
+ TEST_VERIFY (errno == EINVAL);
+ /* The conversion should produce one character, the converted null
+ character. */
+ TEST_VERIFY (sizeof (output) - outsize == 1);
+
+ TEST_VERIFY_EXIT (iconv_close (cd) != -1);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
index b0d56cf3ee..1045bae926 100644
--- a/iconvdata/euc-kr.c
+++ b/iconvdata/euc-kr.c
@@ -80,11 +80,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
\
if (ch <= 0x9f) \
++inptr; \
- /* 0xfe(->0x7e : row 94) and 0xc9(->0x59 : row 41) are \
- user-defined areas. */ \
- else if (__builtin_expect (ch == 0xa0, 0) \
- || __builtin_expect (ch > 0xfe, 0) \
- || __builtin_expect (ch == 0xc9, 0)) \
+ else if (__glibc_unlikely (ch == 0xa0)) \
{ \
/* This is illegal. */ \
STANDARD_FROM_LOOP_ERR_HANDLER (1); \
diff --git a/iconvdata/ksc5601.h b/iconvdata/ksc5601.h
index d3eb3a4ff8..f5cdc72797 100644
--- a/iconvdata/ksc5601.h
+++ b/iconvdata/ksc5601.h
@@ -50,15 +50,15 @@ ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
unsigned char ch2;
int idx;
+ if (avail < 2)
+ return 0;
+
/* row 94(0x7e) and row 41(0x49) are user-defined area in KS C 5601 */
if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) >= 0x7e
|| (ch - offset) == 0x49)
return __UNKNOWN_10646_CHAR;
- if (avail < 2)
- return 0;
-
ch2 = (*s)[1];
if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
return __UNKNOWN_10646_CHAR;
--
2.29.2

74
glibc-rh1925204-1.patch Normal file
View file

@ -0,0 +1,74 @@
Fixes regression introduced by glibc-rh1869380.patch. This fix
backports the upstream fixed implementation of __isnanl to use only in
printf_fp.c so that the fix remains localized and does not affect
other callers of __isnanl.
diff --git a/include/math.h b/include/math.h
index 0925d604ea3552a7..4eddc81be0dccad9 100644
--- a/include/math.h
+++ b/include/math.h
@@ -6,6 +6,11 @@
/* Now define the internal interfaces. */
extern int __matherr (struct exception *__exc);
+# if IS_IN (libc)
+extern int __isnanl_pseudo (long double);
+hidden_proto (__isnanl_pseudo)
+#endif
+
# if IS_IN (libc) || IS_IN (libm)
hidden_proto (__finite)
hidden_proto (__isinf)
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 60b143571065a082..af842156eaa3eace 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -155,19 +155,7 @@ static __always_inline int
isnanl_or_pseudo (long double in)
{
#if defined __x86_64__ || defined __i386__
- union
- {
- long double f;
- struct
- {
- uint64_t low;
- uint64_t high;
- } u;
- } ldouble;
-
- ldouble.f = in;
-
- return __isnanl (in) || (ldouble.u.low & 0x8000000000000000) == 0;
+ return __isnanl_pseudo (in);
#else
return __isnanl (in);
#endif
diff --git a/sysdeps/i386/fpu/s_isnanl.c b/sysdeps/i386/fpu/s_isnanl.c
index 816396d8fbc79dde..dc83d7a85fb3318b 100644
--- a/sysdeps/i386/fpu/s_isnanl.c
+++ b/sysdeps/i386/fpu/s_isnanl.c
@@ -41,3 +41,23 @@ 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

252
glibc-rh1925204-2.patch Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.17-c758a686 %define glibcsrcdir glibc-2.17-c758a686
%define glibcversion 2.17 %define glibcversion 2.17
%define glibcrelease 292%{?dist} %define glibcrelease 323.1%{?dist}.1
############################################################################## ##############################################################################
# We support the following options: # We support the following options:
# --with/--without, # --with/--without,
@ -149,26 +149,16 @@ Source1: %{glibcsrcdir}-releng.tar.gz
Source2: verify.md5 Source2: verify.md5
############################################################################## ##############################################################################
# Start of glibc patches
##############################################################################
# 0000-0999 for patches which are unlikely to ever go upstream or which
# have not been analyzed to see if they ought to go upstream yet.
# #
# 1000-2000 for patches that are already upstream. # Add your new glibc patches to the *end* of the list of patches.
# Please treat the patch list as an immutable history.
# #
# 2000-3000 for patches that are awaiting upstream approval # During the initial development of RHEL7 we used to have patch group numbers
# # but these turned out to be insufficient to manage the patch list and we no
# Yes, I realize this means some gratutious changes as patches to from # longer use them, but it does mean that early patches are listed in one
# one bucket to another, but I find this scheme makes it easier to track # order and applied in another. We could renumber all the patches in the right
# the upstream divergence and patches needing approval. # order but it is not required, just add patches to the *end* of the list of
# # patches and include all relevant information inside the patch header.
# Note that we can still apply the patches in any order we see fit, so
# the changes from one bucket to another won't necessarily result in needing
# to twiddle the patch because of dependencies on prior patches and the like.
##############################################################################
#
# Patches that are unlikely to go upstream or not yet analyzed.
# #
############################################################################## ##############################################################################
@ -258,11 +248,11 @@ Patch0068: glibc-rh1349982.patch
# These changes were brought forward from RHEL 6 for compatibility # These changes were brought forward from RHEL 6 for compatibility
Patch0069: glibc-rh1448107.patch Patch0069: glibc-rh1448107.patch
##############################################################################
# # Armhfp build issue
# Patches from upstream 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 Patch1000: glibc-rh905877.patch
Patch1001: glibc-rh958652.patch Patch1001: glibc-rh958652.patch
@ -1164,6 +1154,132 @@ Patch1902: glibc-rh1523119-compat-symbols.patch
# RHBZ #1609067: Backfort of upstream [#15804] - fix race condition in pldd # RHBZ #1609067: Backfort of upstream [#15804] - fix race condition in pldd
Patch1903: glibc-rh1609067.patch Patch1903: glibc-rh1609067.patch
# RHBZ #1672771:
Patch1904: glibc-rh1672771.patch
# http://sourceware.org/ml/libc-alpha/2012-12/msg00103.html
# Not upstream as of 2014-02-27
Patch2007: glibc-rh697421.patch
# Not upstream as of 2014-02-27
Patch2011: glibc-rh757881.patch
# Not upstream as of 2014-02-27
Patch2013: glibc-rh741105.patch
# Upstream BZ 14247
# Not upstream as of 2014-02-27.
Patch2023: glibc-rh827510.patch
# Upstream BZ 14185
# Not upstream as of 2014-02-27.
Patch2027: glibc-rh819430.patch
# Fix nscd to use permission names not constants.
# Not upstream as of 2014-02-27.
Patch2048: glibc-rh1025934.patch
# Upstream BZ 16398.
Patch2051: glibc-rh1048036.patch
Patch2052: glibc-rh1048123.patch
# Upstream BZ 16680
Patch2053: glibc-rh1074410-2.patch
# Upstream BZ 15493.
# Upstream as of 2013-03-20
Patch2055: glibc-rh1073667.patch
Patch2060: glibc-aarch64-rh1076760.patch
# Include pthread.h in rtkaio/tst-aiod2.c and rtkaio/tst-aiod3.c.
Patch2062: glibc-rtkaio-inc-pthread.patch
Patch2063: glibc-rh1084089.patch
Patch2064: glibc-rh1161666.patch
Patch2065: glibc-rh1156331.patch
# Upstream BZ 18557: Fix ruserok scalability issues.
Patch2066: glibc-rh1216246.patch
# Backport of fix for malloc arena free list management (upstream bug 19048)
# The preparatory patch removes !PER_THREAD conditional code.
Patch20670: glibc-rh1276753-0.patch
Patch2067: glibc-rh1276753.patch
# Backport to fix ld.so crash when audit modules provide path (upstream bug 18251)
Patch2068: glibc-rh1211100.patch
# aarch64 MINSIGSTKSZ/SIGSTKSZ fix
Patch2069: glibc-rh1335629.patch
Patch2070: glibc-rh1335925-1.patch
Patch2071: glibc-rh1335925-2.patch
Patch2072: glibc-rh1335925-3.patch
Patch2073: glibc-rh1335925-4.patch
# Do not set initgroups in default nsswitch.conf
Patch2074: glibc-rh1366569.patch
# Various nss_db fixes
Patch2075: glibc-rh1318890.patch
Patch2076: glibc-rh1213603.patch
Patch2077: glibc-rh1370630.patch
# Add internal-only support for O_TMPFILE.
Patch2078: glibc-rh1330705-1.patch
Patch2079: glibc-rh1330705-2.patch
Patch2080: glibc-rh1330705-3.patch
Patch2081: glibc-rh1330705-4.patch
Patch2082: glibc-rh1330705-5.patch
# The following patch *removes* the public definition of O_TMPFILE.
Patch2083: glibc-rh1330705-6.patch
# getaddrinfo with nscd fixes
Patch2084: glibc-rh1324568.patch
# RHBZ #1404435 - Remove power8 platform directory
Patch2085: glibc-rh1404435.patch
# RHBZ #1144516 - aarch64 profil fix
Patch2086: glibc-rh1144516.patch
# RHBZ #1392540 - Add "sss" service to the automount database in nsswitch.conf
Patch2087: glibc-rh1392540.patch
# RHBZ #1452721: Avoid large allocas in the dynamic linker
Patch2088: glibc-rh1452721-1.patch
Patch2089: glibc-rh1452721-2.patch
Patch2090: glibc-rh1452721-3.patch
Patch2091: glibc-rh1452721-4.patch
Patch2092: glibc-rh677316-libc-pointer-arith.patch
Patch2093: glibc-rh677316-libc-lock.patch
Patch2094: glibc-rh677316-libc-diag.patch
Patch2095: glibc-rh677316-check_mul_overflow_size_t.patch
Patch2096: glibc-rh677316-res_state.patch
Patch2097: glibc-rh677316-qsort_r.patch
Patch2098: glibc-rh677316-fgets_unlocked.patch
Patch2099: glibc-rh677316-in6addr_any.patch
Patch2100: glibc-rh677316-netdb-reentrant.patch
Patch2101: glibc-rh677316-h_errno.patch
Patch2102: glibc-rh677316-scratch_buffer.patch
Patch2103: glibc-rh677316-mtrace.patch
Patch2104: glibc-rh677316-dynarray.patch
Patch2105: glibc-rh677316-alloc_buffer.patch
Patch2106: glibc-rh677316-RES_USE_INET6.patch
Patch2107: glibc-rh677316-inet_pton.patch
Patch2108: glibc-rh677316-inet_pton-zeros.patch
Patch2109: glibc-rh677316-hesiod.patch
Patch2110: glibc-rh677316-resolv.patch
Patch2111: glibc-rh677316-legacy.patch
Patch2112: glibc-rh1498566.patch
Patch2113: glibc-rh1445644.patch
Patch2114: glibc-rh1471405.patch
Patch2500: glibc-rh1505492-nscd_stat.patch Patch2500: glibc-rh1505492-nscd_stat.patch
Patch2501: glibc-rh1564638.patch Patch2501: glibc-rh1564638.patch
Patch2502: glibc-rh1566623.patch Patch2502: glibc-rh1566623.patch
@ -1479,139 +1595,59 @@ Patch2806: glibc-rh1555189-1.patch
Patch2807: glibc-rh1555189-2.patch Patch2807: glibc-rh1555189-2.patch
Patch2808: glibc-rh1427734-1.patch Patch2808: glibc-rh1427734-1.patch
Patch2809: glibc-rh1427734-2.patch Patch2809: glibc-rh1427734-2.patch
Patch2810: glibc-rh1414263.patch
Patch2811: glibc-rh1406732-1.patch
Patch2812: glibc-rh1406732-2.patch
Patch2813: glibc-rh1406732-3.patch
Patch2814: glibc-rh1406732-4.patch
Patch2815: glibc-rh1406732-5.patch
Patch2816: glibc-rh1670041.patch
Patch2817: glibc-rh1451308.patch
Patch2818: glibc-rh1636229-1.patch
Patch2819: glibc-rh1636229-2.patch
Patch2820: glibc-rh1636229-3.patch
Patch2821: glibc-rh1636229-4.patch
Patch2822: glibc-rh1579451.patch
Patch2823: glibc-rh1634021.patch
Patch2824: glibc-rh1691534-1.patch
Patch2825: glibc-rh1691534-2.patch
Patch2826: glibc-rh1698015.patch
Patch2827: glibc-rh1065574-1.patch
Patch2828: glibc-rh1065574-2.patch
Patch2829: glibc-rh1065574-3.patch
Patch2830: glibc-rh1065574-4.patch
Patch2831: glibc-rh1065574-5.patch
Patch2832: glibc-rh1065574-6.patch
Patch2833: glibc-rh1065574-7.patch
Patch2834: glibc-rh1484832.patch
Patch2835: glibc-rh1740039-1.patch
Patch2836: glibc-rh1740039-2.patch
Patch2837: glibc-rh1775599.patch
Patch2838: glibc-rh1235112.patch
Patch2839: glibc-rh1728915-1.patch
Patch2840: glibc-rh1728915-2.patch
Patch2842: glibc-rh1747465-1.patch
Patch2843: glibc-rh1747465-2.patch
Patch2844: glibc-rh1747465-3.patch
Patch2845: glibc-rh1747465-4.patch
Patch2846: glibc-rh1747465-5.patch
Patch2847: glibc-rh1747465-6.patch
Patch2848: glibc-rh1747465-7.patch
Patch2849: glibc-rh1747465-8.patch
Patch2850: glibc-rh1775816.patch
Patch2851: glibc-rh1763325.patch
Patch2852: glibc-rh1406732-6.patch
Patch2853: glibc-rh1834816.patch
Patch2854: glibc-rh1912543.patch
Patch2855: glibc-rh1869380.patch
Patch2856: glibc-rh1812119-1.patch
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
# Patches submitted, but not yet approved upstream.
#
##############################################################################
#
# Each should be associated with a BZ.
# Obviously we're not there right now, but that's the goal
#
# http://sourceware.org/ml/libc-alpha/2012-12/msg00103.html
# Not upstream as of 2014-02-27
Patch2007: glibc-rh697421.patch
# Not upstream as of 2014-02-27
Patch2011: glibc-rh757881.patch
# Not upstream as of 2014-02-27
Patch2013: glibc-rh741105.patch
# Upstream BZ 14247
# Not upstream as of 2014-02-27.
Patch2023: glibc-rh827510.patch
# Upstream BZ 14185
# Not upstream as of 2014-02-27.
Patch2027: glibc-rh819430.patch
# Fix nscd to use permission names not constants.
# Not upstream as of 2014-02-27.
Patch2048: glibc-rh1025934.patch
# Upstream BZ 16398.
Patch2051: glibc-rh1048036.patch
Patch2052: glibc-rh1048123.patch
# Upstream BZ 16680
Patch2053: glibc-rh1074410-2.patch
# Upstream BZ 15493.
# Upstream as of 2013-03-20
Patch2055: glibc-rh1073667.patch
Patch2060: glibc-aarch64-rh1076760.patch
# Include pthread.h in rtkaio/tst-aiod2.c and rtkaio/tst-aiod3.c.
Patch2062: glibc-rtkaio-inc-pthread.patch
Patch2063: glibc-rh1084089.patch
Patch2064: glibc-rh1161666.patch
Patch2065: glibc-rh1156331.patch
# Upstream BZ 18557: Fix ruserok scalability issues.
Patch2066: glibc-rh1216246.patch
# Backport of fix for malloc arena free list management (upstream bug 19048)
# The preparatory patch removes !PER_THREAD conditional code.
Patch20670: glibc-rh1276753-0.patch
Patch2067: glibc-rh1276753.patch
# Backport to fix ld.so crash when audit modules provide path (upstream bug 18251)
Patch2068: glibc-rh1211100.patch
# aarch64 MINSIGSTKSZ/SIGSTKSZ fix
Patch2069: glibc-rh1335629.patch
Patch2070: glibc-rh1335925-1.patch
Patch2071: glibc-rh1335925-2.patch
Patch2072: glibc-rh1335925-3.patch
Patch2073: glibc-rh1335925-4.patch
# Do not set initgroups in default nsswitch.conf
Patch2074: glibc-rh1366569.patch
# Various nss_db fixes
Patch2075: glibc-rh1318890.patch
Patch2076: glibc-rh1213603.patch
Patch2077: glibc-rh1370630.patch
# Add internal-only support for O_TMPFILE.
Patch2078: glibc-rh1330705-1.patch
Patch2079: glibc-rh1330705-2.patch
Patch2080: glibc-rh1330705-3.patch
Patch2081: glibc-rh1330705-4.patch
Patch2082: glibc-rh1330705-5.patch
# The following patch *removes* the public definition of O_TMPFILE.
Patch2083: glibc-rh1330705-6.patch
# getaddrinfo with nscd fixes
Patch2084: glibc-rh1324568.patch
# RHBZ #1404435 - Remove power8 platform directory
Patch2085: glibc-rh1404435.patch
# RHBZ #1144516 - aarch64 profil fix
Patch2086: glibc-rh1144516.patch
# RHBZ #1392540 - Add "sss" service to the automount database in nsswitch.conf
Patch2087: glibc-rh1392540.patch
# RHBZ #1452721: Avoid large allocas in the dynamic linker
Patch2088: glibc-rh1452721-1.patch
Patch2089: glibc-rh1452721-2.patch
Patch2090: glibc-rh1452721-3.patch
Patch2091: glibc-rh1452721-4.patch
Patch2092: glibc-rh677316-libc-pointer-arith.patch
Patch2093: glibc-rh677316-libc-lock.patch
Patch2094: glibc-rh677316-libc-diag.patch
Patch2095: glibc-rh677316-check_mul_overflow_size_t.patch
Patch2096: glibc-rh677316-res_state.patch
Patch2097: glibc-rh677316-qsort_r.patch
Patch2098: glibc-rh677316-fgets_unlocked.patch
Patch2099: glibc-rh677316-in6addr_any.patch
Patch2100: glibc-rh677316-netdb-reentrant.patch
Patch2101: glibc-rh677316-h_errno.patch
Patch2102: glibc-rh677316-scratch_buffer.patch
Patch2103: glibc-rh677316-mtrace.patch
Patch2104: glibc-rh677316-dynarray.patch
Patch2105: glibc-rh677316-alloc_buffer.patch
Patch2106: glibc-rh677316-RES_USE_INET6.patch
Patch2107: glibc-rh677316-inet_pton.patch
Patch2108: glibc-rh677316-inet_pton-zeros.patch
Patch2109: glibc-rh677316-hesiod.patch
Patch2110: glibc-rh677316-resolv.patch
Patch2111: glibc-rh677316-legacy.patch
Patch2112: glibc-rh1498566.patch
Patch2113: glibc-rh1445644.patch
Patch2114: glibc-rh1471405.patch
############################################################################## ##############################################################################
# End of glibc patches. # End of glibc patches.
@ -1820,12 +1856,6 @@ which is highly discouraged.
Summary: Header files for development using standard C libraries. Summary: Header files for development using standard C libraries.
Group: Development/Libraries Group: Development/Libraries
Provides: %{name}-headers(%{_target_cpu}) Provides: %{name}-headers(%{_target_cpu})
%ifarch x86_64
# If both -m32 and -m64 is to be supported on AMD64, x86_64 glibc-headers
# have to be installed, not i586 ones.
Obsoletes: %{name}-headers(i586)
Obsoletes: %{name}-headers(i686)
%endif
Requires(pre): kernel-headers Requires(pre): kernel-headers
Requires: kernel-headers >= 2.2.1, %{name} = %{version}-%{release} Requires: kernel-headers >= 2.2.1, %{name} = %{version}-%{release}
BuildRequires: kernel-headers >= 2.6.22 BuildRequires: kernel-headers >= 2.6.22
@ -1903,10 +1933,6 @@ Group: Development/Debug
AutoReqProv: no AutoReqProv: no
%ifarch %{debuginfocommonarches} %ifarch %{debuginfocommonarches}
Requires: glibc-debuginfo-common = %{version}-%{release} Requires: glibc-debuginfo-common = %{version}-%{release}
%else
%ifarch %{ix86} %{sparc}
Obsoletes: glibc-debuginfo-common
%endif
%endif %endif
%description debuginfo %description debuginfo
@ -2628,6 +2654,7 @@ package or when debugging this package.
%patch1901 -p1 %patch1901 -p1
%patch1902 -p1 %patch1902 -p1
%patch1903 -p1 %patch1903 -p1
%patch1904 -p1
%patch2500 -p1 %patch2500 -p1
%patch2501 -p1 %patch2501 -p1
%patch2502 -p1 %patch2502 -p1
@ -2941,7 +2968,65 @@ package or when debugging this package.
%patch2807 -p1 %patch2807 -p1
%patch2808 -p1 %patch2808 -p1
%patch2809 -p1 %patch2809 -p1
%patch2810 -p1
%patch2811 -p1
%patch2812 -p1
%patch2813 -p1
%patch2814 -p1
%patch2815 -p1
%patch2816 -p1
%patch2817 -p1
%patch2818 -p1
%patch2819 -p1
%patch2820 -p1
%patch2821 -p1
%patch2822 -p1
%patch2823 -p1
%patch2824 -p1
%patch2825 -p1
%patch2826 -p1
%patch2827 -p1
%patch2828 -p1
%patch2829 -p1
%patch2830 -p1
%patch2831 -p1
%patch2832 -p1
%patch2833 -p1
%patch2834 -p1
%patch2835 -p1
%patch2836 -p1
%patch2837 -p1
%patch2838 -p1
%patch2839 -p1
%patch2840 -p1
%patch2842 -p1
%patch2843 -p1
%patch2844 -p1
%patch2845 -p1
%patch2846 -p1
%patch2847 -p1
%patch2848 -p1
%patch2849 -p1
%patch2850 -p1
%patch2851 -p1
%patch2852 -p1
%patch2853 -p1
%patch2854 -p1
%patch2855 -p1
%patch2856 -p1
%patch2857 -p1
%patch2858 -p1
%patch2859 -p1
%patch2860 -p1
%ifarch %{arm}
%patch9998 -p1
%patch9999 -p1
%patch9997 -p1
%endif
%patch10001 -p1
%patch10002 -p1
############################################################################## ##############################################################################
# %%prep - Additional prep required... # %%prep - Additional prep required...
############################################################################## ##############################################################################
@ -3106,10 +3191,23 @@ build_CFLAGS="$BuildFlags -g -O3 $*"
# Some configure checks can spuriously fail for some architectures if # Some configure checks can spuriously fail for some architectures if
# unwind info is present # unwind info is present
configure_CFLAGS="$build_CFLAGS -fno-asynchronous-unwind-tables" configure_CFLAGS="$build_CFLAGS -fno-asynchronous-unwind-tables"
# See bug 1790475 for the history behind --disable-bind-now for ppc64.
# In summary: COPY relocations and BIND_NOW are incompatible on ppc64.
# The solution is to globally disable BIND_NOW hardening on ppc64 with
# --disable-bind-now and then use a downstream-only patch
# (glibc-rh1406732-6.patch) to partially enable BIND_NOW hardening for
# ppc64 to the level of hardening that works given the toolchain.
../configure CC="$GCC" CXX="$GXX" CFLAGS="$configure_CFLAGS" \ ../configure CC="$GCC" CXX="$GXX" CFLAGS="$configure_CFLAGS" \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--enable-add-ons=nptl$AddOns \ --enable-add-ons=nptl$AddOns \
--with-headers=%{_prefix}/include $EnableKernel --enable-bind-now \ --with-headers=%{_prefix}/include $EnableKernel \
%ifarch ppc64
--disable-bind-now \
%else
--enable-bind-now \
%endif
--build=%{target} \ --build=%{target} \
%ifarch %{multiarcharches} %ifarch %{multiarcharches}
--enable-multi-arch \ --enable-multi-arch \
@ -3441,7 +3539,19 @@ $olddir/build-%{target}/elf/ld.so \
--prefix ${RPM_BUILD_ROOT} --add-to-archive \ --prefix ${RPM_BUILD_ROOT} --add-to-archive \
*_* *_*
rm -rf *_* rm -rf *_*
mv locale-archive{,.tmpl} # Setup the locale-archive template. We copy the archive in place to
# keep the size of the file. Even though we mark the file with "ghost"
# the size is used by rpm to compute the required free space (see
# rhbz#1714888). We do this because there is a point in the install
# when build-locale-archive has copied 100% of the template into the
# new locale archive and so this consumes twice the amount of
# diskspace. Note that this doesn't account for copying existing
# compiled locales into the archive, this may consume even more disk
# space and we can't fix that issue. In upstream we have moved away
# from this process, removing build-locale-archive and installing a
# default locale-archive without modification, and leaving compiled
# locales as they are (without inclusion into the archive).
cp locale-archive{,.tmpl}
popd popd
%endif %endif
@ -3906,10 +4016,6 @@ touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services}
touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid} touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}
%endif %endif
%ifnarch %{auxarches}
> $RPM_BUILD_ROOT/%{_prefix}/lib/locale/locale-archive
%endif
mkdir -p $RPM_BUILD_ROOT/var/cache/ldconfig mkdir -p $RPM_BUILD_ROOT/var/cache/ldconfig
> $RPM_BUILD_ROOT/var/cache/ldconfig/aux-cache > $RPM_BUILD_ROOT/var/cache/ldconfig/aux-cache
@ -4057,7 +4163,7 @@ rm -f *.filelist*
%files -f common.filelist common %files -f common.filelist common
%defattr(-,root,root) %defattr(-,root,root)
%attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive.tmpl %attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive.tmpl
%attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %config(missingok,noreplace) %{_prefix}/lib/locale/locale-archive %attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %{_prefix}/lib/locale/locale-archive
%dir %attr(755,root,root) /etc/default %dir %attr(755,root,root) /etc/default
%verify(not md5 size mtime) %config(noreplace) /etc/default/nss %verify(not md5 size mtime) %config(noreplace) /etc/default/nss
%doc documentation/* %doc documentation/*
@ -4107,6 +4213,9 @@ rm -f *.filelist*
%endif %endif
%changelog %changelog
* Thu Sep 09 2021 Hang Zhao <1209176326@qq.com> - 2.17-323.1.1
- Update to glibc-2.17-323.1.al7.1
* Tue Apr 30 2019 Arjun Shankar <arjun@redhat.com> - 2.17-292 * Tue Apr 30 2019 Arjun Shankar <arjun@redhat.com> - 2.17-292
- Avoid iconv hang on invalid multi-byte sequences (#1427734) - Avoid iconv hang on invalid multi-byte sequences (#1427734)