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]
Message-ID: <8931808d-db61-0f06-ceb3-f48a83b1f74c@redhat.com>
Date:   Thu, 20 Jan 2022 19:00:38 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Nadav Amit <nadav.amit@...il.com>
Cc:     "zhangliang (AG)" <zhangliang5@...wei.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        wangzhigang17@...wei.com, Matthew Wilcox <willy@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] mm: reuse the unshared swapcache page in do_wp_page

On 20.01.22 18:48, Nadav Amit wrote:
> 
>> On Jan 20, 2022, at 6:15 AM, David Hildenbrand <david@...hat.com> wrote:
>>
>> On 17.01.22 14:31, zhangliang (AG) wrote:
>>> Sure, I will do that :)
>>
>> I'm polishing up / testing the patches and might send something out for discussion shortly.
>> Just a note that on my branch was a version with a wrong condition that should have been fixed now.
>>
> 
> Sorry for being late for the discussion.
> 
> David, does any of it regards the lru_cache_add() reference issue that I
> mentioned? [1]

No, unfortunately not in that part of my work. *Maybe* we could also try
to handle that reference similarly to the swapcache, but the question is
if we can't wait for PageAnonExclusive.

Right now I have the following in mind to get most parts working as
exptected:

1. Optimize reuse logic for the swapcache as it seems to be easy
2. Streamline COW logic and remove reuse_swap_page() -- fix the CVE for
   THP.
3. Introduce PageAnonExclusive and allow FOLL_PIN only on
   PageAnonExclusive pages.
4. Convert O_DIRECT to FOLL_PIN

We will never ever have to copy a page PageAnonExclusive page in the COW
handler and can immediately reuse it without even locking the page. The
existing reuse logic is essentially then used to reset PageAnonExclusive
on a page (thus it makes sense to work on it) where the flag is not set
anymore -- or on a fresh page if we have to copy.

That implies that all these additional references won't care if your app
doesn't fork() or KSM isn't active. Consequently, anything that
read-protects anonymous pages will work as expected and should be as
fast as it gets.

Sounds good? At least to me. If only swap/migration entries wouldn't be
harder to handle than I'd wish, that's why it's taking a little and will
take a little longer.

> 
> Seems to me that any solution should also regard this problem, or am I
> missing something?

The bigger picture has to handle it, yes!

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ