Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/speculation/l1tf: Fix overflow in l1tf_pfn_limit() on 32bit
On 32bit PAE kernels on 64bit hardware with enough physical bits, l1tf_pfn_limit() will overflow unsigned long. This in turn affects max_swapfile_size() and can lead to swapon returning -EINVAL. This has been observed in a 32bit guest with 42 bits physical address size, where max_swapfile_size() overflows exactly to 1 << 32, thus zero, and produces the following warning to dmesg: [ 6.396845] Truncating oversized swap area, only using 0k out of 2047996k Fix this by using unsigned long long instead. Fixes: 17dbca1 ("x86/speculation/l1tf: Add sysfs reporting for l1tf") Fixes: 377eeaa ("x86/speculation/l1tf: Limit swap file size to MAX_PA/2") Reported-by: Dominique Leuenberger <[email protected]> Reported-by: Adrian Schroeter <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Andi Kleen <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: "H . Peter Anvin" <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Michal Hocko <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
- Loading branch information