From 35d5193285ec5d9d4f9a424523f6f799d85475f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 8 Mar 2024 16:38:25 +0100 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 glibc revision dd20b0846cb2288102dbcfbca07ecc18 --- baselibs.conf | 2 + glibc.changes | 11 +++ glibc.spec | 63 +----------- manpages.patch | 6 +- s390-clone-error-clobber-r7.patch | 157 ++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+), 61 deletions(-) create mode 100644 s390-clone-error-clobber-r7.patch diff --git a/baselibs.conf b/baselibs.conf index b8079d1..674728b 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -24,3 +24,5 @@ glibc-devel-static glibc-profile arch i586 block! glibc-utils +libnsl1 + arch i586 block! diff --git a/glibc.changes b/glibc.changes index e7fa018..37e2447 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Feb 26 12:48:48 UTC 2024 - Andreas Schwab + +- s390-clone-error-clobber-r7.patch: S390: Do not clobber r7 in clone (BZ + #31402) + +------------------------------------------------------------------- +Wed Feb 7 09:08:50 UTC 2024 - Andreas Schwab + +- Add libnsl1 to baselibs.conf (bsc#1219640) + ------------------------------------------------------------------- Wed Jan 31 09:25:16 UTC 2024 - Andreas Schwab diff --git a/glibc.spec b/glibc.spec index 90c7b69..1afdcd9 100644 --- a/glibc.spec +++ b/glibc.spec @@ -20,7 +20,6 @@ # It will avoid building some parts of glibc %bcond_with fast_build -%bcond_with snapshot %bcond_with ringdisabled %define flavor @BUILD_FLAVOR@%{nil} @@ -154,19 +153,12 @@ License: GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.1-or-later WIT Group: System/Libraries Version: 2.38 Release: 0 -%if %{without snapshot} %define git_id 36f2487f13 %define libversion %version -%else -%define git_id %(echo %version | sed 's/.*\.g//') -%define libversion %(echo %version | sed 's/\.[^.]*\.g.*//') -%endif URL: https://www.gnu.org/software/libc/libc.html BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: https://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz -%if %{without snapshot} Source1: https://ftp.gnu.org/pub/gnu/glibc/glibc-%{version}.tar.xz.sig -%endif Source2: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=libc&download=1#/glibc.keyring Source4: manpages.tar.bz2 Source5: nsswitch.conf @@ -347,6 +339,8 @@ Patch1020: libio-wdo-write.patch Patch1021: syslog-buffer-overflow.patch # PATCH-FIX-UPSTREAM qsort: handle degenerated compare function Patch1022: qsort-invalid-cmp.patch +# PATCH-FIX-UPSTREAM S390: Do not clobber r7 in clone (BZ #31402) +Patch1023: s390-clone-error-clobber-r7.patch ### # Patches awaiting upstream approval @@ -558,54 +552,8 @@ have support for IPv6. %endif %prep -%setup -n glibc-%{version} -q -a 4 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch10 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 +%autosetup -n glibc-%{version} -a 4 -p1 -%patch100 -p1 -%patch102 -p1 -%patch103 -p1 - -%patch304 -p1 -%patch306 -p1 - -%if %{without snapshot} -%patch1000 -p1 -%patch1001 -p1 -%patch1002 -p1 -%patch1003 -p1 -%patch1004 -p1 -%patch1005 -p1 -%patch1006 -p1 -%patch1007 -p1 -%patch1008 -p1 -%patch1009 -p1 -%patch1010 -p1 -%patch1011 -p1 -%patch1012 -p1 -%patch1013 -p1 -%patch1014 -p1 -%patch1015 -p1 -%patch1016 -p1 -%patch1017 -p1 -%patch1018 -p1 -%patch1019 -p1 -%patch1020 -p1 -%patch1021 -p1 -%patch1022 -p1 -%endif - -%patch2000 -p1 - -%patch3000 rm -f manpages/catchsegv.1 %build @@ -1077,11 +1025,10 @@ rm -f %{buildroot}%{_bindir}/pldd rm -rf %{buildroot}%{_libdir}/audit %ifarch i686 -# Remove files from glibc-{extra,info,i18ndata}, nscd, libnsl1 +# Remove files from glibc-{extra,info,i18ndata}, nscd rm -rf %{buildroot}%{_infodir} %{buildroot}%{_prefix}/share/i18n rm -f %{buildroot}%{_bindir}/makedb %{buildroot}/var/lib/misc/Makefile rm -f %{buildroot}%{_sbindir}/nscd -rm -f %{buildroot}%{slibdir}/libnsl.so.1 %endif %ifnarch i686 @@ -1462,12 +1409,12 @@ exit 0 /var/lib/misc/Makefile %files lang -f libc.lang +%endif %ifarch %ix86 %alpha hppa m68k %mips32 %mips64 %sparc ppc ppc64 ppc64le x86_64 s390 s390x %arm aarch64 riscv64 %files -n libnsl1 %{slibdir}/libnsl.so.1 %endif -%endif %endif diff --git a/manpages.patch b/manpages.patch index 124aadf..426109a 100644 --- a/manpages.patch +++ b/manpages.patch @@ -1,7 +1,7 @@ -Index: manpages/locale.alias.5 +Index: ./manpages/locale.alias.5 =================================================================== ---- manpages/locale.alias.5.orig -+++ manpages/locale.alias.5 +--- ./manpages/locale.alias.5.orig ++++ ./manpages/locale.alias.5 @@ -18,7 +18,7 @@ .SH "NAME" locale.alias \- Locale name alias data base diff --git a/s390-clone-error-clobber-r7.patch b/s390-clone-error-clobber-r7.patch new file mode 100644 index 0000000..44a2f11 --- /dev/null +++ b/s390-clone-error-clobber-r7.patch @@ -0,0 +1,157 @@ +From ee4806e978467d705b26ccb7dfddb9e0a710f8e4 Mon Sep 17 00:00:00 2001 +From: Stefan Liebler +Date: Thu, 22 Feb 2024 15:03:27 +0100 +Subject: [PATCH] S390: Do not clobber r7 in clone [BZ #31402] + +Starting with commit e57d8fc97b90127de4ed3e3a9cdf663667580935 +"S390: Always use svc 0" +clone clobbers the call-saved register r7 in error case: +function or stack is NULL. + +This patch restores the saved registers also in the error case. +Furthermore the existing test misc/tst-clone is extended to check +all error cases and that clone does not clobber registers in this +error case. + +(cherry picked from commit 02782fd12849b6673cb5c2728cb750e8ec295aa3) +Note: Added ia64 __clone2 call to tst-clone.c. +--- + sysdeps/unix/sysv/linux/s390/s390-32/clone.S | 1 + + sysdeps/unix/sysv/linux/s390/s390-64/clone.S | 1 + + sysdeps/unix/sysv/linux/tst-clone.c | 76 ++++++++++++++++---- + 3 files changed, 65 insertions(+), 13 deletions(-) + +diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S +index 5d8d873383..fd1e509cf4 100644 +--- a/sysdeps/unix/sysv/linux/s390/s390-32/clone.S ++++ b/sysdeps/unix/sysv/linux/s390/s390-32/clone.S +@@ -53,6 +53,7 @@ ENTRY(__clone) + br %r14 + error: + lhi %r2,-EINVAL ++ lm %r6,%r7,24(%r15) /* Load registers. */ + j SYSCALL_ERROR_LABEL + PSEUDO_END (__clone) + +diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S +index f1c4288a3d..7b37b18010 100644 +--- a/sysdeps/unix/sysv/linux/s390/s390-64/clone.S ++++ b/sysdeps/unix/sysv/linux/s390/s390-64/clone.S +@@ -54,6 +54,7 @@ ENTRY(__clone) + br %r14 + error: + lghi %r2,-EINVAL ++ lmg %r6,%r7,48(%r15) /* Restore registers. */ + jg SYSCALL_ERROR_LABEL + PSEUDO_END (__clone) + +diff --git a/sysdeps/unix/sysv/linux/tst-clone.c b/sysdeps/unix/sysv/linux/tst-clone.c +index 56348707d4..95bd0f6ccb 100644 +--- a/sysdeps/unix/sysv/linux/tst-clone.c ++++ b/sysdeps/unix/sysv/linux/tst-clone.c +@@ -16,12 +16,16 @@ + License along with the GNU C Library; if not, see + . */ + +-/* BZ #2386 */ ++/* BZ #2386, BZ #31402 */ + #include + #include + #include + #include + #include ++#include /* For _STACK_GROWS_{UP,DOWN}. */ ++#include ++ ++volatile unsigned v = 0xdeadbeef; + + #ifdef __ia64__ + extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, +@@ -35,26 +39,72 @@ int child_fn(void *arg) + } + + static int +-do_test (void) ++__attribute__((noinline)) ++do_clone (int (*fn)(void *), void *stack) + { + int result; ++ unsigned int a = v; ++ unsigned int b = v; ++ unsigned int c = v; ++ unsigned int d = v; ++ unsigned int e = v; ++ unsigned int f = v; ++ unsigned int g = v; ++ unsigned int h = v; ++ unsigned int i = v; ++ unsigned int j = v; ++ unsigned int k = v; ++ unsigned int l = v; ++ unsigned int m = v; ++ unsigned int n = v; ++ unsigned int o = v; + + #ifdef __ia64__ +- result = __clone2 (child_fn, NULL, 0, 0, NULL, NULL, NULL); ++ result = __clone2 (fn, stack, stack != NULL ? 128 * 1024 : 0, 0, NULL, NULL, ++ NULL); ++#else ++ result = clone (fn, stack, 0, NULL); ++#endif ++ ++ /* Check that clone does not clobber call-saved registers. */ ++ TEST_VERIFY (a == v && b == v && c == v && d == v && e == v && f == v ++ && g == v && h == v && i == v && j == v && k == v && l == v ++ && m == v && n == v && o == v); ++ ++ return result; ++} ++ ++static void ++__attribute__((noinline)) ++do_test_single (int (*fn)(void *), void *stack) ++{ ++ printf ("%s (fn=%p, stack=%p)\n", __FUNCTION__, fn, stack); ++ errno = 0; ++ ++ int result = do_clone (fn, stack); ++ ++ TEST_COMPARE (errno, EINVAL); ++ TEST_COMPARE (result, -1); ++} ++ ++static int ++do_test (void) ++{ ++ char st[128 * 1024] __attribute__ ((aligned)); ++ void *stack = NULL; ++#if defined __ia64__ || _STACK_GROWS_UP ++ stack = st; ++#elif _STACK_GROWS_DOWN ++ stack = st + sizeof (st); + #else +- result = clone (child_fn, NULL, 0, NULL); ++# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" + #endif + +- if (errno != EINVAL || result != -1) +- { +- printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n", +- result, errno, EINVAL); +- return 1; +- } ++ do_test_single (child_fn, NULL); ++ do_test_single (NULL, stack); ++ do_test_single (NULL, NULL); + +- puts ("All OK"); + return 0; + } + +-#define TEST_FUNCTION do_test () +-#include "../test-skeleton.c" ++#include +-- +2.44.0 +