Re: [PATCH] x86/speculation/l1tf: fix overflow on l1tf_pfn_limit() on 32bit
From: Michal Hocko
Date: Mon Aug 20 2018 - 10:26:40 EST
On Mon 20-08-18 07:20:27, Andi Kleen wrote:
> On Mon, Aug 20, 2018 at 11:58:35AM +0200, Vlastimil Babka wrote:
> > 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.
> Looks good.
> Acked-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
> BTW our much worse problems right now are crash reports on several
> stable kernels, especially with large pages
Do you have any reference?
> I'll dig into this more today, but if you have any hints from testing/fixing
> your own backports please share them.
Well, we have seen some issues on pre 3.12 kernels due to misbackporting
prot_none mitigations. PMD format is different in pre 4.4 kernels. Maybe
this is a similar issue.