[PATCH 0/3] Fix kexec_file segment placement on RISC-V

"Yufan Dou" <[email protected]> Thu, 6 Aug 2026 15:22:53 +0800
Newsgroups org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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; patch 1/3 is not, as the commit it fixes has not been
released yet.

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: 76e885f2b89d9e88291c1864e5f89a6b180768da
-- 
2.34.1

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv