Re: [PATCH v2 06/69] mm/sparse: Panic on memmap and usemap allocation failure
From: Oscar Salvador
Date: Thu May 14 2026 - 04:15:55 EST
On Wed, May 13, 2026 at 09:04:34PM +0800, Muchun Song wrote:
> When vmemmap or usemap allocation fails, sparse_init_nid() currently
> marks the section non-present and continues. Later boot-time code can
> still walk PFNs in that section without checking for this partial setup,
> which leads to invalid accesses. subsection_map_init() can also touch an
> unallocated usemap.
>
> Auditing and fixing all early PFN walkers for this case is not worth the
> complexity. These allocation failures are expected to be fatal anyway,
> and other memory models already treat them that way.
>
> Make memmap and usemap allocation failures panic immediately instead of
> trying to recover and crashing later in less obvious ways. This is also
> consistent with how other memory model configurations handle memmap
> allocation failures.
>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
Yes, one could argue that if we fail to allocate memory at that early
stage we are already screwed.
Acked-by: Oscar Salvador <osalvador@xxxxxxx>
--
Oscar Salvador
SUSE Labs