mirror-linux/drivers/of
Jianpeng Chang 3e8ade58b7 arm64: kdump: Fix elfcorehdr overlap caused by reserved memory processing reorder
Commit 8a6e02d0c0 ("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 8a6e02d0c00e:
  OF: fdt: Reserving 1 KiB of memory at 0xf4fff000 for elfcorehdr
  OF: reserved mem: 0xf3000000..0xf3ffffff bman-fbpr

After 8a6e02d0c00e:
  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: 8a6e02d0c0 ("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>
2025-12-16 07:59:30 -06:00
..
unittest-data samples: rust: platform: Add property child and reference args examples 2025-06-25 17:48:41 +02:00
.kunitconfig
Kconfig
Makefile
address.c of/address: Remove the incorrect and misleading comment 2025-11-17 11:24:51 -06:00
base.c of: Add wrappers to match root node with OF device ID tables 2025-11-26 19:38:24 -06:00
cpu.c
device.c of: Clarify OF device context in of_match_device() comment 2025-07-30 17:49:06 -05:00
dynamic.c of: dynamic: Fix use after free in of_changeset_add_prop_helper() 2025-08-22 16:21:35 -05:00
empty_root.dts
fdt.c arm64: kdump: Fix elfcorehdr overlap caused by reserved memory processing reorder 2025-12-16 07:59:30 -06:00
fdt_address.c
irq.c Devicetree updates for v6.19: 2025-12-04 15:50:37 -08:00
kexec.c arm64: add KHO support 2025-05-12 23:50:41 -07:00
kobj.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
kunit_overlay_test.dtso
module.c
of_kunit_helpers.c of: Skip devicetree kunit tests when RISCV+ACPI doesn't populate root node 2025-11-26 19:46:23 -06:00
of_numa.c of_numa: fix uninitialized memory nodes causing kernel panic 2025-08-27 22:45:41 -07:00
of_private.h Devicetree for v6.15: 2025-03-29 11:23:16 -07:00
of_reserved_mem.c of/reserved_mem: Simplify the logic of __reserved_mem_alloc_size() 2025-11-20 08:32:49 -06:00
of_test.c
overlay.c of: overlay: Avoid spurious error messages in of_overlay_remove() 2025-11-17 11:24:51 -06:00
overlay_test.c
pdt.c
platform.c of/platform: Use typed accessors rather than of_get_property() 2025-03-14 18:01:42 -05:00
property.c of: base: Add of_property_read_u8_index 2025-12-08 12:37:26 +05:30
resolver.c of: Introduce and apply private is_pseudo_property() 2025-02-25 08:43:00 -06:00
unittest.c of: unittest: Fix device reference count leak in of_unittest_pci_node_verify 2025-10-01 09:33:23 -05:00