Re: [PATCH v2 22/31] mm: taint device sections before setting subsections valid
From: Rik van Riel
Date: Fri Dec 04 2026 - 12:56:49 EST
On Fri, 2026-12-04 at 13:50 +0100, David Hildenbrand (Arm) wrote:
> Adding ZONE_DEVICE memory to an online section can make the new
> subsections valid before the section is tainted.
>
> Consequently, a concurrent pfn_to_online_page() can return an
> uninitialized device page, triggering a BUG with CONFIG_DEBUG_VM.
>
> Let's fix it by tainting the section in fill_subsection_map() before
> setting the validity bits. Pair the write barrier with
> test_bit_acquire()
> in pfn_to_online_page() by introducing a new
> pfn_section_valid_acquire().
>
> This has low urgency, as it requires racing with hotplug of
> ZONE_DEVICE
> memory, which is privileged.
>
> Fixes: 1f90a3477df3 ("mm: teach pfn_to_online_page() about
> ZONE_DEVICE section collisions")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Chris Mason <mason@xxxxxxxxxx>
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>
--
All Rights Reversed.