Re: [PATCH V10 2/5] mm: uffd_wp: Add pte_uffd_wp_available()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09.09.25 11:56, Chunyan Zhang wrote:
Some platforms can customize the PTE uffd_wp bit and make it unavailable
even if the architecture allows providing the PTE resource.
This patch adds a macro API which allows architectures to define
their specific ones for checking if the PTE uffd_wp bit is available.

Signed-off-by: Chunyan Zhang <zhangchunyan@xxxxxxxxxxx>
---
  fs/userfaultfd.c                   | 25 +++++++++--------
  include/asm-generic/pgtable_uffd.h | 12 ++++++++
  include/linux/mm_inline.h          |  7 +++++
  include/linux/userfaultfd_k.h      | 44 +++++++++++++++++++-----------
  mm/memory.c                        |  6 ++--
  5 files changed, 65 insertions(+), 29 deletions(-)

diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 54c6cc7fe9c6..68e5006e5158 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1270,9 +1270,10 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
  	if (uffdio_register.mode & UFFDIO_REGISTER_MODE_MISSING)
  		vm_flags |= VM_UFFD_MISSING;
  	if (uffdio_register.mode & UFFDIO_REGISTER_MODE_WP) {
-#ifndef CONFIG_HAVE_ARCH_USERFAULTFD_WP
-		goto out;
-#endif
+		if (!IS_ENABLED(CONFIG_HAVE_ARCH_USERFAULTFD_WP) ||
+		    !pte_uffd_wp_available())
+			goto out;
+

Same comment as for the other patch: make the CONFIG_HAVE_ARCH_USERFAULTFD_WP part of the pte_uffd_wp_available() check and better call it "pgtable_uffd_wp_" ... available/supported.

--
Cheers

David / dhildenb





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux