From: Eliav Farber walk_to_pmd() asserts that the PMD entry it returns is not huge, but does so without holding the PMD lock, so the assertion is only valid if nothing can concurrently install a huge PMD entry in the range. This is not the case for a VMA whose driver implements both ->fault and ->huge_fault and which invokes vmf_insert_pfn() from the former. The existence of prctl(PR_SET_THP_DISABLE) is problematic here, as it only takes the mmap write lock and faults taken under the VMA lock are unaffected by this. This can result in two concurrent threads faulting the same thing disagreeing as to whether to attempt a huge fault and thus ->fault and ->huge_fault running at the same time and triggering this assertion. So just remove the assert. Target the commit which introduced the first driver able to do this for the fix - vfio-pci. DAX also mixes fault orders within a VMA, but serialises them using its own mapping entry lock. Link: https://lore.kernel.org/all/20261112051440.16140-2-farbere@amazon.com/ Fixes: f9e54c3a2f5b ("vfio/pci: implement huge_fault support") Cc: stable@vger.kernel.org Signed-off-by: Eliav Farber [ ljs: rewrote commit message ] Reviewed-by: Jose A. Perez de Azpillaga Tested-by: Gregory Price (Meta) Reviewed-by: Gregory Price (Meta) Reviewed-by: Zi Yan Reviewed-by: David Hildenbrand (Arm) Reviewed-by: T.J. Mercier Signed-off-by: Lorenzo Stoakes (ARM) --- mm/memory.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 0e994f076bf7..c07e1de63043 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2401,7 +2401,6 @@ static int walk_to_pmd(struct mm_struct *mm, unsigned long addr, pmd_t **pmdp) if (!pmd) return -ENOMEM; - VM_BUG_ON(pmd_trans_huge(*pmd)); *pmdp = pmd; return 0; } -- 2.56.1