]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Avoid integer truncation with large cache sizes (bug 32470)
authorFlorian Weimer <fweimer@redhat.com>
Tue, 17 Dec 2024 17:12:03 +0000 (18:12 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 17 Dec 2024 18:14:43 +0000 (19:14 +0100)
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)

NEWS
sysdeps/x86/dl-cacheinfo.h

diff --git a/NEWS b/NEWS
index db8c40db394d2e677a5974486bb662a903d9079f..cf6102582e21b22c820bbfca569639649f756b52 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -102,6 +102,7 @@ The following bugs are resolved with this release:
   [31968] mremap implementation in C does not handle arguments correctly
   [32052] Name space violation in fortify wrappers
   [32137] libio: Attempt wide backup free only for non-legacy code
+  [32470] x86: Avoid integer truncation with large cache sizes
 
 Security related changes:
 
index d95c1efa2c231b61cc3ea69b99696b3e04373bf9..72ee1788e3a91ce14d07a489601a10ea3b926676 100644 (file)
@@ -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))
     {