Re: [PATCH 4.4 103/105] Revert "x86/mm/pat: Ensure cpa->pfn only contains page frame numbers"

From: Ben Hutchings
Date: Fri Aug 24 2018 - 12:45:36 EST


On Wed, 2018-08-22 at 17:48 -0700, Roland Dreier wrote:
> On Fri, Dec 15, 2017 at 2:20 AM Greg Kroah-Hartman
> > <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > This reverts commit 87e2bd898d3a79a8c609f183180adac47879a2a4 which is
> > commit edc3b9129cecd0f0857112136f5b8b1bc1d45918 upstream.
> >
> > Turns there was too many other issues with this patch to make it viable
> > for the stable tree.
>
> This was sort of a long time ago, but does anyone remember why this
> needed to be reverted from 4.4?

See
<https://lore.kernel.org/lkml/1512686629.18523.217.camel@xxxxxxxxxxxxxxx/T/#u>.

Ben.

> The reason I ask is that without this, commit 02ff2769edbc /
> "x86/mm/pat: Make set_memory_np() L1TF safe" in 4.4.148 is broken.
> That patch has
>
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂset_pud(pud, __pud(cpa->pfn | _PAGE_PSE |
> -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmassage_pgprot(pud_pgprot)));
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂset_pud(pud, pud_mkhuge(pfn_pud(cpa->pfn,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcanon_pgprot(pud_pgprot))));
>
> (and similarly for pmds) but pfn_pud() is operating on page frame
> numbers and __pud(cpa->pfn... in the old code is operating on physical
> addresses.
>
> This is bad enough that 4.4.148 and all newer 4.4.y crash early in
> boot on some EFI systems that I have.
>
> For now I am re-applying the "ensure cpa->pfn only contains page frame
> numbers" patch, ported on top of 4.4.151.
>
> Â- R.
>
--
Ben Hutchings, Software Developer  Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom