• Jiri Slaby's avatar
    x86/mm/pat: Fix L1TF stable backport for CPA, 2nd call · 15898df4
    Jiri Slaby authored
    Mostly recycling the commit log from adaba23c which fixed
    populate_pmd, but did not fix populate_pud. The same problem exists
    there.
    
    Stable trees reverted the following patch:
      Revert "x86/mm/pat: Ensure cpa->pfn only contains page frame numbers"
    
        This reverts commit 87e2bd89 which is
        commit edc3b912 upstream.
    
    but the L1TF patch 02ff2769 backported here
    
      x86/mm/pat: Make set_memory_np() L1TF safe
    
        commit 958f79b9 upstream
    
        set_memory_np() is used to mark kernel mappings not present, but it has
        it's own open coded mechanism which does not have the L1TF protection of
        inverting the address bits.
    
    assumed that cpa->pfn contains a PFN. With the above patch reverted
    it does not, which causes the PUD to be set to an incorrect address
    shifted by 12 bits, which can cause various failures.
    
    Convert the address to a PFN before passing it to pud_pfn().
    
    This is a 4.4 stable only patch to fix the L1TF patches backport there.
    
    Cc: stable@vger.kernel.org # 4.4-only
    Cc: Andi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    15898df4
pageattr.c 48 KB