Skip to content

Commit 3e8ade5

Browse files
Jianpeng Changrobherring
authored andcommitted
arm64: kdump: Fix elfcorehdr overlap caused by reserved memory processing reorder
Commit 8a6e02d ("of: reserved_mem: Restructure how the reserved memory regions are processed") changed the processing order of reserved memory regions, causing elfcorehdr to overlap with dynamically allocated reserved memory regions during kdump kernel boot. The issue occurs because: 1. kexec-tools allocates elfcorehdr in the last crashkernel reserved memory region and passes it to the second kernel 2. The problematic commit moved dynamic reserved memory allocation (like bman-fbpr) to occur during fdt_scan_reserved_mem(), before elfcorehdr reservation in fdt_reserve_elfcorehdr() 3. bman-fbpr with 16MB alignment requirement can get allocated at addresses that overlap with the elfcorehdr location 4. When fdt_reserve_elfcorehdr() tries to reserve elfcorehdr memory, overlap detection identifies the conflict and skips reservation 5. kdump kernel fails with "Unable to handle kernel paging request" because elfcorehdr memory is not properly reserved The boot log: Before 8a6e02d: OF: fdt: Reserving 1 KiB of memory at 0xf4fff000 for elfcorehdr OF: reserved mem: 0xf3000000..0xf3ffffff bman-fbpr After 8a6e02d: OF: reserved mem: 0xf4000000..0xf4ffffff bman-fbpr OF: fdt: elfcorehdr is overlapped Fix this by ensuring elfcorehdr reservation occurs before dynamic reserved memory allocation. Fixes: 8a6e02d ("of: reserved_mem: Restructure how the reserved memory regions are processed") Signed-off-by: Jianpeng Chang <jianpeng.chang.cn@windriver.com> Link: https://patch.msgid.link/20251205015934.700016-1-jianpeng.chang.cn@windriver.com Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 8f0b4cc commit 3e8ade5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/of/fdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ void __init early_init_fdt_scan_reserved_mem(void)
503503
if (!initial_boot_params)
504504
return;
505505

506-
fdt_scan_reserved_mem();
507506
fdt_reserve_elfcorehdr();
507+
fdt_scan_reserved_mem();
508508

509509
/* Process header /memreserve/ fields */
510510
for (n = 0; ; n++) {

0 commit comments

Comments
 (0)