Messages in this thread | | | From | Linus Torvalds <> | Date | Tue, 11 Aug 2020 08:05:22 -0700 | Subject | Re: [PATCH v2] mm/gup: Allow real explicit breaking of COW |
| |
On Mon, Aug 10, 2020 at 4:39 PM Jann Horn <jannh@google.com> wrote: > > The way I understand Peter, he doesn't want to avoid doing COW; he > wants to decouple userfaultfd-WP's fault handling from COW, so that > userfaultfd-wp notifies only when a previously-write-protected page is > actually written to. In other words, he wants the COW to basically > happen as it happens now, but it should only create a readonly PTE; > and if someone later triggers a real write fault, the fault handling > path would run again, and this time userfaultfd-wp would be notified > before that readonly PTE is turned into a writable one.
Ahh.
A light goes on.
Thank you.
And apologies to Peter - I misread that patch entirely.
That said, now that I (finally) understand what Peter wants to do, I don't think the patch does what you say.
Because the GUP will now indeed avoid userfaultfd-wp unless it's _actually_ a write, but then any reads will cause a COW that turns things writable. There is no second fault.
So now later writes will never cause any userfaultfd-wp notifications at all.
Which for all I know might be acceptable and ok, but it seems to be against userfaultfd rules, and against the whole synchronization idea.
So I think the patch is broken, but I'm less fundamentally concerned about it.
Because at that point, it's "only" userfaultfd that might break.
Linus
| |