Skip to content
Unverified Commit 994af182 authored by Nam Cao's avatar Nam Cao Committed by Palmer Dabbelt
Browse files

riscv: fix overlap of allocated page and PTR_ERR



On riscv32, it is possible for the last page in virtual address space
(0xfffff000) to be allocated. This page overlaps with PTR_ERR, so that
shouldn't happen.

There is already some code to ensure memblock won't allocate the last page.
However, buddy allocator is left unchecked.

Fix this by reserving physical memory that would be mapped at virtual
addresses greater than 0xfffff000.

Reported-by: default avatarBjörn Töpel <bjorn@kernel.org>
Closes: https://lore.kernel.org/linux-riscv/878r1ibpdn.fsf@all.your.base.are.belong.to.us


Fixes: 76d2a049 ("RISC-V: Init and Halt Code")
Signed-off-by: default avatarNam Cao <namcao@linutronix.de>
Cc: <stable@vger.kernel.org>
Tested-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Reviewed-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
Reviewed-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Link: https://lore.kernel.org/r/20240425115201.3044202-1-namcao@linutronix.de


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent c3f38fa6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment