[PATCH 0/2] riscv: fix KFENCE pool initialization

Jackie Liu liu.yun at linux.dev
Fri Oct 30 03:59:31 PDT 2026


From: Jackie Liu <liuyun01 at kylinos.cn>

RISC-V KFENCE pool reservation failures can prevent the system from
booting. These fixes allow boot to continue with KFENCE disabled and
prepare late pools with the page mappings KFENCE requires.

The first patch fixes P4D leaf detection in the linear-map splitter.
The second uses that splitter to prepare late KFENCE pools, while
retaining the early PTE mapping.

Built RV64 kernels and RV32 pageattr.o. QEMU KFENCE KUnit covered boot
and runtime enabling, pool reservation failure, and page-table allocation
failures.

Thanks,
Jackie

Jackie Liu (2):
  riscv: Recognize P4D leaves when splitting the linear mapping
  riscv: Prepare late KFENCE pools with PTE mappings

 arch/riscv/include/asm/kfence.h     |  4 +-
 arch/riscv/include/asm/set_memory.h |  3 ++
 arch/riscv/mm/init.c                | 23 +++++++++--
 arch/riscv/mm/pageattr.c            | 59 ++++++++++++++++++++---------
 4 files changed, 67 insertions(+), 22 deletions(-)

base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8



More information about the linux-riscv mailing list