OpenCloudOS-Kernel/arch/riscv/include
Samuel Holland b008e327fa riscv: Fix loading 64-bit NOMMU kernels past the start of RAM
[ Upstream commit aea702dde7e9876fb00571a2602f25130847bf0f ]

commit 3335068f87 ("riscv: Use PUD/P4D/PGD pages for the linear
mapping") added logic to allow using RAM below the kernel load address.
However, this does not work for NOMMU, where PAGE_OFFSET is fixed to the
kernel load address. Since that range of memory corresponds to PFNs
below ARCH_PFN_OFFSET, mm initialization runs off the beginning of
mem_map and corrupts adjacent kernel memory. Fix this by restoring the
previous behavior for NOMMU kernels.

Fixes: 3335068f87 ("riscv: Use PUD/P4D/PGD pages for the linear mapping")
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20240227003630.3634533-3-samuel.holland@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-02 16:32:49 +02:00
..
asm riscv: Fix loading 64-bit NOMMU kernels past the start of RAM 2024-05-02 16:32:49 +02:00
uapi/asm RISC-V: Update AT_VECTOR_SIZE_ARCH for new AT_MINSIGSTKSZ 2024-04-10 16:35:58 +02:00