Re: mm/hugetlb: a min_size-only hugetlbfs subpool is kfree()d before its last pinned page is released, so free_huge_folio() takes a spinlock on freed memory (UAF)

From: David Hildenbrand (Arm)

Date: Thu Nov 26 2026 - 01:39:25 EST


On 11/26/26 06:52, Ackerley Tng wrote:
> "David Hildenbrand (Arm)" <david@xxxxxxxxxx> writes:
>
>> Hi Ackerley,
>>
>> does your series [1] actually fix this? What's the status of that?
>>
>> [1]
>> https://lore.kernel.org/linux-mm/20260916-hugetlb-subpool-always-track-used-v3-0-38aae9b5ccdd@xxxxxxxxxx/
>>
>
> Hi!
>
> Yes, "mm/hugetlb: Track used_hpages when getting/putting pages from
> subpool" fixes this bug.
>
> I've been tied up with other work since [1] was posted.
>
> I have a set of reproducers locally for the various combinations of
> min_size, max_size, and both defined, while taking various paths
> (reservations vs actual allocations).
>
> The plan was to always track used_hpages, which simplifies the
> accounting and it does fix all the reproducers I have.
>
> I thought in addition to simplifying and fixing all those paths, it
> would always fix races, but AI showed me a repro with races that broke
> the model.
>
> Because of the repro, I planned to re-evaluate to see if there's a
> better model/clean fix but haven't got around to that.
>
> I'll try to get to it in the next few weeks?

Thanks. It's a UAF, so higher priority. But I think admin interaction is
required to trigger the UAF, so lower priority :)

--
Cheers,

David