[PATCH] arm: use the zImage tag's real TEXT_OFFSET for kernel placement
Simon Horman
horms at kernel.org
Mon Oct 5 01:46:26 PDT 2026
On Mon, Aug 31, 2026 at 12:58:27PM +0000, Tom Fitzhenry wrote:
> The zImage loader assumes TEXT_OFFSET is 0x8000 and sizes the kernel
> reservation as if the decompressed kernel lands at RAM base + 0x8000.
> Multiplatform armv7 kernels, however, are built with a per-platform
> TEXT_OFFSET: arch/arm/Makefile warns that "this offset is critical to
> the functioning of kexec-tools", and e.g. ARCH_MESON uses 0x00208000.
>
> With such a kernel the decompressor places the inflated kernel ~2 MB
> higher than kexec-tools assumed, so the initrd placed at the estimated
> end of the kernel image lands inside the decompressor's scratch area
> or the new kernel's own reservation. The kexec'd kernel then fails
> with "RAMDISK: Couldn't find valid RAM disk image" or "INITRD: ...
> overlaps in-use memory region", as seen kexec'ing an armv7 NixOS
> kernel on a Netgear RN102 (its multiplatform config selects
> ARCH_MESON).
>
> The zImage extension tag has recorded TEXT_OFFSET since v5.10 (commit
> 83dfeedb6663, "ARM: add TEXT_OFFSET to decompressor kexec image
> structure"), but the loader only reads size_ptr and bss_size from it.
> Read the real value and place the zImage there. Older kernels do not
> carry it and keep the historical 0x8000 default, just as the arm64
> loader falls back to 0x80000 for older kernels (commit 522df5f7217f,
> "arm64: Add arm64 kexec support").
>
> Note on tooling: this patch was developed with assistance from
> DeepSeek LLM, which helped diagnose the failure and draft the fix.
> Tested by kexec'ing arm zImages with non-default TEXT_OFFSET under
> QEMU with both a synthetic config and the affected RN102's config,
> asserting the kexec'd initrd runs.
>
> Signed-off-by: Tom Fitzhenry <tom at tom-fitzhenry.me.uk>
> Link: https://git.kernel.org/torvalds/c/83dfeedb6663
> Link: https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=522df5f7217fda01ece3f6ac3e9987b0320c2bb0
Thanks, applied.
Sorry for the delay.
- arm: use the zImage tag's real TEXT_OFFSET for kernel placement
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=c1a526c87eb1
More information about the kexec
mailing list