[PATCH v5 31/38] mm/uffd: use predicates for userfaultfd checks

Lorenzo Stoakes (ARM) ljs at kernel.org
Tue Oct 13 04:29:16 PDT 2026


On Mon, Oct 12, 2026 at 08:48:04PM +0200, David Hildenbrand (Arm) wrote:
> On 10/9/26 20:04, Lorenzo Stoakes (ARM) wrote:

> > diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> > index 949017e60608..f33b04700838 100644
> > --- a/mm/userfaultfd.c
> > +++ b/mm/userfaultfd.c

> > @@ -2146,10 +2152,11 @@ static bool vma_can_userfault(struct vm_area_struct *vma, vm_flags_t vm_flags,
> >  {
> >  	const struct vm_uffd_ops *ops = vma_uffd_ops(vma);
> >
> > -	if (vma->vm_flags & (VM_DROPPABLE | VM_SHADOW_STACK))
> > +	/* Only mm-backed memory can have its faults handled by userspace. */
> > +	if (!vma_is_mm_backed(vma))
> >  		return false;
>
> Again, for both I would prefer keeping the droppable check separate.

Ack as per discussion on other thread, will separate out for v6!

> Acked-by: David Hildenbrand (Arm) <david at kernel.org>

Thanks!

--
Cheers, Lorenzo



More information about the kvm-riscv mailing list