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:49:50 +0100
commit61c3450db96dce96ad2b24b4f0b548e6a46d68e5 (patch)
treee0d2086ee13ce974bf0e7b0a11266c5ec1d5f9bf
parent77e921bc611ea56eba206354c5134af0610cf6fe (diff)
downloadglibc-61c3450db96dce96ad2b24b4f0b548e6a46d68e5.zip
glibc-61c3450db96dce96ad2b24b4f0b548e6a46d68e5.tar.gz
glibc-61c3450db96dce96ad2b24b4f0b548e6a46d68e5.tar.bz2
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.
-rw-r--r--sysdeps/x86/dl-cacheinfo.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
index e957950..6a0a30b 100644
--- a/sysdeps/x86/dl-cacheinfo.h
+++ b/sysdeps/x86/dl-cacheinfo.h
@@ -1021,11 +1021,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))
{