Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796324417; b=l+y2SJKbe8ONIQE+vLRmIxLONhcxdU5YZ3jZFQkTmD+O7EljAedM7ubGD/3MZadaIPy8 Xz697Bovoag2k8L/UPe6BSmefcwJ9EiVByNXumE641IYadwEc10XWU5Wv2Pw222+ZKdfm A6dcd1XcjbT7UYQtsjqK2n6i5DX6myP7OpMA2j724ycm0syj+SLI33LbrAMiVEvJCpr6/ nM0Yil3ZgUt+85Z/sI2JMC2lE8C2d3LNRtpX4BO4IlBCPSmcLpJ8ZhS3tkLcYxvt1s6M9 9wTi4p7rX+tSXv6Trnx+R6OV5jYXyIM3b0dGdhclbuj49d5t9Wv1VAoRTuhYRo2FdFQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796324417; h=Received:DKIM-Signature:Date:To:From:In-Reply-To:References:Subject: Message-Id; bh=xUmI6IGxWywuAHGzmDxivTiYxIEko3li6E9KFMG5OZU=; b=4fYZoPoWH2ixAhUF3fhr/89LMpurJYqCQ3yiFywevvHHuUGJCC74nDlEvSPJCNXAbAew bM/NRxDarLroupnoYEWtcTHRdFN46CeUF6HfWM5VQAuAf6VqaMbidWlaheYU35Wb8Art5 l4rdL07ZAp/seg6KcBxb9yOPb+5MR9suHtAowzMo9tM8NCacE9lYmxHZBecNkvlLKrBlT u4oqpK+s5izzxkxtkPdvLRSNAeoZIEH0DUGO8TrtpxuBTd2NjDd3QZ8dODtd79oF5bL90 HF80FPe6aN/9wMntLDXAS3ADf4/GqZxu//qdWjhsHx9eZWiybWzWK6W3oZqLtb9vhpg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=pg4Qedeu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 643DC606A681 for ; Thu, 3 Dec 2026 19:00:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.a=rsa-sha256 header.s=korg header.b=pg4Qedeu Received: by smtp.kernel.org (Postfix) with ESMTPSA id B64251F031F1; Thu, 3 Dec 2026 19:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1796324416; bh=xUmI6IGxWywuAHGzmDxivTiYxIEko3li6E9KFMG5OZU=; h=Date:To:From:In-Reply-To:References:Subject; b=pg4QedeuwlQJf11QjKwXeTQuxJ5xnzuQAsUx3km82DH/UTzkmjUbGbW7CfOEBcf1w Vbyhg4MCk5hJ+OqL3TXgzg+EoMcoH/0rvaioZB8GeWx3V520/kCDzMaQIIeCWEXjAV pQysmphONbv4E8mMLa0HsL0claHkzIAcTaMjkVM8= Date: Thu, 03 Dec 2026 11:00:16 -0800 To: mm-commits@vger.kernel.org,mason@kernel.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20261125-hugetlb_fixes_2-v1-20-db27fd2f71a8@kernel.org> References: <20261125-hugetlb_fixes_2-v1-20-db27fd2f71a8@kernel.org> Subject: [to-be-updated] mm-hugetlb-resolve-protnone-faults-without-a-uffd-bit.patch removed from -mm tree Message-Id: <20261203190016.B64251F031F1@smtp.kernel.org> X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list The quilt patch titled Subject: mm/hugetlb: resolve protnone faults without a uffd bit has been removed from the -mm tree. Its filename was mm-hugetlb-resolve-protnone-faults-without-a-uffd-bit.patch This patch was dropped because an updated version will be issued ------------------------------------------------------ From: Chris Mason Subject: mm/hugetlb: resolve protnone faults without a uffd bit Date: Wed, 25 Nov 2026 23:33:18 +0100 hugetlb_fault() only restores the protection of protnone entries that have the uffd bit set, assuming that accessible VMAs cannot have other protnone entries. If such an entry existed nevertheless, any access to it would result in an endless fault loop. We are not aware of a way to trigger this: paths that drop the uffd bit (fork(), mremap(), unregistering) restore the protection, and remove_migration_pte() only drops the uffd bit for writable migration entries, which cannot be created from protnone entries. Let's be defensive and make any protnone entry in an accessible VMA accessible again, unless it is an RWP fault that has to be reported to user space, like do_numa_page() does for small folios. [david@kernel.org: adjust comments and description] Link: https://patch.msgid.link/20261125-hugetlb_fixes_2-v1-20-db27fd2f71a8@kernel.org Signed-off-by: Chris Mason Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Andrew Morton Cc: Muchun Song Cc: Oscar Salvador Cc: Jinmeng Zhou Cc: Hongfu Li Cc: Andrea Arcangeli Cc: Naoya Horiguchi Cc: Hugh Dickins Cc: Baolin Wang Cc: Dave Airlie Cc: Vivek Kasireddy Cc: Gerd Hoffmann Cc: Mike Rapoport Cc: Mel Gorman Cc: Dave McCracken Cc: Andy Whitcroft Cc: Adam Litke Cc: Lorenzo Stoakes Cc: Rik van Riel Cc: Liam R. Howlett Cc: Vlastimil Babka Cc: Harry Yoo Cc: Jann Horn Cc: Lance Yang Cc: James Houghton Cc: Yang Shi Cc: Suren Baghdasaryan Cc: Shakeel Butt Cc: Pedro Falcato Cc: Gregory Price Cc: Zi Yan Cc: Joshua Hahn Cc: Rakie Kim Cc: Ying Huang Cc: Matthew Brost Cc: Byungchul Park Cc: Alistair Popple Cc: Wanpeng Li Cc: Andi Kleen Cc: Kenneth W Chen Cc: Michal Hocko Cc: David Rientjes Cc: Joern Engel Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap Cc: Aneesh Kumar K.V Cc: KAMEZAWA Hiroyuki Cc: Kiryl Shutsemau Cc: Sasha Levin Cc: Guillaume Morin Cc: Jason Gunthorpe Cc: luojiajun Cc: Josef Bacik Cc: Daehyeon Ko <4ncienth@gmail.com> Cc: Ackerley Tng Cc: Jiaqi Yan mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) --- a/mm/hugetlb.c~mm-hugetlb-resolve-protnone-faults-without-a-uffd-bit +++ a/mm/hugetlb.c @@ -6332,32 +6332,33 @@ vm_fault_t hugetlb_fault(struct mm_struc } /* - * Protnone hugetlb PTEs with the uffd bit are used by - * userfaultfd RWP for access tracking. Plain PROT_NONE (without the - * marker) is not an RWP fault and is not expected on hugetlb (no - * NUMA hinting), so let normal hugetlb fault handling proceed. + * Protnone hugetlb PTEs with the uffd bit are used by userfaultfd RWP + * for access tracking. Without the bit there is nothing to report, so + * just make the PTE accessible. */ - if (pte_protnone(vmf.orig_pte) && vma_is_accessible(vma) && - huge_pte_uffd(vmf.orig_pte)) { + if (pte_protnone(vmf.orig_pte) && vma_is_accessible(vma)) { spinlock_t *ptl; pte_t pte; /* Sync: drop hugetlb locks before blocking in handle_userfault() */ - if (userfaultfd_rwp(vma) && !userfaultfd_rwp_async(vma)) + if (huge_pte_uffd(vmf.orig_pte) && userfaultfd_rwp(vma) && + !userfaultfd_rwp_async(vma)) return hugetlb_handle_userfault(&vmf, mapping, VM_UFFD_RWP); ptl = huge_pte_lock(h, mm, vmf.pte); pte = huge_ptep_get(mm, vmf.address, vmf.pte); - /* - * TODO: fix all cases where uffd PTE bits remain in VMAs that - * are no longer registered with uffd. - */ - if (pte_protnone(pte) && huge_pte_uffd(pte)) { + if (pte_same(pte, vmf.orig_pte)) { unsigned int shift = huge_page_shift(h); pte = huge_pte_modify(pte, vma->vm_page_prot); pte = arch_make_huge_pte(pte, shift, vma->vm_flags); - /* huge_pte_modify() preserves _PAGE_UFFD; drop it on resolution */ + /* + * huge_pte_modify() preserves _PAGE_UFFD; drop it on + * resolution. + * + * TODO: fix all cases where uffd PTE bits remain in VMAs + * that are no longer registered with uffd. + */ pte = huge_pte_clear_uffd(pte); pte = pte_mkyoung(pte); /* _ Patches currently in -mm which might be from mason@kernel.org are mm-swap-fix-large-swap-in-across-swap-file-extents.patch hugetlbfs-do-not-grow-a-sealed-file-in-mmap.patch mm-hugetlb-keep-surplus-folios-that-are-reserved.patch mm-hugetlb-fix-reservation-leak-on-min_size=-mounts.patch mm-cachestat-count-each-page-only-once.patch mm-cachestat-restart-the-walk-after-each-entry.patch percpu-queue-the-balance-work-on-an-unbound-workqueue.patch mm-vma-fix-uncharge-after-failed-stack-relocation.patch mm-mremap-apply-the-mmap-offset-limits-on-expansion.patch mm-mremap-respect-guard-gaps-on-in-place-expansion.patch mm-vma-make-brk-mappings-non-executable-under-mdwe.patch kfence-use-a-nofault-store-to-zero-the-guard-page.patch mm-filemap-update-the-folio-order-range-atomically.patch mm-userfaultfd-account-memory-allocated-for-unmap-events.patch mm-userfaultfd-drop-fork-context-reference-outside-event_wqhlock.patch mm-madvise-dont-declare-oom-for-madv_willneed-swapin.patch mm-mprotect-fix-unpaired-notifier-start-at-address-0.patch mm-hmm-refuse-secretmem-vmas-in-hmm_range_fault.patch mm-mglru-count-all-generations-as-evictable.patch mm-mglru-test-pg_lru-before-taking-a-folio-reference.patch mm-mglru-report-root-reclaim-to-memorypressure_level.patch a.patch