Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x86/boot/64: Initialize 5-level paging variables earlier
Commit ca0e22d ("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: ca0e22d ("x86/boot/compressed/64: Always switch to own page table") Signed-off-by: Arvind Sankar <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Joerg Roedel <[email protected]> Tested-by: Joerg Roedel <[email protected]> Tested-by: Kirill A. Shutemov <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
- Loading branch information