[PATCH RESEND 0/3] Fix kexec_file segment placement on RISC-V
From: Yufan Dou
Date: Wed Sep 02 2026 - 05:21:49 EST
This patchset fixes three ways in which kexec_file_load() can place
segments where the next kernel cannot use them:
- Patch 1/3 keeps the extra segments within the direct map of the next
kernel, which is narrower when an Sv48/Sv57 kernel loads an Sv39 one
- Patch 2/3 sizes the ELF placement search by the extent the image
occupies in memory rather than by the length of the file
- Patch 3/3 reserves the PMD-aligned tail of the kernel image that the
next kernel reserves under CONFIG_STRICT_KERNEL_RWX
Patch 1/3 is independent. Patch 3/3 depends on patch 2/3, and both are
marked for stable.
Resending rebased onto current mainline (v7.3-rc1); no code changes
since the previous posting.
Yufan Dou (3):
riscv: kexec_file: constrain extra segments to the Sv39 direct map
riscv: kexec_file: size the ELF placement search by the load extent
riscv: kexec: reserve the PMD-aligned kernel image range
arch/riscv/kernel/kexec_elf.c | 38 ++++++++++++++++++++++----
arch/riscv/kernel/kexec_image.c | 7 ++++-
arch/riscv/kernel/machine_kexec_file.c | 25 ++++++++++++++++-
3 files changed, 62 insertions(+), 8 deletions(-)
base-commit: 89a312991dc6e638a36adc43ccb91dbc25504c04
--
2.34.1