lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Aug 2020 08:05:22 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Jann Horn <jannh@...gle.com>
Cc:     Peter Xu <peterx@...hat.com>, Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Marty Mcfadden <mcfadden8@...l.gov>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Christoph Hellwig <hch@....de>,
        Oleg Nesterov <oleg@...hat.com>,
        Kirill Shutemov <kirill@...temov.name>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH v2] mm/gup: Allow real explicit breaking of COW

On Mon, Aug 10, 2020 at 4:39 PM Jann Horn <jannh@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ