arm64: kasan: Reduce minimum shadow alignment and enable 5 level paging
authorArd Biesheuvel <ardb@kernel.org>
Wed, 14 Feb 2024 12:29:21 +0000 (13:29 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 16 Feb 2024 12:42:40 +0000 (12:42 +0000)
commit0383808e4d99ac31892655ae9dc93597eb6f1412
tree2027a25a96234778cebf4d9ea624f5f747af4048
parent6ed8a3a094b43a27ac35e5c95a8004a1d83d1b79
arm64: kasan: Reduce minimum shadow alignment and enable 5 level paging

Allow the KASAN init code to deal with 5 levels of paging, and relax the
requirement that the shadow region is aligned to the top level pgd_t
size. This is necessary for LPA2 based 52-bit virtual addressing, where
the KASAN shadow will never be aligned to the pgd_t size. Allowing this
also enables the 16k/48-bit case for KASAN, which is a nice bonus.

This involves some hackery to manipulate the root and next level page
tables without having to distinguish all the various configurations,
including 16k/48-bits (which has a two entry pgd_t level), and LPA2
configurations running with one translation level less on non-LPA2
hardware.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240214122845.2033971-80-ardb+git@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/Kconfig
arch/arm64/mm/kasan_init.c