[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015053121.3978358-1-pasha.tatashin@soleen.com>
Date: Wed, 15 Oct 2025 01:31:19 -0400
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: akpm@...ux-foundation.org,
brauner@...nel.org,
corbet@....net,
graf@...zon.com,
jgg@...pe.ca,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-mm@...ck.org,
masahiroy@...nel.org,
ojeda@...nel.org,
pasha.tatashin@...een.com,
pratyush@...nel.org,
rdunlap@...radead.org,
rppt@...nel.org,
tj@...nel.org,
jasonmiu@...gle.com,
dmatlack@...gle.com,
skhawaja@...gle.com
Subject: [PATCH 0/2] KHO: Fix metadata allocation in scratch area
This series fixes a memory corruption bug in KHO that occurs when KFENCE
is enabled.
The root cause is that KHO metadata, allocated via kzalloc(), can be
randomly serviced by kfence_alloc(). When a kernel boots via KHO, the
early memblock allocator is restricted to a "scratch area". This forces
the KFENCE pool to be allocated within this scratch area, creating a
conflict. If KHO metadata is subsequently placed in this pool, it gets
corrupted during the next kexec operation.
The series is structured in two parts:
Patch 1/2 introduces a debug-only feature (CONFIG_KEXEC_HANDOVER_DEBUG)
that adds checks to detect and fail any operation that attempts to place
KHO metadata or preserved memory within the scratch area. This serves as
a validation and diagnostic tool to confirm the problem without
affecting production builds.
Patch 2/2 provides the fix by modifying KHO to allocate its metadata
directly from the buddy allocator instead of SLUB. This bypasses the
KFENCE interception entirely.
Pasha Tatashin (2):
liveupdate: kho: warn and fail on metadata or preserved memory in
scratch area
liveupdate: kho: allocate metadata directly from the buddy allocator
kernel/liveupdate/Kconfig | 15 ++++++
kernel/liveupdate/kexec_handover.c | 51 ++++++++++++++++-----
kernel/liveupdate/kexec_handover_debug.c | 18 ++++++++
kernel/liveupdate/kexec_handover_internal.h | 9 ++++
4 files changed, 81 insertions(+), 12 deletions(-)
base-commit: 0b2f041c47acb45db82b4e847af6e17eb66cd32d
--
2.51.0.788.g6d19910ace-goog
Powered by blists - more mailing lists