x86/efi: Load fixmap GDT in efi_call_phys_epilog() before setting %cr3
PATCH 1/1 x86/efi: Load fixmap GDT in efi_call_phys_epilog() before setting %cr3
Commit eeb89e2bb1ac ("x86/efi: Load fixmap GDT in efi_call_phys_epilog()") moved loading the fixmap in efi_call_phys_epilog() after load_cr3() since it was assumed to be more logical.
Turns out this is incorrect: In efi_call_phys_prolog(), we load the gdt with its physical address, and when we reload the %cr3 in _epilog from initial_page_table to swapper_pg_dir again the gdt is no longer mapped. This results in a triple fault if an interrupt occurs after load_cr3() and before load_fixmap_gdt(0). Calling load_fixmap_gdt(0) first restores the execution order prior to commit eeb89e2bb1ac and fixes the problem.
--- arch/x86/platform/efi/efi_32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/platform/efi/efi_32.c +1 -2
@@ -85,10 +85,9 @@ pgd_t * __init efi_call_phys_prolog(void)void __init efi_call_phys_epilog (pgd_t *save_pgd) { +load_fixmap_gdt (0 );load_cr3 (save_pgd);__flush_tlb_all (); - -load_fixmap_gdt (0 ); }void __init efi_runtime_update_mappings (void )
Signature · 1 line
2.7.4
tip-bot for Guenter Roeck
merge botx86/efi: Load fixmap GDT in efi_call_phys_epilog() before setting %cr3
Commit-ID: cf40361ede6cf9dc09349e4c049dc0d166ca2d8b Gitweb: https://git.kernel.org/tip/cf40361ede6cf9dc09349e4c049dc0d166ca2d8b Author: Guenter Roeck <[email protected]> AuthorDate: Tue, 11 Sep 2018 11:18:12 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 12 Sep 2018 21:53:34 +0200
x86/efi: Load fixmap GDT in efi_call_phys_epilog() before setting %cr3
Commit eeb89e2bb1ac ("x86/efi: Load fixmap GDT in efi_call_phys_epilog()") moved loading the fixmap in efi_call_phys_epilog() after load_cr3() since it was assumed to be more logical.
Turns out this is incorrect: In efi_call_phys_prolog(), the gdt with its physical address is loaded first, and when the %cr3 is reloaded in _epilog from initial_page_table to swapper_pg_dir again the gdt is no longer mapped. This results in a triple fault if an interrupt occurs after load_cr3() and before load_fixmap_gdt(0). Calling load_fixmap_gdt(0) first restores the execution order prior to commit eeb89e2bb1ac and fixes the problem.
--- arch/x86/platform/efi/efi_32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/platform/efi/efi_32.c +1 -2
@@ -85,10 +85,9 @@ pgd_t * __init efi_call_phys_prolog(void)void __init efi_call_phys_epilog (pgd_t *save_pgd) { +load_fixmap_gdt (0 );load_cr3 (save_pgd);__flush_tlb_all (); - -load_fixmap_gdt (0 ); }void __init efi_runtime_update_mappings (void )