[PATCH] x86: Avoid integer truncation with large cache sizes (bug 32470)

Joseph Myers josmyers@redhat.com
Tue Dec 17 18:22:35 GMT 2024


On Tue, 17 Dec 2024, Florian Weimer wrote:

> 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.
> 
> Tested on i686-linux-gnu and x86_64-linux-gnu on bare metal, and on
> x86_64-linux-gnu with bhyve reporting 1 TiB of L3 cache.

This patch is using unsigned long int - what happens for x32 when the 
hypervisor reports 1 TiB (or for that matter for i686 if reporting a 
non-32-bit value is possible when executing in 32-bit mode)?  Would 
uint64_t be better, or is it impossible to have a value that would be 
truncated when executing for an ABI where long is 32-bit?

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list