Re: [PATCH] mm: pull writability check to follow_pfnmap_start()
Paolo Bonzini <[email protected]> Tue, 4 Aug 2026 10:24:35 +0200
| Newsgroups | gmane.comp.emulators.kvm.devel,gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <CABgObfb_FN9r+D2F=GNsADP5xt0syFztmy-x==T85ovZKyopRA@mail.gmail.com> |
On Mon, Aug 3, 2026 at 10:55=E2=80=AFAM David Hildenbrand (Arm) <[email protected]> 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 wil= l 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