]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: head: cover entire kernel image in initial ID map
authorArd Biesheuvel <ardb@kernel.org>
Fri, 24 Jun 2022 15:06:42 +0000 (17:06 +0200)
committerWill Deacon <will@kernel.org>
Fri, 24 Jun 2022 16:18:10 +0000 (17:18 +0100)
commit4da5f77dacaa8c42cca6d25f1c2480f1be3679c2
treeafe531afe391eadbcdf03355a5c2e5b97df39a64
parent579de6f9304370337c08c90e06c7b2d3a17bd68f
arm64: head: cover entire kernel image in initial ID map

As a first step towards avoiding the need to create, tear down and
recreate the kernel virtual mapping with MMU and caches disabled, start
by expanding the ID map so it covers the page tables as well as all
executable code. This will allow us to populate the page tables with the
MMU and caches on, and call KASLR init code before setting up the
virtual mapping.

Since this ID map is only needed at boot, create it as a temporary set
of page tables, and populate the permanent ID map after enabling the MMU
and caches. While at it, switch to read-only attributes for the where
possible, as writable permissions are only needed for the initial kernel
page tables. Note that on 4k granule configurations, the permanent ID
map will now be reduced to a single page rather than a 2M block mapping.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20220624150651.1358849-13-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/kernel-pgtable.h
arch/arm64/kernel/head.S
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/mm/mmu.c
arch/arm64/mm/proc.S