From adf9e7aff854ffd7321bf037dd50b1ea0eb3fb8c Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Mon, 23 Dec 2024 13:45:51 +0900
Subject: [PATCH] Backport patch from upstream BZ #32470
---
SOURCES/glibc-upstream-2.34-bz-32470.patch | 36 ++++++++++++++++++++++
SPECS/glibc.spec | 17 +++++++---
2 files changed, 48 insertions(+), 5 deletions(-)
create mode 100644 SOURCES/glibc-upstream-2.34-bz-32470.patch
diff --git a/SOURCES/glibc-upstream-2.34-bz-32470.patch b/SOURCES/glibc-upstream-2.34-bz-32470.patch
new file mode 100644
index 0000000..5dc75ba
--- /dev/null
+++ b/SOURCES/glibc-upstream-2.34-bz-32470.patch
@@ -0,0 +1,36 @@
+From 1b1f940938b6971a8c4eba33abf9cdcec83298a5 Mon Sep 17 00:00:00 2001
+From: Florian Weimer
+Date: Tue, 17 Dec 2024 18:12:03 +0100
+Subject: [PATCH] x86: Avoid integer truncation with large cache sizes (bug
+ 32470)
+
+Some hypervisors report 1 TiB L3 cache size. This results
+in some variables incorrectly getting zeroed, causing crashes
+in memcpy/memmove because invariants are violated.
+
+(cherry picked from commit 61c3450db96dce96ad2b24b4f0b548e6a46d68e5)
+---
+ sysdeps/x86/dl-cacheinfo.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
+index 84b10b8540..7865e87054 100644
+--- a/sysdeps/x86/dl-cacheinfo.h
++++ b/sysdeps/x86/dl-cacheinfo.h
+@@ -901,12 +901,12 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
+
+ #if HAVE_TUNABLES
+ /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */
+- unsigned int minimum_rep_movsb_threshold;
++ unsigned long int minimum_rep_movsb_threshold;
+ #endif
+ /* NB: The default REP MOVSB threshold is 4096 * (VEC_SIZE / 16) for
+ VEC_SIZE == 64 or 32. For VEC_SIZE == 16, the default REP MOVSB
+ threshold is 2048 * (VEC_SIZE / 16). */
+- unsigned int rep_movsb_threshold;
++ unsigned long int rep_movsb_threshold;
+ if (CPU_FEATURE_USABLE_P (cpu_features, AVX512F)
+ && !CPU_FEATURE_PREFERRED_P (cpu_features, Prefer_No_AVX512))
+ {
+--
+2.46.2
diff --git a/SPECS/glibc.spec b/SPECS/glibc.spec
index fee27df..aa6b8f8 100644
--- a/SPECS/glibc.spec
+++ b/SPECS/glibc.spec
@@ -157,7 +157,7 @@ end \
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
-Release: 125%{?dist}.1.alma.1
+Release: 125%{?dist}.1.alma.2
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@@ -814,10 +814,10 @@ Patch575: glibc-RHEL-23472.patch
Patch576: glibc-RHEL-20172-1.patch
Patch577: glibc-RHEL-20172-2.patch
Patch578: glibc-RHEL-21884.patch
-# Patch579: glibc-RHEL-25531-1.patch
-# Patch580: glibc-RHEL-25531-2.patch
-# Patch581: glibc-RHEL-25531-3.patch
-# Patch582: glibc-RHEL-25531-4.patch
+Patch579: glibc-RHEL-25531-1.patch
+Patch580: glibc-RHEL-25531-2.patch
+Patch581: glibc-RHEL-25531-3.patch
+Patch582: glibc-RHEL-25531-4.patch
Patch583: glibc-RHEL-25046.patch
Patch584: glibc-RHEL-32681-1.patch
Patch585: glibc-RHEL-32681-2.patch
@@ -872,6 +872,9 @@ Patch633: glibc-RHEL-46979-4.patch
Patch634: glibc-RHEL-49489-3.patch
Patch635: glibc-RHEL-49489-4.patch
+# AlmaLinux backport: https://sourceware.org/bugzilla/show_bug.cgi?id=32470
+Patch1000: glibc-upstream-2.34-bz-32470.patch
+
##############################################################################
# Continued list of core "glibc" package information:
##############################################################################
@@ -3030,6 +3033,10 @@ update_gconv_modules_cache ()
%endif
%changelog
+* Mon Dec 23 2024 Koichiro Iwao - 2.34-125.1.alma.2
+- Re-apply RHEL-25531
+- Apply patch from upstream BZ #32470
+
* Mon Nov 25 2024 Andrew Lukoshko - 2.34-125.1.alma.1
- Revert: x86: Fix Zen3/Zen4 ERMS selection (RHEL-25531)
--
2.43.5