Re: [PATCH v2 07/15] userfaultfd: introduce vm_uffd_ops

From: Mike Rapoport

Date: Wed Mar 11 2026 - 14:49:21 EST


On Fri, Mar 06, 2026 at 07:18:07PM +0200, Mike Rapoport wrote:
> bool vma_can_userfault(struct vm_area_struct *vma, vm_flags_t vm_flags,
> bool wp_async)
> {
> - vm_flags &= __VM_UFFD_FLAGS;
> + const struct vm_uffd_ops *ops = vma_uffd_ops(vma);
>
> - if (vma->vm_flags & VM_DROPPABLE)
> + /* only VMAs that implement vm_uffd_ops are supported */
> + if (!ops)
> return false;

Just found out that rejecting a VMA that does not have uffd_ops but was
registered in WP-only mode with WP_ASYNC uffd context breaks
pagemap_ioctl() test and more broadly it breaks tracking of writes in SysV
shared memory areas.

This is weird that it's possible to use uffd with SysV SHM, but it's out
there for some time and I afraid we can't change that :/

Andrew, can you apply this as a fixup please