From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5030A22A1D4 for ; Thu, 9 Jul 2026 02:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783562813; cv=none; b=W94FaYduQIxOdGMepZT5EjSF7Pm4IH2KNpoKduido2MHSfW0ALHA7JB/Y9JfdL4idj0hVvbbRFAbs2TjqBdVtu9yJr4jtLezJmrpOoGq+8NlGXozWsMbLVPzgLD1Nbw68rG/67rRI0ZTuUXZJ97R7eBAMvYEuPDsdb4ar22Fmsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783562813; c=relaxed/simple; bh=jDgNOtNKi2mer+3OH8bk5Q8WsgnEQwReDfxBmg9Pikc=; h=Date:To:From:Subject:Message-Id; b=dg675sQu04o8/rswqxpJc2ahhOfevFj91fsFTN9Ew4pOBArnbw6lrcSlcZgfOBd6NT5GahKYgc80Q1DdQxQZlM963mcczwuTFlcUuIZDaFp6z6aDDElbSJ4hSkKjYwQJJsEoQIcD0ME6FGqS4fOZY3ZJK4bsIYIlBOL54jXd4kQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=rqsjvhKJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="rqsjvhKJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18ACA1F000E9; Thu, 9 Jul 2026 02:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783562812; bh=ddDDU60L0pHWUkLaTARwQDMda9nseXi17OwQwjx7Nr4=; h=Date:To:From:Subject; b=rqsjvhKJl1F4Dv13btanni3HuOhQA4R9cvKp00+FzgGKwNhP+SHX62OPWmUO1/ZbX RIuZiyfxlsOJLgry8tIy21ctKMjW1i8rRobQiQBUozH8TlG0Qt7rYfTao6rix472f9 pgcJSfT28xluxwj/bhgqgZgnMkhb+QmumEbGZBoA= Date: Wed, 08 Jul 2026 19:06:51 -0700 To: mm-commits@vger.kernel.org,kas@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: + userfaultfd-test-uffd-vma-flags-through-the-vma_flags_t-api.patch added to mm-new branch Message-Id: <20260709020652.18ACA1F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: userfaultfd: test uffd VMA flags through the vma_flags_t API has been added to the -mm mm-new branch. Its filename is userfaultfd-test-uffd-vma-flags-through-the-vma_flags_t-api.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/userfaultfd-test-uffd-vma-flags-through-the-vma_flags_t-api.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: "Kiryl Shutsemau (Meta)" Subject: userfaultfd: test uffd VMA flags through the vma_flags_t API Date: Wed, 8 Jul 2026 12:14:05 +0100 The uffd VMA-flag helpers read vma->vm_flags directly. Now that config-gated per-mode masks exist, switch them to the vma_flags_t accessor vma_test_any_mask(), which is the going-forward API and keeps a single place (the VMA_UFFD_* masks) that knows which modes are available on the current build. No functional change: vma_flags_t is in union with vm_flags, so the same bits are read, and the masks fold to the same code the open-coded vm_flags tests produced -- verified identical on gcc and clang, 32- and 64-bit. Link: https://lore.kernel.org/20260708111417.173443-5-kirill@shutemov.name Signed-off-by: Kiryl Shutsemau Suggested-by: Lorenzo Stoakes Assisted-by: Claude:claude-opus-4-8 Acked-by: Mike Rapoport (Microsoft) Reviewed-by: Lorenzo Stoakes Cc: Andrea Arcangeli Cc: David Hildenbrand Cc: James Houghton Cc: Jonathan Corbet Cc: Liam Howlett Cc: Paolo Bonzini Cc: Peter Xu Cc: Sean Christopherson Cc: SeongJae Park Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Zi Yan Signed-off-by: Andrew Morton --- include/linux/userfaultfd_k.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/include/linux/userfaultfd_k.h~userfaultfd-test-uffd-vma-flags-through-the-vma_flags_t-api +++ a/include/linux/userfaultfd_k.h @@ -178,7 +178,8 @@ static inline bool is_mergeable_vm_userf */ static inline bool uffd_disable_huge_pmd_share(struct vm_area_struct *vma) { - return vma->vm_flags & (VM_UFFD_WP | VM_UFFD_MINOR); + return vma_test_any_mask(vma, + mk_vma_flags_from_masks(VMA_UFFD_WP, VMA_UFFD_MINOR)); } /* @@ -190,22 +191,23 @@ static inline bool uffd_disable_huge_pmd */ static inline bool uffd_disable_fault_around(struct vm_area_struct *vma) { - return vma->vm_flags & (VM_UFFD_WP | VM_UFFD_MINOR); + return vma_test_any_mask(vma, + mk_vma_flags_from_masks(VMA_UFFD_WP, VMA_UFFD_MINOR)); } static inline bool userfaultfd_missing(struct vm_area_struct *vma) { - return vma->vm_flags & VM_UFFD_MISSING; + return vma_test_any_mask(vma, VMA_UFFD_MISSING); } static inline bool userfaultfd_wp(struct vm_area_struct *vma) { - return vma->vm_flags & VM_UFFD_WP; + return vma_test_any_mask(vma, VMA_UFFD_WP); } static inline bool userfaultfd_minor(struct vm_area_struct *vma) { - return vma->vm_flags & VM_UFFD_MINOR; + return vma_test_any_mask(vma, VMA_UFFD_MINOR); } static inline bool userfaultfd_pte_wp(struct vm_area_struct *vma, @@ -222,7 +224,7 @@ static inline bool userfaultfd_huge_pmd_ static inline bool userfaultfd_armed(struct vm_area_struct *vma) { - return vma->vm_flags & __VM_UFFD_FLAGS; + return vma_test_any_mask(vma, __VMA_UFFD_FLAGS); } static inline bool vma_has_uffd_without_event_remap(struct vm_area_struct *vma) _ Patches currently in -mm which might be from kas@kernel.org are mm-hugetlb-fix-swap-entry-corruption-when-clearing-uffd-wp-at-fork.patch fs-proc-task_mmu-fix-pagemap_scan-written-state-for-unpopulated-ptes.patch mm-decouple-protnone-helpers-from-config_numa_balancing.patch mm-rename-uffd-wp-pte-bit-macros-to-uffd.patch mm-rename-uffd-wp-pte-accessors-to-uffd.patch userfaultfd-test-uffd-vma-flags-through-the-vma_flags_t-api.patch mm-add-vm_uffd_rwp-vma-flag.patch mm-add-mm_cp_uffd_rwp-change_protection-flag.patch mm-preserve-rwp-marker-across-pte-rewrites.patch mm-handle-vm_uffd_rwp-in-khugepaged-rmap-and-gup.patch userfaultfd-add-uffdio_register_mode_rwp-and-uffdio_rwprotect-plumbing.patch mm-userfaultfd-add-rwp-fault-delivery-and-expose-uffdio_register_mode_rwp.patch mm-pagemap-add-page_is_accessed-for-rwp-tracking.patch userfaultfd-add-uffd_feature_rwp_async-for-async-fault-resolution.patch userfaultfd-add-uffdio_set_mode-for-runtime-sync-async-toggle.patch selftests-mm-add-userfaultfd-rwp-tests.patch documentation-userfaultfd-document-rwp-working-set-tracking.patch