4.14-stable review patch. If anyone has any objections, please let me know.
------------------ From: Jiri Kosina <jkos...@suse.cz> commit de53c3786a3ce162a1c815d0c04c766c23ec9c0a upstream. EFI_OLD_MEMMAP's efi_call_phys_prolog() calls set_pgd() with swapper PGD that has PAGE_USER set, which makes PTI set NX on it, and therefore EFI can't execute it's code. Fix that by forcefully clearing _PAGE_NX from the PGD (this can't be done by the pgprot API). _PAGE_NX will be automatically reintroduced in efi_call_phys_epilog(), as _set_pgd() will again notice that this is _PAGE_USER, and set _PAGE_NX on it. Tested-by: Dimitri Sivanich <sivan...@hpe.com> Signed-off-by: Jiri Kosina <jkos...@suse.cz> Signed-off-by: Ingo Molnar <mi...@kernel.org> Signed-off-by: Thomas Gleixner <t...@linutronix.de> Acked-by: Dave Hansen <dave.han...@linux.intel.com> Cc: Andrea Arcangeli <aarca...@redhat.com> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Matt Fleming <m...@codeblueprint.co.uk> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Thomas Gleixner <t...@linutronix.de> Cc: linux-...@vger.kernel.org Link: http://lkml.kernel.org/r/nycvar.yfh.7.76.1801052215460.11...@cbobk.fhfr.pm Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- arch/x86/platform/efi/efi_64.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c @@ -134,7 +134,9 @@ pgd_t * __init efi_call_phys_prolog(void pud[j] = *pud_offset(p4d_k, vaddr); } } + pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX; } + out: __flush_tlb_all();