From e1b9a6cb31a01f4661ce0e214b13fc8558e75501 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 3 Dec 2021 18:58:41 +0100 Subject: [PATCH] Import glibc-2.34-10.fc35 from f35 (#2026716) Resolves: #2026716 Resolves: #2020597 Resolves: #2007339 --- glibc-cs-path.patch | 43 +++++++-- glibc-upstream-2.34-44.patch | 177 +++++++++++++++++++++++++++++++++++ glibc-upstream-2.34-45.patch | 68 ++++++++++++++ glibc-upstream-2.34-46.patch | 41 ++++++++ glibc-upstream-2.34-47.patch | 102 ++++++++++++++++++++ glibc-upstream-2.34-48.patch | 97 +++++++++++++++++++ glibc-upstream-2.34-49.patch | 101 ++++++++++++++++++++ glibc.spec | 21 ++++- 8 files changed, 642 insertions(+), 8 deletions(-) create mode 100644 glibc-upstream-2.34-44.patch create mode 100644 glibc-upstream-2.34-45.patch create mode 100644 glibc-upstream-2.34-46.patch create mode 100644 glibc-upstream-2.34-47.patch create mode 100644 glibc-upstream-2.34-48.patch create mode 100644 glibc-upstream-2.34-49.patch diff --git a/glibc-cs-path.patch b/glibc-cs-path.patch index aafa741..40835d2 100644 --- a/glibc-cs-path.patch +++ b/glibc-cs-path.patch @@ -1,15 +1,44 @@ -Short description: Adjust CS_PATH return value. +Short description: Adjust CS_PATH and the test container layout. Author(s): Fedora glibc team Origin: PATCH Upstream status: not-needed -In Fedora we should return only /usr/bin because /bin is just a symlink -to /usr/bin after MoveToUsr transition (which glibc has not really -completed). +In Fedora we should return only /usr/bin as CS_PATH because /bin is just +a symlink to /usr/bin after MoveToUsr transition (which glibc has not +really completed). -diff -pruN a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h ---- a/sysdeps/unix/confstr.h 2012-12-25 08:32:13.000000000 +0530 -+++ b/sysdeps/unix/confstr.h 2014-09-05 20:02:55.698275219 +0530 +We also create /{bin,lib,lib64,sbin} in the test container as symbolic +links. This brings the test container in line with Fedora's filesystem +layout and avoids some test failures. For example, because Fedora's +CS_PATH is /usr/bin, tst-vfork3 will try to execute /usr/bin/echo in the +container. Without this change the container installs `echo' in /bin +not /usr/bin, causing the test to fail. + +diff --git a/Makefile b/Makefile +index a49870d3d1e636a9..feb2599203b10098 100644 +--- a/Makefile ++++ b/Makefile +@@ -598,9 +598,13 @@ $(tests-container) $(addsuffix /tests,$(subdirs)) : \ + $(objpfx)testroot.pristine/install.stamp : + test -d $(objpfx)testroot.pristine || \ + mkdir $(objpfx)testroot.pristine +- # We need a working /bin/sh for some of the tests. +- test -d $(objpfx)testroot.pristine/bin || \ +- mkdir $(objpfx)testroot.pristine/bin ++ # Set up symlinks to directories whose contents got moved to /usr ++ for moved in bin lib lib64 sbin; do \ ++ test -d $(objpfx)testroot.pristine/usr/$$moved || \ ++ mkdir -p $(objpfx)testroot.pristine/usr/$$moved ;\ ++ test -e $(objpfx)testroot.pristine/$$moved || \ ++ ln -s usr/$$moved $(objpfx)testroot.pristine/$$moved ;\ ++ done + # We need the compiled locale dir for localedef tests. + test -d $(objpfx)testroot.pristine/$(complocaledir) || \ + mkdir -p $(objpfx)testroot.pristine/$(complocaledir) +diff --git a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h +index 15859c3b2759878e..9b63b7f8069866fd 100644 +--- a/sysdeps/unix/confstr.h ++++ b/sysdeps/unix/confstr.h @@ -1 +1 @@ -#define CS_PATH "/bin:/usr/bin" +#define CS_PATH "/usr/bin" diff --git a/glibc-upstream-2.34-44.patch b/glibc-upstream-2.34-44.patch new file mode 100644 index 0000000..547da51 --- /dev/null +++ b/glibc-upstream-2.34-44.patch @@ -0,0 +1,177 @@ +commit f411207a833d0c49578ebe7062aee3660813ed5f +Author: Nikita Popov +Date: Tue Nov 2 13:21:42 2021 +0500 + + gconv: Do not emit spurious NUL character in ISO-2022-JP-3 (bug 28524) + + Bugfix 27256 has introduced another issue: + In conversion from ISO-2022-JP-3 encoding, it is possible + to force iconv to emit extra NUL character on internal state reset. + To do this, it is sufficient to feed iconv with escape sequence + which switches active character set. + The simplified check 'data->__statep->__count != ASCII_set' + introduced by the aforementioned bugfix picks that case and + behaves as if '\0' character has been queued thus emitting it. + + To eliminate this issue, these steps are taken: + * Restore original condition + '(data->__statep->__count & ~7) != ASCII_set'. + It is necessary since bits 0-2 may contain + number of buffered input characters. + * Check that queued character is not NUL. + Similar step is taken for main conversion loop. + + Bundled test case follows following logic: + * Try to convert ISO-2022-JP-3 escape sequence + switching active character set + * Reset internal state by providing NULL as input buffer + * Ensure that nothing has been converted. + + Signed-off-by: Nikita Popov + (cherry picked from commit ff012870b2c02a62598c04daa1e54632e020fd7d) + +diff --git a/iconvdata/Makefile b/iconvdata/Makefile +index c216f959df1413f8..d5507a048c6a6508 100644 +--- a/iconvdata/Makefile ++++ b/iconvdata/Makefile +@@ -1,4 +1,5 @@ + # Copyright (C) 1997-2021 Free Software Foundation, Inc. ++# Copyright (C) The GNU Toolchain Authors. + # This file is part of the GNU C Library. + + # The GNU C Library is free software; you can redistribute it and/or +@@ -74,7 +75,7 @@ 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 tst-iconv-big5-hkscs-to-2ucs4 \ +- bug-iconv13 bug-iconv14 ++ bug-iconv13 bug-iconv14 bug-iconv15 + ifeq ($(have-thread-library),yes) + tests += bug-iconv3 + endif +@@ -327,6 +328,8 @@ $(objpfx)bug-iconv12.out: $(addprefix $(objpfx), $(gconv-modules)) \ + $(addprefix $(objpfx),$(modules.so)) + $(objpfx)bug-iconv14.out: $(addprefix $(objpfx), $(gconv-modules)) \ + $(addprefix $(objpfx),$(modules.so)) ++$(objpfx)bug-iconv15.out: $(addprefix $(objpfx), $(gconv-modules)) \ ++ $(addprefix $(objpfx),$(modules.so)) + + $(objpfx)iconv-test.out: run-iconv-test.sh \ + $(addprefix $(objpfx), $(gconv-modules)) \ +diff --git a/iconvdata/bug-iconv15.c b/iconvdata/bug-iconv15.c +new file mode 100644 +index 0000000000000000..cc04bd0313a68786 +--- /dev/null ++++ b/iconvdata/bug-iconv15.c +@@ -0,0 +1,60 @@ ++/* Bug 28524: Conversion from ISO-2022-JP-3 with iconv ++ may emit spurious NUL character on state reset. ++ Copyright (C) The GNU Toolchain Authors. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ ++ ++#include ++#include ++#include ++ ++static int ++do_test (void) ++{ ++ char in[] = "\x1b(I"; ++ char *inbuf = in; ++ size_t inleft = sizeof (in) - 1; ++ char out[1]; ++ char *outbuf = out; ++ size_t outleft = sizeof (out); ++ iconv_t cd; ++ ++ cd = iconv_open ("UTF8", "ISO-2022-JP-3"); ++ TEST_VERIFY_EXIT (cd != (iconv_t) -1); ++ ++ /* First call to iconv should alter internal state. ++ Now, JISX0201_Kana_set is selected and ++ state value != ASCII_set. */ ++ TEST_VERIFY (iconv (cd, &inbuf, &inleft, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No bytes should have been added to ++ the output buffer at this point. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ /* Second call shall emit spurious NUL character in unpatched glibc. */ ++ TEST_VERIFY (iconv (cd, NULL, NULL, &outbuf, &outleft) != (size_t) -1); ++ ++ /* No characters are expected to be produced. */ ++ TEST_VERIFY (outbuf == out); ++ TEST_VERIFY (outleft == sizeof (out)); ++ ++ TEST_VERIFY_EXIT (iconv_close (cd) != -1); ++ ++ return 0; ++} ++ ++#include +diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c +index c8ba88cdc9fe9200..5fc0c0f7397935fe 100644 +--- a/iconvdata/iso-2022-jp-3.c ++++ b/iconvdata/iso-2022-jp-3.c +@@ -1,5 +1,6 @@ + /* Conversion module for ISO-2022-JP-3. + Copyright (C) 1998-2021 Free Software Foundation, Inc. ++ Copyright (C) The GNU Toolchain Authors. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1998, + and Bruno Haible , 2002. +@@ -81,20 +82,31 @@ enum + the output state to the initial state. This has to be done during the + flushing. */ + #define EMIT_SHIFT_TO_INIT \ +- if (data->__statep->__count != ASCII_set) \ ++ if ((data->__statep->__count & ~7) != ASCII_set) \ + { \ + if (FROM_DIRECTION) \ + { \ +- if (__glibc_likely (outbuf + 4 <= outend)) \ ++ uint32_t ch = data->__statep->__count >> 6; \ ++ \ ++ if (__glibc_unlikely (ch != 0)) \ + { \ +- /* Write out the last character. */ \ +- *((uint32_t *) outbuf) = data->__statep->__count >> 6; \ +- outbuf += sizeof (uint32_t); \ +- data->__statep->__count = ASCII_set; \ ++ if (__glibc_likely (outbuf + 4 <= outend)) \ ++ { \ ++ /* Write out the last character. */ \ ++ put32u (outbuf, ch); \ ++ outbuf += 4; \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ ++ else \ ++ /* We don't have enough room in the output buffer. */ \ ++ status = __GCONV_FULL_OUTPUT; \ + } \ + else \ +- /* We don't have enough room in the output buffer. */ \ +- status = __GCONV_FULL_OUTPUT; \ ++ { \ ++ data->__statep->__count &= 7; \ ++ data->__statep->__count |= ASCII_set; \ ++ } \ + } \ + else \ + { \ diff --git a/glibc-upstream-2.34-45.patch b/glibc-upstream-2.34-45.patch new file mode 100644 index 0000000..b2c69d5 --- /dev/null +++ b/glibc-upstream-2.34-45.patch @@ -0,0 +1,68 @@ +commit cf8c6a634c0a04a9f5d198ef05310f85f7338839 +Author: Florian Weimer +Date: Fri Nov 5 17:01:24 2021 +0100 + + elf: Earlier missing dynamic segment check in _dl_map_object_from_fd + + Separated debuginfo files have PT_DYNAMIC with p_filesz == 0. We + need to check for that before the _dl_map_segments call because + that could attempt to write to mappings that extend beyond the end + of the file, resulting in SIGBUS. + + Reviewed-by: H.J. Lu + (cherry picked from commit ea32ec354c65ddad11b82ca9d057010df13a9cea) + +diff --git a/elf/dl-load.c b/elf/dl-load.c +index 4445c28ef3fb4a7e..0976977fbdf21902 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -1130,6 +1130,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, + struct loadcmd loadcmds[l->l_phnum]; + size_t nloadcmds = 0; + bool has_holes = false; ++ bool empty_dynamic = false; + + /* The struct is initialized to zero so this is not necessary: + l->l_ld = 0; +@@ -1142,7 +1143,9 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, + segments are mapped in. We record the addresses it says + verbatim, and later correct for the run-time load address. */ + case PT_DYNAMIC: +- if (ph->p_filesz) ++ if (ph->p_filesz == 0) ++ empty_dynamic = true; /* Usually separate debuginfo. */ ++ else + { + /* Debuginfo only files from "objcopy --only-keep-debug" + contain a PT_DYNAMIC segment with p_filesz == 0. Skip +@@ -1265,6 +1268,13 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, + goto lose; + } + ++ /* This check recognizes most separate debuginfo files. */ ++ if (__glibc_unlikely ((l->l_ld == 0 && type == ET_DYN) || empty_dynamic)) ++ { ++ errstring = N_("object file has no dynamic section"); ++ goto lose; ++ } ++ + /* Length of the sections to be loaded. */ + maplength = loadcmds[nloadcmds - 1].allocend - loadcmds[0].mapstart; + +@@ -1282,15 +1292,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, + } + } + +- if (l->l_ld == 0) +- { +- if (__glibc_unlikely (type == ET_DYN)) +- { +- errstring = N_("object file has no dynamic section"); +- goto lose; +- } +- } +- else ++ if (l->l_ld != 0) + l->l_ld = (ElfW(Dyn) *) ((ElfW(Addr)) l->l_ld + l->l_addr); + + elf_get_dynamic_info (l); diff --git a/glibc-upstream-2.34-46.patch b/glibc-upstream-2.34-46.patch new file mode 100644 index 0000000..fa16e48 --- /dev/null +++ b/glibc-upstream-2.34-46.patch @@ -0,0 +1,41 @@ +commit a4f3bc23461e3f9f6053e827715984ba0d2e589a +Author: Florian Weimer +Date: Wed Nov 10 15:21:37 2021 +0100 + + s390: Use long branches across object boundaries (jgh instead of jh) + + Depending on the layout chosen by the linker, the 16-bit displacement + of the jh instruction is insufficient to reach the target label. + + Analysis of the linker failure was carried out by Nick Clifton. + + Reviewed-by: Carlos O'Donell + Reviewed-by: Stefan Liebler + (cherry picked from commit 98966749f2b418825ff2ea496a0ee89fe63d2cc8) + +diff --git a/sysdeps/s390/memmem-arch13.S b/sysdeps/s390/memmem-arch13.S +index c5c8d8c97efb3b9f..58df8cdb142a6b25 100644 +--- a/sysdeps/s390/memmem-arch13.S ++++ b/sysdeps/s390/memmem-arch13.S +@@ -41,7 +41,7 @@ ENTRY(MEMMEM_ARCH13) + # error The arch13 variant of memmem needs the z13 variant of memmem! + # endif + clgfi %r5,9 +- jh MEMMEM_Z13 ++ jgh MEMMEM_Z13 + + aghik %r0,%r5,-1 /* vll needs highest index. */ + bc 4,0(%r14) /* cc==1: return if needle-len == 0. */ +diff --git a/sysdeps/s390/strstr-arch13.S b/sysdeps/s390/strstr-arch13.S +index c7183e627c9fa986..222a6de91abb3fc6 100644 +--- a/sysdeps/s390/strstr-arch13.S ++++ b/sysdeps/s390/strstr-arch13.S +@@ -49,7 +49,7 @@ ENTRY(STRSTR_ARCH13) + # error The arch13 variant of strstr needs the z13 variant of strstr! + # endif + clgfi %r4,9 +- jh STRSTR_Z13 ++ jgh STRSTR_Z13 + + /* In case of a partial match, the vstrs instruction returns the index + of the partial match in a vector-register. Then we have to diff --git a/glibc-upstream-2.34-47.patch b/glibc-upstream-2.34-47.patch new file mode 100644 index 0000000..f23193a --- /dev/null +++ b/glibc-upstream-2.34-47.patch @@ -0,0 +1,102 @@ +commit bfe68fe3c475fe34bed4e017d6e63196c305c934 +Author: Florian Weimer +Date: Wed Nov 24 08:59:54 2021 +0100 + + nptl: Do not set signal mask on second setjmp return [BZ #28607] + + __libc_signal_restore_set was in the wrong place: It also ran + when setjmp returned the second time (after pthread_exit or + pthread_cancel). This is observable with blocked pending + signals during thread exit. + + Fixes commit b3cae39dcbfa2432b3f3aa28854d8ac57f0de1b8 + ("nptl: Start new threads with all signals blocked [BZ #25098]"). + + Reviewed-by: Adhemerval Zanella + (cherry picked from commit e186fc5a31e46f2cbf5ea1a75223b4412907f3d8) + +diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c +index bc213f0bc4e948bd..3db0c9fdf40ae2bf 100644 +--- a/nptl/pthread_create.c ++++ b/nptl/pthread_create.c +@@ -407,8 +407,6 @@ start_thread (void *arg) + unwind_buf.priv.data.prev = NULL; + unwind_buf.priv.data.cleanup = NULL; + +- __libc_signal_restore_set (&pd->sigmask); +- + /* Allow setxid from now onwards. */ + if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2)) + futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE); +@@ -418,6 +416,8 @@ start_thread (void *arg) + /* Store the new cleanup handler info. */ + THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf); + ++ __libc_signal_restore_set (&pd->sigmask); ++ + LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg); + + /* Run the code the user provided. */ +diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile +index df8943f4860a39d8..c65710169697ad95 100644 +--- a/sysdeps/pthread/Makefile ++++ b/sysdeps/pthread/Makefile +@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \ + tst-unload \ + tst-unwind-thread \ + tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \ ++ tst-pthread-exit-signal \ + tst-pthread-setuid-loop \ + tst-pthread_cancel-exited \ + tst-pthread_cancel-select-loop \ +diff --git a/sysdeps/pthread/tst-pthread-exit-signal.c b/sysdeps/pthread/tst-pthread-exit-signal.c +new file mode 100644 +index 0000000000000000..b4526fe663671068 +--- /dev/null ++++ b/sysdeps/pthread/tst-pthread-exit-signal.c +@@ -0,0 +1,45 @@ ++/* Test that pending signals are not delivered on thread exit (bug 28607). ++ Copyright (C) 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 ++ . */ ++ ++/* Due to bug 28607, pthread_kill (or pthread_cancel) restored the ++ signal mask during during thread exit, triggering the delivery of a ++ blocked pending signal (SIGUSR1 in this test). */ ++ ++#include ++#include ++ ++static void * ++threadfunc (void *closure) ++{ ++ sigset_t sigmask; ++ sigfillset (&sigmask); ++ xpthread_sigmask (SIG_SETMASK, &sigmask, NULL); ++ xpthread_kill (pthread_self (), SIGUSR1); ++ pthread_exit (NULL); ++ return NULL; ++} ++ ++static int ++do_test (void) ++{ ++ pthread_t thr = xpthread_create (NULL, threadfunc, NULL); ++ xpthread_join (thr); ++ return 0; ++} ++ ++#include diff --git a/glibc-upstream-2.34-48.patch b/glibc-upstream-2.34-48.patch new file mode 100644 index 0000000..31f08db --- /dev/null +++ b/glibc-upstream-2.34-48.patch @@ -0,0 +1,97 @@ +commit f988b7f228851370d1faa1e8f28d02f4b4e6dc46 +Author: Adhemerval Zanella +Date: Thu Nov 25 09:12:00 2021 -0300 + + linux: Use /proc/stat fallback for __get_nprocs_conf (BZ #28624) + + The /proc/statm fallback was removed by f13fb81ad3159 if sysfs is + not available, reinstate it. + + Checked on x86_64-linux-gnu. + (cherry-picked from commit 137ed5ac440a4d3cf4178ce97f349b349a9c2c66) + +diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c +index d70ed9586950615c..7fc6521942e87293 100644 +--- a/sysdeps/unix/sysv/linux/getsysstats.c ++++ b/sysdeps/unix/sysv/linux/getsysstats.c +@@ -108,6 +108,37 @@ next_line (int fd, char *const buffer, char **cp, char **re, + return res == *re ? NULL : res; + } + ++static int ++get_nproc_stat (char *buffer, size_t buffer_size) ++{ ++ char *buffer_end = buffer + buffer_size; ++ char *cp = buffer_end; ++ char *re = buffer_end; ++ ++ /* Default to an SMP system in case we cannot obtain an accurate ++ number. */ ++ int result = 2; ++ ++ const int flags = O_RDONLY | O_CLOEXEC; ++ int fd = __open_nocancel ("/proc/stat", flags); ++ if (fd != -1) ++ { ++ result = 0; ++ ++ char *l; ++ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL) ++ /* The current format of /proc/stat has all the cpu* entries ++ at the front. We assume here that stays this way. */ ++ if (strncmp (l, "cpu", 3) != 0) ++ break; ++ else if (isdigit (l[3])) ++ ++result; ++ ++ __close_nocancel_nostatus (fd); ++ } ++ ++ return result; ++} + + int + __get_nprocs (void) +@@ -163,30 +194,7 @@ __get_nprocs (void) + return result; + } + +- cp = buffer_end; +- re = buffer_end; +- +- /* Default to an SMP system in case we cannot obtain an accurate +- number. */ +- result = 2; +- +- fd = __open_nocancel ("/proc/stat", flags); +- if (fd != -1) +- { +- result = 0; +- +- while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL) +- /* The current format of /proc/stat has all the cpu* entries +- at the front. We assume here that stays this way. */ +- if (strncmp (l, "cpu", 3) != 0) +- break; +- else if (isdigit (l[3])) +- ++result; +- +- __close_nocancel_nostatus (fd); +- } +- +- return result; ++ return get_nproc_stat (buffer, buffer_size); + } + libc_hidden_def (__get_nprocs) + weak_alias (__get_nprocs, get_nprocs) +@@ -220,7 +228,9 @@ __get_nprocs_conf (void) + return count; + } + +- return 1; ++ enum { buffer_size = 1024 }; ++ char buffer[buffer_size]; ++ return get_nproc_stat (buffer, buffer_size); + } + libc_hidden_def (__get_nprocs_conf) + weak_alias (__get_nprocs_conf, get_nprocs_conf) diff --git a/glibc-upstream-2.34-49.patch b/glibc-upstream-2.34-49.patch new file mode 100644 index 0000000..e4cd827 --- /dev/null +++ b/glibc-upstream-2.34-49.patch @@ -0,0 +1,101 @@ +commit 387bff63dc2dccd62b09aa26dccf8cdc5f3c985c +Author: Matheus Castanho +Date: Tue Oct 26 10:44:59 2021 -0300 + + powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532] + + Syscalls based on the assembly templates are missing CFI for r31, which gets + clobbered when scv is used, and info for LR is inaccurate, placed in the wrong + LOC and not using the proper offset. LR was also being saved to the callee's + frame, while the ABI mandates it to be saved to the caller's frame. These are + fixed by this commit. + + After this change: + + $ readelf -wF libc.so.6 | grep 0004b9d4.. -A 7 && objdump --disassemble=kill libc.so.6 + 00004a48 0000000000000020 00004a4c FDE cie=00000000 pc=000000000004b9d4..000000000004ba3c + LOC CFA r31 ra + 000000000004b9d4 r1+0 u u + 000000000004b9e4 r1+48 u u + 000000000004b9e8 r1+48 c-16 u + 000000000004b9fc r1+48 c-16 c+16 + 000000000004ba08 r1+48 c-16 + 000000000004ba18 r1+48 u + 000000000004ba1c r1+0 u + + libc.so.6: file format elf64-powerpcle + + Disassembly of section .text: + + 000000000004b9d4 : + 4b9d4: 1f 00 4c 3c addis r2,r12,31 + 4b9d8: 2c c3 42 38 addi r2,r2,-15572 + 4b9dc: 25 00 00 38 li r0,37 + 4b9e0: d1 ff 21 f8 stdu r1,-48(r1) + 4b9e4: 20 00 e1 fb std r31,32(r1) + 4b9e8: 98 8f ed eb ld r31,-28776(r13) + 4b9ec: 10 00 ff 77 andis. r31,r31,16 + 4b9f0: 1c 00 82 41 beq 4ba0c + 4b9f4: a6 02 28 7d mflr r9 + 4b9f8: 40 00 21 f9 std r9,64(r1) + 4b9fc: 01 00 00 44 scv 0 + 4ba00: 40 00 21 e9 ld r9,64(r1) + 4ba04: a6 03 28 7d mtlr r9 + 4ba08: 08 00 00 48 b 4ba10 + 4ba0c: 02 00 00 44 sc + 4ba10: 00 00 bf 2e cmpdi cr5,r31,0 + 4ba14: 20 00 e1 eb ld r31,32(r1) + 4ba18: 30 00 21 38 addi r1,r1,48 + 4ba1c: 18 00 96 41 beq cr5,4ba34 + 4ba20: 01 f0 20 39 li r9,-4095 + 4ba24: 40 48 23 7c cmpld r3,r9 + 4ba28: 20 00 e0 4d bltlr+ + 4ba2c: d0 00 63 7c neg r3,r3 + 4ba30: 08 00 00 48 b 4ba38 + 4ba34: 20 00 e3 4c bnslr+ + 4ba38: c8 32 fe 4b b 2ed00 <__syscall_error> + ... + 4ba44: 40 20 0c 00 .long 0xc2040 + 4ba48: 68 00 00 00 .long 0x68 + 4ba4c: 06 00 5f 5f rlwnm r31,r26,r0,0,3 + 4ba50: 6b 69 6c 6c xoris r12,r3,26987 + + (cherry picked from commit d120fb9941be1fb1934f0b50c6ad64e4c5e404fb) + +diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h +index 589f7c8d18814ee9..cfcfa69f91f1773d 100644 +--- a/sysdeps/powerpc/powerpc64/sysdep.h ++++ b/sysdeps/powerpc/powerpc64/sysdep.h +@@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \ + /* Allocate frame and save register */ + #define NVOLREG_SAVE \ + stdu r1,-SCV_FRAME_SIZE(r1); \ ++ cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \ + std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ +- cfi_adjust_cfa_offset(SCV_FRAME_SIZE); ++ cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE); + + /* Restore register and destroy frame */ + #define NVOLREG_RESTORE \ + ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ ++ cfi_restore(r31); \ + addi r1,r1,SCV_FRAME_SIZE; \ + cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); + +@@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ + + #define DO_CALL_SCV \ + mflr r9; \ +- std r9,FRAME_LR_SAVE(r1); \ +- cfi_offset(lr,FRAME_LR_SAVE); \ ++ std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ ++ cfi_rel_offset(lr,SCV_FRAME_SIZE+FRAME_LR_SAVE); \ + .machine "push"; \ + .machine "power9"; \ + scv 0; \ + .machine "pop"; \ +- ld r9,FRAME_LR_SAVE(r1); \ ++ ld r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ + mtlr r9; \ + cfi_restore(lr); + diff --git a/glibc.spec b/glibc.spec index 0640f34..8d8b27b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -151,7 +151,7 @@ end \ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 8%{?dist} +Release: 10%{?dist} # In general, GPLv2+ is used by programs, LGPLv2+ is used for # libraries. @@ -274,6 +274,12 @@ Patch71: glibc-upstream-2.34-40.patch Patch72: glibc-upstream-2.34-41.patch Patch73: glibc-upstream-2.34-42.patch Patch74: glibc-upstream-2.34-43.patch +Patch75: glibc-upstream-2.34-44.patch +Patch76: glibc-upstream-2.34-45.patch +Patch77: glibc-upstream-2.34-46.patch +Patch78: glibc-upstream-2.34-47.patch +Patch79: glibc-upstream-2.34-48.patch +Patch80: glibc-upstream-2.34-49.patch ############################################################################## # Continued list of core "glibc" package information: @@ -2305,6 +2311,19 @@ fi %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %changelog +* Fri Dec 3 2021 Florian Weimer - 2.34-10 +- Sync with upstream branch release/2.34/master, + commit 387bff63dc2dccd62b09aa26dccf8cdc5f3c985c: +- powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532] +- linux: Use /proc/stat fallback for __get_nprocs_conf (BZ #28624) +- nptl: Do not set signal mask on second setjmp return [BZ #28607] +- s390: Use long branches across object boundaries (jgh instead of jh) +- elf: Earlier missing dynamic segment check in _dl_map_object_from_fd +- gconv: Do not emit spurious NUL character in ISO-2022-JP-3 (bug 28524) + +* Tue Nov 16 2021 Arjun Shankar - 2.34-9 +- Create /{bin,lib,lib64,sbin} as symbolic links in test-container + * Wed Nov 3 2021 Florian Weimer - 2.34-8 - Sync with upstream branch release/2.34/master, commit 6548a9bdba95b3e1fcdbd85445342467e4b0cd4f: