diff --git a/arm-dl-start-user.patch b/arm-dl-start-user.patch new file mode 100644 index 0000000..b5c2646 --- /dev/null +++ b/arm-dl-start-user.patch @@ -0,0 +1,40 @@ +From 63295e4fda1f6dab4bf7442706fe303bf283036c Mon Sep 17 00:00:00 2001 +From: Adhemerval Zanella +Date: Mon, 5 Feb 2024 16:10:24 +0000 +Subject: [PATCH] arm: Remove wrong ldr from _dl_start_user (BZ 31339) + +The commit 49d877a80b29d3002887b084eec6676d9f5fec18 (arm: Remove +_dl_skip_args usage) removed the _SKIP_ARGS literal, which was +previously loader to r4 on loader _start. However, the cleanup did not +remove the following 'ldr r4, [sl, r4]' on _dl_start_user, used to check +to skip the arguments after ld self-relocations. + +In my testing, the kernel initially set r4 to 0, which makes the +ldr instruction just read the _GLOBAL_OFFSET_TABLE_. However, since r4 +is a callee-saved register; a different runtime might not zero +initialize it and thus trigger an invalid memory access. + +Checked on arm-linux-gnu. + +Reported-by: Adrian Ratiu +Reviewed-by: Szabolcs Nagy +(cherry picked from commit 1e25112dc0cb2515d27d8d178b1ecce778a9d37a) +--- + sysdeps/arm/dl-machine.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h +index b857bbc868..dd1a0f6b6e 100644 +--- a/sysdeps/arm/dl-machine.h ++++ b/sysdeps/arm/dl-machine.h +@@ -139,7 +139,6 @@ _start:\n\ + _dl_start_user:\n\ + adr r6, .L_GET_GOT\n\ + add sl, sl, r6\n\ +- ldr r4, [sl, r4]\n\ + @ save the entry point in another register\n\ + mov r6, r0\n\ + @ get the original arg count\n\ +-- +2.43.0 + diff --git a/baselibs.conf b/baselibs.conf index 5840700..bbfdda3 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 b5ecb4e..c2a0873 100644 --- a/glibc.changes +++ b/glibc.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Feb 7 09:08:50 UTC 2024 - Andreas Schwab + +- Add libnsl1 to baselibs.conf (bsc#1219640) + +------------------------------------------------------------------- +Tue Feb 6 08:40:15 UTC 2024 - Andreas Schwab + +- arm-dl-start-user.patch: arm: Remove wrong ldr from _dl_start_user (BZ + #31339) + ------------------------------------------------------------------- Thu Feb 1 09:25:37 UTC 2024 - Andreas Schwab diff --git a/glibc.spec b/glibc.spec index 807e4ff..5d9b502 100644 --- a/glibc.spec +++ b/glibc.spec @@ -298,9 +298,13 @@ Patch304: glibc-resolv-mdnshint.diff # PATCH-FIX-OPENSUSE disable rewriting ::1 to 127.0.0.1 for /etc/hosts bnc#684534, bnc#706719 Patch306: glibc-fix-double-loopback.diff +%if %{without snapshot} ### # Patches from upstream ### +# PATCH-FIX-UPSTREAM arm: Remove wrong ldr from _dl_start_user (BZ #31339) +Patch1000: arm-dl-start-user.patch +%endif ### # Patches awaiting upstream approval @@ -512,31 +516,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} -%endif - -%patch2000 -p1 - -%patch3000 rm -f manpages/catchsegv.1 %build @@ -1008,11 +989,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 @@ -1393,12 +1373,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 b26eab0..6d7bafb 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