linux/arch
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
..
alpha Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
arc This tree prepares to unify the kretprobe trampoline handler and make 2020-10-12 14:21:15 -07:00
arm Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
arm64 Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
c6x arch, drivers: replace for_each_membock() with for_each_mem_range() 2020-10-13 18:38:35 -07:00
csky seccomp updates for v5.10-rc1 2020-10-13 16:33:43 -07:00
h8300 h8300, nds32, openrisc: simplify detection of memory extents 2020-10-13 18:38:35 -07:00
hexagon Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
ia64 Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
m68k Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
microblaze Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
mips Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
nds32 h8300, nds32, openrisc: simplify detection of memory extents 2020-10-13 18:38:35 -07:00
nios2 Merge branch 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-10-12 16:24:13 -07:00
openrisc arch, drivers: replace for_each_membock() with for_each_mem_range() 2020-10-13 18:38:35 -07:00
parisc seccomp updates for v5.10-rc1 2020-10-13 16:33:43 -07:00
powerpc Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
riscv Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
s390 Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
sh Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
sparc Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
um seccomp updates for v5.10-rc1 2020-10-13 16:33:43 -07:00
x86 x86/boot/64: Initialize 5-level paging variables earlier 2020-10-19 12:47:21 +02:00
xtensa Merge branch 'akpm' (patches from Andrew) 2020-10-14 09:57:24 -07:00
.gitignore
Kconfig seccomp updates for v5.10-rc1 2020-10-13 16:33:43 -07:00