On 03.03.25 16:01, Peter Xu wrote:
On Sat, Mar 01, 2025 at 10:44:22AM -0500, Mathieu Desnoyers wrote:
Also, I notice that do_wp_page() only calls handle_userfault
VM_UFFD_WP when vm_fault flags does not have FAULT_FLAG_UNSHARE
set.
AFAICT that's expected, unshare should only be set on reads, never writes.
So uffd-wp shouldn't trap any of those.
I'm confused by your comment. I thought unshare only applies to
*write* faults. What am I missing ?
The major path so far to set unshare is here in GUP (ignoring two corner
cases used in either s390 and ksm):
"unshare" fault, in contrast to a write fault, will not turn the PTE
writable.
That's why it does not trigger userfaultfd-wp: there is no write access,
write-protection is left unchanged.
--
Cheers,
David / dhildenb