Re: [PATCH RFT 0/3] mm, drm: ensure .fault() does not have to be followed by .pfn_mkwrite() for write faults
From: Paolo Bonzini
Date: Mon Aug 03 2026 - 13:07:08 EST
On 8/3/26 10:55, David Hildenbrand (Arm) wrote:
On 7/31/26 18:05, Paolo Bonzini wrote:
Reported-by: Sergio Lopez <slp@xxxxxxxxxx>
Reported-by: without Fixes: is odd.
Fixes: 6da8e9634bb7 ("mm: new follow_pfnmap API") would also be odd :) but I can certainly add it.
+ * @write_fault: if true, fail with -EFAULT unless the mapping is
Just wondering whether EPERM would be better.
It would be EACCES if anything, not EPERM; but almost all callers already pass EFAULT to userspace, and write() to a PROT_READ area returns EFAULT, so I don't think EACCES is the right choice.
There are no for_write, write_access or check_write in mm/, but there are a handful of each of these+ * 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?
int write = (gup_flags & FOLL_WRITE);
bool write = vmf->flags & FAULT_FLAG_WRITE;
so I'll go for just "write".
Thanks,
Paolo