[RESEND PATCH v8 7/8] of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP

sashiko-bot at kernel.org sashiko-bot at kernel.org
Thu Oct 15 23:32:40 PDT 2026


Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] of: fdt: boot panic on sh due to memblock_mark_nodump splitting before resize
--

commit c3780e76cb8942c20c5a5a3858d45f390651c1c3
Author: Wandun Chen <chenwandun at lixiang.com>

of: reserved_mem: mark /reserved-memory entries with MEMBLOCK_NODUMP

Mark non-dumpable reserved-memory regions with MEMBLOCK_NODUMP so
kdump can omit them from the vmcore.

> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index ecc9231026224..a5f223a74b7ea 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -1285,6 +1285,7 @@ void __init unflatten_device_tree(void)
>  
>  	/* Save the statically-placed regions in the reserved_mem array */
>  	fdt_scan_reserved_mem_late();
> +	fdt_mark_reserve_mem_nodump();

[Severity: High]
Could this cause a boot panic on architectures like sh that call
unflatten_device_tree() before memblock resizing is allowed?

On the sh architecture, unflatten_device_tree() is called prior to
paging_init():

arch/sh/kernel/setup.c:setup_arch() {
...
#ifdef CONFIG_BUILTIN_DTB
	unflatten_and_copy_device_tree();
#else
	unflatten_device_tree();
#endif

	paging_init();
...
}

Dynamic resizing of the memblock array is only enabled during paging_init():

arch/sh/mm/init.c:paging_init() {
...
	memblock_enforce_memory_limit(memory_limit);
	memblock_allow_resize();
...
}

Since fdt_mark_reserve_mem_nodump() applies MEMBLOCK_NODUMP flags,
it forces memblock.memory regions to be split. Because memblock_can_resize
is 0 at this early stage, if the device tree specifies enough non-dumpable
reserved memory regions to exceed INIT_MEMBLOCK_MEMORY_REGIONS,
memblock_double_array() will unconditionally panic the kernel during early
boot.

>  
>  	/* Populate an empty root node when bootloader doesn't provide one */
>  	if (!fdt) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261016061549.4181390-1-chenwandun1@gmail.com?part=7



More information about the kexec mailing list