]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/userfaultfd: Use uffd_ops to decide if continue is supported
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 28 Oct 2025 16:17:19 +0000 (12:17 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 30 Oct 2025 16:44:56 +0000 (12:44 -0400)
Instead of checking the dst_vma for two types, just check if the
continue pointer is null or not.  This scales for all memory types.

Disable the anonymous continue operation by setting it to NULL in the
default uffd_ops.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
mm/userfaultfd.c

index 04433432340076c130718edf204d8e8b0c2061d9..a7ed8224a9e1da31858b2c7fa029aa5c0aa539fa 100644 (file)
@@ -517,7 +517,7 @@ static ssize_t uffd_def_is_dst_valid(struct vm_area_struct *dst_vma,
 static const struct vm_uffd_ops default_uffd_ops = {
        .copy                   = mfill_atomic_pte_copy,
        .zeropage               = mfill_atomic_pte_zeropage,
-       .cont                   = mfill_atomic_pte_continue,
+       .cont                   = NULL,
        .poison                 = mfill_atomic_pte_poison,
        .is_dst_valid           = uffd_def_is_dst_valid,
        .increment              = mfill_size,
@@ -686,7 +686,7 @@ retry:
                goto out_unlock;
 
        err = -EINVAL;
-       if (!(vma_is_shmem(dst_vma) || is_vm_hugetlb_page(dst_vma)) &&
+       if (!uffd_ops->cont &&
            uffd_flags_mode_is(flags, MFILL_ATOMIC_CONTINUE))
                goto out_unlock;