Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pratyush Yadav" <pratyush@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Pasha Tatashin" <pasha.tatashin@soleen.com>,
	"Alexander Graf" <graf@amazon.com>
Cc: kexec@lists.infradead.org, "Bing Jiao" <bingjiao@google.com>
Subject: Re: [PATCH] kho: do not reserve empty per-node bootmem areas
Date: Wed, 14 Oct 2026 13:27:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-171352@kernel.org> (raw)
In-Reply-To: <20261014131547.259138-1-pratyush@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kho: incomplete fix for zero-size memblock allocations in bootmem
--

commit 67ab500bd948f5a3b52f1c8170626cb8f1dfc6c3
Author: Pratyush Yadav (Google) <pratyush@kernel.org>

kho: do not reserve empty per-node bootmem areas

Some nodes do not allocate any early boot memory, causing memblock to
return an address without reserving anything when requested with zero size.
This address is recorded in kho_bootmem with a size of 0, and can cause KHO
to fail to initialize. This patch skips bootmem reservation for memoryless
nodes entirely.

> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 7018e25e4eda1..6f1f55fe31819 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c

[ ... ]

> @@ -882,6 +882,9 @@ static void __init kho_reserve_bootmem(void)
>  	 */
>  	for_each_node_state(nid, N_MEMORY) {
>  		size = bootmem_size_node(nid);
> +		if (!size)
> +			continue;
> +
>  		addr = memblock_alloc_range_nid(size, BOOTMEM_ALIGNMENT_BYTES,

[Severity: High]
This adds a zero-size check for per-node bootmem allocations, but does the
same issue exist for bootmem_size_lowmem and bootmem_size_global?

Looking at kho_reserve_bootmem() just before this hunk, they are allocated
without a similar check:

kernel/liveupdate/kexec_handover.c:kho_reserve_bootmem() {
    ...
	size = bootmem_size_lowmem;
	addr = memblock_phys_alloc_range(size, BOOTMEM_ALIGNMENT_BYTES, 0,
					 ARCH_LOW_ADDRESS_LIMIT);
	if (!addr) {
    ...
	size = bootmem_size_global;
	addr = memblock_phys_alloc(size, BOOTMEM_ALIGNMENT_BYTES);
	if (!addr) {
    ...
}

If bootmem_size_lowmem or bootmem_size_global evaluates to 0 (for example
via boot parameters or on systems lacking lowmem), will memblock return an
unreserved address and add it to kho_bootmem with size 0? Alternatively,
if the region has no free memory, could the 0-size allocation fail and halt
KHO initialization entirely?

Later, if KHO attempts to preserve a contiguous range of pages that spans
across this unreserved boundary, could kho_bootmem_overlap() incorrectly
evaluate the overlap and fail the preservation request?

>  						0, MEMBLOCK_ALLOC_ACCESSIBLE,
>  						nid, true);
>  		if (!addr) {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131547.259138-1-pratyush@kernel.org?part=1


  reply	other threads:[~2026-10-14 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 13:15 [PATCH] kho: do not reserve empty per-node bootmem areas Pratyush Yadav
2026-10-14 13:27 ` sashiko-bot [this message]
2026-10-14 13:39   ` Pratyush Yadav

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=sashiko-outbox-171352@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bingjiao@google.com \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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