Loading
riscv: Sparse-Memory/vmemmap out-of-bounds fix
stable inclusion from stable-v5.10.212 commit 8af1c121b0102041809bc137ec600d1865eaeedd category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9E466 CVE: CVE-2024-26795 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8af1c121b0102041809bc137ec600d1865eaeedd -------------------------------- [ Upstream commit a11dd49dcb9376776193e15641f84fcc1e5980c9 ] Offset vmemmap so that the first page of vmemmap will be mapped to the first page of physical memory in order to ensure that vmemmap’s bounds will be respected during pfn_to_page()/page_to_pfn() operations. The conversion macros will produce correct SV39/48/57 addresses for every possible/valid DRAM_BASE inside the physical memory limits. v2:Address Alex's comments Suggested-by:Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by:
Dimitris Vlachos <dvlachos@ics.forth.gr> Reported-by:
Dimitris Vlachos <dvlachos@ics.forth.gr> Closes: https://lore.kernel.org/linux-riscv/20240202135030.42265-1-csd4492@csd.uoc.gr Fixes: d95f1a54 ("RISC-V: Implement sparsemem") Reviewed-by:
Alexandre Ghiti <alexghiti@rivosinc.com> Link: https://lore.kernel.org/r/20240229191723.32779-1-dvlachos@ics.forth.gr Signed-off-by:
Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Zheng Zucheng <zhengzucheng@huawei.com> (cherry picked from commit 9428674e)