Re: [PATCH] mm: thp: Deny THP for guest_memfd and secretmem in file_thp_enabled()

From: David Hildenbrand (Arm)

Date: Wed Feb 11 2026 - 04:29:53 EST


On 2/11/26 01:58, Ackerley Tng wrote:
Ackerley Tng <ackerleytng@xxxxxxxxxx> writes:

"David Hildenbrand (Arm)" <david@xxxxxxxxxx> writes:


Yes. If there is no guest_memfd we wouldn't need it.


Seems like on 5.15.199 there's a hugepage_vma_check(), which will return
false since secretmem has vma->vm_ops defined [1], so secretmem VMAs are
skipped.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/khugepaged.c?h=v5.15.199#n469


On 6.1.162, secretmem VMAs are skipped since secretmem VMAs are not
anonymous [2].

[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/huge_memory.c?h=v6.1.162#n135

Same for 6.6.123 [3].

[3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/mm/huge_memory.c?h=v6.6.123#n125

It breaks in 6.12.69 [4].


Do you have a reproducer? If so, which behavior does it trigger?

I would assume that we would suddenly have secretmem pages (THP) that have a directmap. Or some page copy would crash the kernel.

--
Cheers,

David