From: Simon Horman <horms@kernel.org>
To: Tom Fitzhenry <tom@tom-fitzhenry.me.uk>
Cc: kexec@lists.infradead.org
Subject: Re: [PATCH] arm: use the zImage tag's real TEXT_OFFSET for kernel placement
Date: Mon, 5 Oct 2026 09:46:26 +0100 [thread overview]
Message-ID: <20261005084626.GB184916@horms.kernel.org> (raw)
In-Reply-To: <20260831125828.1524463-1-tom@tom-fitzhenry.me.uk>
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@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
prev parent reply other threads:[~2026-10-05 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:58 [PATCH] arm: use the zImage tag's real TEXT_OFFSET for kernel placement Tom Fitzhenry
2026-10-05 8:46 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261005084626.GB184916@horms.kernel.org \
--to=horms@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=tom@tom-fitzhenry.me.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox