aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-12-17 18:12:03 +0100
committerFlorian Weimer <fweimer@redhat.com>2024-12-17 18:52:10 +0100
commit2c8a7f14fac3628b6a06cc76cdfda54a7ac20386 (patch)
tree8be50b23afd80e0c0aab03cac0e297dec3cb7ee3
parent2c882bf9c15d206aaf04766d1b8e3ae5b1002cc2 (diff)
downloadglibc-2c8a7f14fac3628b6a06cc76cdfda54a7ac20386.zip
glibc-2c8a7f14fac3628b6a06cc76cdfda54a7ac20386.tar.gz
glibc-2c8a7f14fac3628b6a06cc76cdfda54a7ac20386.tar.bz2
x86: Avoid integer truncation with large cache sizes (bug 32470)release/2.39/master
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)
-rw-r--r--NEWS1
-rw-r--r--sysdeps/x86/dl-cacheinfo.h4
2 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 5aef543..9d71907 100644
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,7 @@ The following bugs are resolved with this release:
[32052] Name space violation in fortify wrappers
[32137] libio: Attempt wide backup free only for non-legacy code
[32231] elf: Change ldconfig auxcache magic number
+ [32470] x86: Avoid integer truncation with large cache sizes
Version 2.39
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index 5a98f70..1f68968 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -959,11 +959,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))
{