]> 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 17:51:34 +0000 (18:51 +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 bd0b3bd66ae3736703d362cd3f6fd17119550a46..97a1e1f5d4902dc7803192e4da0e48c2794e2e8c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ The following bugs are resolved with this release:
   [32137] libio: Attempt wide backup free only for non-legacy code
   [32231] elf: Change ldconfig auxcache magic number
   [32245] glibc -Wstringop-overflow= build failure on hppa
+  [32470] x86: Avoid integer truncation with large cache sizes
 \f
 Version 2.40
 
index a1c03b8903ed33c9a11e3602c9694ed65c4ff292..ac97414b5bff76c163a1484738da6f642b71652f 100644 (file)
@@ -961,11 +961,11 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
     non_temporal_threshold = maximum_non_temporal_threshold;
 
   /* 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;
   /* 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))
     {