From: sashiko-bot@kernel.org
To: "Chris Down" <chris@chrisdown.name>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"Mike Rapoport" <rppt@kernel.org>,
"Pratyush Yadav" <pratyush@kernel.org>
Cc: "Alexander Graf" <graf@amazon.com>,
"Baoquan He" <baoquan.he@linux.dev>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
kexec@lists.infradead.org, linux-mm@kvack.org,
kernel-team@meta.com
Subject: Re: [PATCH 2/9] kho: Make bootmem reservations visible to fleet monitoring
Date: Thu, 12 Nov 2026 07:54:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-210638@kernel.org> (raw)
In-Reply-To: <c41c639fc5f453d60a265ba42a233f2ea5b48319.1794383544.git.chris@chrisdown.name>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] kho: scratch memory corruption on error path in kho_init()
[1]
--
commit 96d77d1af62b4778bf7f34ac023280de65f57337
Author: Chris Down <chris@chrisdown.name>
kho: Make bootmem reservations visible to fleet monitoring
This commit exposes the total KHO bootmem reservation size in bytes via a
new read-only sysfs attribute at /sys/kernel/kexec/kho_bootmem_size.
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 3046b89e5db49..21d77e29d2bb8 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -942,6 +942,21 @@ static void __init kho_reserve_bootmem(void)
> kho_enable = false;
> }
>
> +phys_addr_t kho_bootmem_size(void)
> +{
> + phys_addr_t size = 0;
> + unsigned int i;
> +
> + /* kho_init() can disable KHO without clearing kho_bootmem_cnt. */
> + if (!kho_enable)
> + return 0;
> +
> + for (i = 0; i < kho_bootmem_cnt; i++)
> + size += kho_bootmem[i].size;
> +
> + return size;
> +}
[Severity: Critical]
This problem wasn't introduced by this patch, but on the kho_init() error
path referenced by this comment, can err_free_bootmem corrupt active memory
during a KHO kexec boot [1]?
During a KHO boot (when fdt is non-NULL), early memblock allocations are
served from the incoming kho_bootmem regions, and memblock_free_all()
releases the remaining unallocated bootmem pages to the buddy allocator.
While the normal path in kho_init() returns early when fdt is non-NULL
before converting kho_bootmem to CMA, the error path frees every
kho_bootmem region unconditionally:
kernel/liveupdate/kexec_handover.c:kho_init() {
...
if (fdt)
return 0;
...
err_free_bootmem:
kho_out.fdt = NULL;
for (int i = 0; i < kho_bootmem_cnt; i++) {
void *start = __va(kho_bootmem[i].addr);
void *end = start + kho_bootmem[i].size;
free_reserved_area(start, end, -1, "");
}
kho_enable = false;
return err;
}
If an initialization step such as kho_alloc_preserve() fails on a KHO boot,
free_reserved_area() runs on pages that are either in use by early-boot
allocations or already managed by the buddy allocator, causing
use-after-free and double free memory corruption.
[1] https://sashiko.dev/#/bug/linux-5ae80b0f-97ab-4112-a0a4-c767da72f4a8
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794383544.git.chris@chrisdown.name?part=2
next prev parent reply other threads:[~2026-11-12 7:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 7:52 [PATCH 0/9] kho, liveupdate: KHO/LUO observability Chris Down
2026-11-11 7:52 ` [PATCH 1/9] kho: Reclaim the metadata page left reserved after kexec Chris Down
2026-11-11 11:08 ` Breno Leitao
2026-11-11 22:29 ` Pasha Tatashin
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 2/9] kho: Make bootmem reservations visible to fleet monitoring Chris Down
2026-11-11 23:14 ` Pasha Tatashin
2026-11-12 7:54 ` sashiko-bot [this message]
2026-11-11 7:53 ` [PATCH 3/9] liveupdate: Make failed retrieves distinguishable from dropped files Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 4/9] selftests/liveupdate: Catch incorrect file accounting across kexec Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 5/9] selftests/kho: Catch missing or zero bootmem reports before kexec Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 6/9] kho: Expose rejected handovers that look like cold boots Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 7/9] kho: Report how much handover memory is preserved and restored Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 8/9] liveupdate: Expose the sequence number for consecutive live updates Chris Down
2026-11-12 7:54 ` sashiko-bot
2026-11-11 7:53 ` [PATCH 9/9] selftests/liveupdate: Check handover revival, sequence and memory stats Chris Down
2026-11-12 7:54 ` sashiko-bot
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-210638@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chris@chrisdown.name \
--cc=corbet@lwn.net \
--cc=graf@amazon.com \
--cc=kernel-team@meta.com \
--cc=kexec@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=skhan@linuxfoundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.