linux/arch/x86/boot/compressed
Arvind Sankar e5ceb9a024 x86/boot/64: Initialize 5-level paging variables earlier
Commit

  ca0e22d4f0 ("x86/boot/compressed/64: Always switch to own page table")

started using a new set of pagetables even without KASLR.

After that commit, initialize_identity_maps() is called before the
5-level paging variables are setup in choose_random_location(), which
will not work if 5-level paging is actually enabled.

Fix this by moving the initialization of __pgtable_l5_enabled,
pgdir_shift and ptrs_per_p4d into cleanup_trampoline(), which is called
immediately after the finalization of whether the kernel is executing
with 4- or 5-level paging. This will be earlier than anything that might
require those variables, and keeps the 4- vs 5-level paging code all in
one place.

Fixes: ca0e22d4f0 ("x86/boot/compressed/64: Always switch to own page table")
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lkml.kernel.org/r/20201010191110.4060905-1-nivedita@alum.mit.edu
2020-10-19 12:47:21 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
acpi.c x86/boot: Fix -Wint-to-pointer-cast build warning 2020-05-04 15:22:16 +02:00
cmdline.c x86/boot: Build the command line parsing code unconditionally 2019-02-01 11:51:01 +01:00
cpuflags.c x86/sev-es: Check required CPU features for SEV-ES 2020-09-10 21:49:25 +02:00
early_serial_console.c x86, boot: Don't compile early_serial_console.c when !CONFIG_EARLY_PRINTK 2014-08-17 14:58:24 -07:00
efi_thunk_64.S efi/x86: Drop the special GDT for the EFI thunk 2020-05-24 00:25:15 +02:00
error.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
error.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
head_32.S x86/boot: Remove run-time relocations from head_{32,64}.S 2020-08-14 12:52:35 +02:00
head_64.S This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
ident_map_64.c x86/boot/64: Initialize 5-level paging variables earlier 2020-10-19 12:47:21 +02:00
idt_64.c x86/boot/compressed/64: Setup a GHCB-based VC Exception handler 2020-09-07 19:45:25 +02:00
idt_handlers_64.S x86/boot/compressed/64: Setup a GHCB-based VC Exception handler 2020-09-07 19:45:25 +02:00
kaslr.c x86/boot/64: Initialize 5-level paging variables earlier 2020-10-19 12:47:21 +02:00
kernel_info.S x86/boot: Introduce setup_indirect 2019-11-12 16:21:15 +01:00
Makefile This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
mem_encrypt.S x86/asm: Change all ENTRY+ENDPROC to SYM_FUNC_* 2019-10-18 11:58:33 +02:00
misc.c x86/boot/compressed/64: Setup a GHCB-based VC Exception handler 2020-09-07 19:45:25 +02:00
misc.h x86/sev-es: Check required CPU features for SEV-ES 2020-09-10 21:49:25 +02:00
mkpiggy.c x86/boot: Remove run-time relocations from head_{32,64}.S 2020-08-14 12:52:35 +02:00
pgtable_64.c x86/boot/64: Initialize 5-level paging variables earlier 2020-10-19 12:47:21 +02:00
pgtable.h x86/boot/compressed/64: Set EFER.LME=1 in 32-bit trampoline before returning to long mode 2019-01-29 21:58:59 +01:00
sev-es.c x86/sev-es: Check required CPU features for SEV-ES 2020-09-10 21:49:25 +02:00
string.c x86/boot: Provide KASAN compatible aliases for string routines 2019-05-24 08:44:16 +02:00
vmlinux.lds.S x86/boot/compressed: Add missing debugging sections to output 2020-09-01 10:03:18 +02:00