From: Florian Weimer Date: Tue, 17 Dec 2024 17:12:03 +0000 (+0100) Subject: x86: Avoid integer truncation with large cache sizes (bug 32470) X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b1f940938b6971a8c4eba33abf9cdcec83298a5;p=thirdparty%2Fglibc.git 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) --- diff --git a/NEWS b/NEWS index 5f1c88d2c5..aabb21e86c 100644 --- a/NEWS +++ b/NEWS @@ -171,6 +171,7 @@ The following bugs are resolved with this release: [31890] resolv: Allow short error responses to match any DNS query [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 Version 2.34 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)) {