• Matt Fleming's avatar
    x86/mm/pat: Ensure cpa->pfn only contains page frame numbers · 87e2bd89
    Matt Fleming authored
    commit edc3b912 upstream.
    
    The x86 pageattr code is confused about the data that is stored
    in cpa->pfn, sometimes it's treated as a page frame number,
    sometimes it's treated as an unshifted physical address, and in
    one place it's treated as a pte.
    
    The result of this is that the mapping functions do not map the
    intended physical address.
    
    This isn't a problem in practice because most of the addresses
    we're mapping in the EFI code paths are already mapped in
    'trampoline_pgd' and so the pageattr mapping functions don't
    actually do anything in this case. But when we move to using a
    separate page table for the EFI runtime this will be an issue.
    Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
    Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
    Acked-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Toshi Kani <toshi.kani@hp.com>
    Cc: linux-efi@vger.kernel.org
    Link: http://lkml.kernel.org/r/1448658575-17029-3-git-send-email-matt@codeblueprint.co.ukSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Cc: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    87e2bd89
pageattr.c 47.2 KB