mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
riscv: kexec_file: Fix crashk_low_res not exclude bug
As done in commit944a45abfa("arm64: kdump: Reimplement crashkernel=X") and commit4831be702b("arm64/kexec: Fix missing extra range for crashkres_low.") for arm64, while implementing crashkernel=X,[high,low], riscv should have excluded the "crashk_low_res" reserved ranges from the crash kernel memory to prevent them from being exported through /proc/vmcore, and the exclusion would need an extra crash_mem range. Just simply tested on qemu with crashkernel=4G with kexec in [1] mentioned in [2]. And the second kernel can be started normally. # dmesg | grep crash [ 0.000000] crashkernel low memory reserved: 0xf8000000 - 0x100000000 (128 MB) [ 0.000000] crashkernel reserved: 0x000000017fe00000 - 0x000000027fe00000 (4096 MB) [1]: https://github.com/chenjh005/kexec-tools/tree/build-test-riscv-v2 [2]: https://lore.kernel.org/all/20230726175000.2536220-1-chenjiahao16@huawei.com/ Cc: Guo Ren <guoren@kernel.org> Cc: Baoquan He <bhe@redhat.com> Fixes:5882e5acf1("riscv: kdump: Implement crashkernel=X,[high,low]") Reviewed-by: Guo Ren <guoren@kernel.org> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Link: https://github.com/chenjh005/kexec-tools/tree/build-test-riscv-v2 Link: https://lore.kernel.org/all/20230726175000.2536220-1-chenjiahao16@huawei.com/ Link: https://patch.msgid.link/20260629094746.191843-2-ruanjinjie@huawei.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
This commit is contained in:
parent
dc59e4fea9
commit
5fc6e7d453
|
|
@ -62,7 +62,7 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
|
|||
unsigned int nr_ranges;
|
||||
int ret;
|
||||
|
||||
nr_ranges = 1; /* For exclusion of crashkernel region */
|
||||
nr_ranges = 2; /* For exclusion of crashkernel region */
|
||||
walk_system_ram_res(0, -1, &nr_ranges, get_nr_ram_ranges_callback);
|
||||
|
||||
cmem = kmalloc_flex(*cmem, ranges, nr_ranges);
|
||||
|
|
@ -77,8 +77,16 @@ static int prepare_elf_headers(void **addr, unsigned long *sz)
|
|||
|
||||
/* Exclude crashkernel region */
|
||||
ret = crash_exclude_mem_range(cmem, crashk_res.start, crashk_res.end);
|
||||
if (!ret)
|
||||
ret = crash_prepare_elf64_headers(cmem, true, addr, sz);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (crashk_low_res.end) {
|
||||
ret = crash_exclude_mem_range(cmem, crashk_low_res.start, crashk_low_res.end);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = crash_prepare_elf64_headers(cmem, true, addr, sz);
|
||||
|
||||
out:
|
||||
kfree(cmem);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user