Re: [PATCH] mm: pull writability check to follow_pfnmap_start()
From: Paolo Bonzini
Date: Tue Aug 04 2026 - 04:32:19 EST
On Mon, Aug 3, 2026 at 10:55 AM David Hildenbrand (Arm)
<david@xxxxxxxxxx> wrote:
> > index 485df9c2dbdd..34c79b5fcb9b 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -3136,9 +3136,12 @@ struct follow_pfnmap_args {
> > * Inputs:
> > * @vma: Pointer to @vm_area_struct struct
> > * @address: the virtual address to walk
> > + * @write_fault: if true, fail with -EFAULT unless the mapping is
>
> Just wondering whether EPERM would be better.
I considered EACCES, but EFAULT seems more appropriate: it's already
what most callers return, and vm_fault_to_errno() never returns
EACCES.
> > + * writable
> > */
> > struct vm_area_struct *vma;
> > unsigned long address;
> > + bool write_fault;
>
> "write_fault" is a rather odd name for this, given that this function will not
> trigger a write fault.
>
> You want something that matches FOLL_WRITE.
>
> "write_access" / "check_writable" maybe?
Just "write" is what mm/ uses for local variables so I'll use that here too.
Paolo