Re: [PATCH v3 3/3] liveupdate: kho: allocate metadata directly from the buddy allocator

From: David Matlack

Date: Mon Oct 27 2025 - 19:05:12 EST


On Mon, Oct 20, 2025 at 5:09 PM Pasha Tatashin
<pasha.tatashin@xxxxxxxxxx> wrote:
>
> KHO allocates metadata for its preserved memory map using the slab
> allocator via kzalloc(). This metadata is temporary and is used by the
> next kernel during early boot to find preserved memory.
>
> A problem arises when KFENCE is enabled. kzalloc() calls can be
> randomly intercepted by kfence_alloc(), which services the allocation
> from a dedicated KFENCE memory pool. This pool is allocated early in
> boot via memblock.
>
> When booting via KHO, the memblock allocator is restricted to a "scratch
> area", forcing the KFENCE pool to be allocated within it. This creates a
> conflict, as the scratch area is expected to be ephemeral and
> overwriteable by a subsequent kexec. If KHO metadata is placed in this
> KFENCE pool, it leads to memory corruption when the next kernel is
> loaded.
>
> To fix this, modify KHO to allocate its metadata directly from the buddy
> allocator instead of slab.
>
> Fixes: fc33e4b44b27 ("kexec: enable KHO support for memory preservation")
> Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
> Reviewed-by: Pratyush Yadav <pratyush@xxxxxxxxxx>

Reviewed-by: David Matlack <dmatlack@xxxxxxxxxx>