Kernel series plugs allocator races with memory hotplug
Eight stable-bound fixes stop zonelist rebuilds from causing wrong-zone allocations and NULL pointer crashes.
Gregory Price of Meta has posted an eight-patch series that closes races between the page allocator and memory hotplug, bugs that can hand out pages from the wrong zone or node, fail allocations that should succeed, or crash the kernel with NULL pointer dereferences.
Memory hotplug rebuilds zonelists in place. Allocators that walk those lists at the same time can see intermediate or truncated state: a preferred zone slot that suddenly becomes NULL, a slot that shifts underfoot so a GFP_KERNEL request lands in ZONE_MOVABLE, a nodemask-bound allocation that escapes its node, or a hugetlb or contiguous-range grab that takes memory from the wrong place. Offlining an emptied zone can also free pagesets still held by the vmstat worker. Several of the walks reread the same zonelist slot twice, so a rebuild between the two reads turns a valid zone into the terminator and oopses in zone_to_nid.
The series makes the walkers read each slot once, widens the existing zonelist sequence check so it runs on success as well as failure (and under CONFIG_MEMORY_HOTPLUG rather than only HOTREMOVE), and restarts affected paths including the hugetlb pool walk, alloc_contig_pages, and mempolicy slab-node selection when a rebuild is detected. A slowpath fix also restores a missed reserves retry after a restart so no-reclaim callers are not stranded.
Price reproduced each race in a three-node QEMU guest with kprobes widening the windows; unmodified kernels failed or crashed consistently, and the series cleared every case. Vlastimil Babka has begun reviewing the patches. All eight are marked for stable.