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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wit7LDr0tA2eVn7yHHEH76oK=Lfm3tTs8_JxO8XEED4_g@mail.gmail.com>
Date:   Tue, 11 Aug 2020 13:06:04 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Peter Xu <peterx@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>
Cc:     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>,
        "Maya B . Gokhale" <gokhale2@...l.gov>,
        Jann Horn <jannh@...gle.com>, Christoph Hellwig <hch@....de>,
        Oleg Nesterov <oleg@...hat.com>,
        Kirill Shutemov <kirill@...temov.name>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH v3] mm/gup: Allow real explicit breaking of COW

;

On Tue, Aug 11, 2020 at 12:24 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> Now I wonder if there's any other case of FOLL_WRITE that is missing.

Actually, now I wonder if we really should have tried to handle the
wrong-way cow reuse case some other way entirely.

When discussing this wrong-way-COW issue originally I looked at just doing

        struct page *page = vmf->page;

        if (page_count(page) != 1)
                goto copy;
        if (!trylock_page(page))
                goto copy;
        if (page_mapcount(page) != 1 && page_count(page) != 1) {
                unlock_page(page);
                goto copy;
        }
        /* Ok, we've got the only map reference, and the only
         *  page count reference, and the page is locked,
         * it's dark out, and we're wearing sunglasses. Hit it.
         */
        wp_page_reuse(vmf);
        unlock_page(page);
        return VM_FAULT_WRITE

at the top of the PageAnon() case in do_wp_page(), and be entirely done with it.

Make the rule be that we *only* re-use the page if there is no
question what-so-ever that we're the only possible owner of it.
Anything else at all - whether they be GUP users, other processes,
KSM, hughepage collapsing, whatever: don't even try.

That would possibly cause a lot of extra copies, but our rules for
"can we re-use this page" are just crazy complicated. And now the
"minimal" thing of just always breaking COW ends up causing
complications of its own.

IOW, maybe all of this falls under "yeah, we have historical reasons
for all of it, but it's just not worth the pain".

We do a _lot_ of complex stuff just to check whether we could possibly
share the page.

Maybe trying to reuse the page just isn't worth it?

Adding Andrea to the cc (although he probably sees this through
linux-mm anyway). Maybe he can go "naah, that will be horribly bad,
because..."

Then we could get rid of all the FAULT_FORCE_COW games again entirely,
and people can point fingers at me and laugh behind my back because of
what a bad idea it was.

                    Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ