lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 10 Nov 2021 13:46:10 +0300 From: Baskov Evgeniy <baskov@...ras.ru> To: Ard Biesheuvel <ardb@...nel.org> Cc: Baskov Evgeniy <baskov@...ras.ru>, Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>, Jonathan Corbet <corbet@....net>, Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org, linux-doc@...r.kernel.org, linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org Subject: [PATCH RFC 2/5] efi/x86_64: set page table if provided by libstub It is desired to be able to switch pages tables before jumping to potentially relocated code while booting via UEFI. The easiest way to achieve that is to do it in assembly immediately after returning from efi_main(). Add mechanism to switch page table to one provided by libstub. Signed-off-by: Baskov Evgeniy <baskov@...ras.ru> --- arch/x86/boot/compressed/head_64.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 572c535cf45b..1e467fdefd9d 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -540,6 +540,17 @@ SYM_FUNC_START_ALIAS(efi_stub_entry) movq %rdx, %rbx /* save boot_params pointer */ call efi_main movq %rbx,%rsi + + /* + * Switch page table to the one constructed by libstub if provided + * It is required to be done here because stack is not mapped + * in new page table. + */ + movq efi_temp_pgtable(%rip), %rbx + testq %rbx, %rbx + jz 1f + movq %rbx, %cr3 +1: leaq rva(startup_64)(%rax), %rax jmp *%rax SYM_FUNC_END(efi64_stub_entry) @@ -736,6 +747,7 @@ SYM_DATA_END_LABEL(boot32_idt, SYM_L_GLOBAL, boot32_idt_end) #ifdef CONFIG_EFI_STUB SYM_DATA(image_offset, .long 0) +SYM_DATA(efi_temp_pgtable, .quad 0) #endif #ifdef CONFIG_EFI_MIXED SYM_DATA_LOCAL(efi32_boot_args, .long 0, 0, 0) -- 2.33.1
Powered by blists - more mailing lists