Skip to content

kfence: fix pool allocation failure handling

Jackie Liu linux-mm linux-riscv 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Add Marco Elver's Reviewed-by to patches 1 and 2; their code is unchanged.
- Drop the unused asm/kfence.h include from patch 3. Sashiko reported that its unconditional inclusion breaks RV32 and NOMMU builds.
- Credit Sashiko and kernel test robot with Reported-by and Closes tags in patch 3.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3kfence: fix pool cleanup on metadata allocation failuremm/kfence/core.c+2 -10 replies
2/3kfence: clear the pool pointer before freeing pagesmm/kfence/core.c+2 -10 replies
3/3riscv: keep booting if KFENCE pool reservation failsarch/riscv/include/asm/kfence.h arch/riscv/mm/init.c+17 -50 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchMarco Elver
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] kfence: fix pool allocation failure handling

From: Jackie Liu <[email protected]>

Fix the cleanup address and page reuse window in failed late KFENCE initialization. Also let RISC-V boot if the early pool reservation fails.

Patch 2 depends on patch 1. Patch 3 can be applied independently.

Changes in v2:
- Add Marco Elver's Reviewed-by to patches 1 and 2; their code is unchanged.
- Drop the unused asm/kfence.h include from patch 3. Sashiko reported that its unconditional inclusion breaks RV32 and NOMMU builds.
- Credit Sashiko and kernel test robot with Reported-by and Closes tags in patch 3.

v1: https://lore.kernel.org/all/[email protected]/
Reports:
https://sashiko.dev/#/patchset/[email protected]?part=3
https://lore.kernel.org/all/[email protected]/
https://lore.kernel.org/oe-kbuild-all/[email protected]/

Validation on AArch64 Linux with Clang 17.0.6 and GNU ld 2.40:
- RV32 and NOMMU: reproduced v1 failures; v2 init.o builds successfully.
- RV64 defconfig with CONFIG_KFENCE=y: init.o, mm/kfence/core.o, and the full Image build pass without warnings.
The existing NOMMU warning in include/asm-generic/io.h is identical to that from the unpatched base. No boot or failure-injection tests were run. All three patches pass checkpatch.pl --strict and git diff --check.

OpenAI Codex assisted with review, adaptation, wording, and validation.

Jackie Liu (3):
kfence: fix pool cleanup on metadata allocation failure
kfence: clear the pool pointer before freeing pages
riscv: keep booting if KFENCE pool reservation fails

 arch/riscv/include/asm/kfence.h |  4 +++-
 arch/riscv/mm/init.c            | 18 ++++++++++++++----
 mm/kfence/core.c                |  6 ++++--
 3 files changed, 21 insertions(+), 7 deletions(-)

base-commit: 7be4bc52fd9e0e55dc9a2e0232b89427d2c4b614

Signature · 1 line
2.56.0