riscv: Introduce virtual kernel mapping KASLR
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Sat, 22 Jul 2023 12:38:46 +0000 (14:38 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 6 Sep 2023 02:49:27 +0000 (19:49 -0700)
commit84fe419dc7578b03e721b9bd6eb07947db70fd0e
treed8a270fb5d5b0248452f47ca4669ac3eb278a41e
parent06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
riscv: Introduce virtual kernel mapping KASLR

KASLR implementation relies on a relocatable kernel so that we can move
the kernel mapping.

The seed needed to virtually move the kernel is taken from the device tree,
so we rely on the bootloader to provide a correct seed. Zkr could be used
unconditionnally instead if implemented, but that's for another patch.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Song Shuai <songshuaishuai@tinylab.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20230722123850.634544-2-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/Kconfig
arch/riscv/include/asm/page.h
arch/riscv/kernel/pi/Makefile
arch/riscv/kernel/pi/cmdline_early.c
arch/riscv/kernel/pi/fdt_early.c [new file with mode: 0644]
arch/riscv/mm/init.c