Skip to content

Commit de53c37

Browse files
Jiri KosinaKAGA-KOKO
authored andcommitted
x86/pti: Unbreak EFI old_memmap
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Dave Hansen <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected]
1 parent de79182 commit de53c37

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/platform/efi/efi_64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ pgd_t * __init efi_call_phys_prolog(void)
134134
pud[j] = *pud_offset(p4d_k, vaddr);
135135
}
136136
}
137+
pgd_offset_k(pgd * PGDIR_SIZE)->pgd &= ~_PAGE_NX;
137138
}
139+
138140
out:
139141
__flush_tlb_all();
140142

0 commit comments

Comments
 (0)