[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <172ccfbb-7e24-db21-7d84-8c8d8c3805fd@redhat.com>
Date: Thu, 13 Jan 2022 17:48:49 +0100
From: David Hildenbrand <david@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>
Cc: Liang Zhang <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
Subject: Re: [PATCH] mm: reuse the unshared swapcache page in do_wp_page
On 13.01.22 17:37, Linus Torvalds wrote:
> On Thu, Jan 13, 2022 at 6:39 AM Matthew Wilcox <willy@...radead.org> wrote:
>>
>> Let's bring Linus in on this, but I think this reintroduces all of the
>> mapcount problems that we've been discussing recently.
>>
>> How about this as an alternative?
>
> No, at that point reuse_swap_page() is the better thing to do.
>
> Don't play games with page_count() (or even worse games with
> swap_count). The page count is only stable if it's 1. Any other value
> means that it can fluctuate due to concurrent lookups, some of which
> can be done locklessly under RCU.
I'm pretty sure the patch as is will reintroduce the CVE. So I think in
addition to the reuse_swap_page() check we need more.
I'm wondering if we can get rid of the mapcount checks in
reuse_swap_page() and instead check for page_count() and swapcount only.
We don't care if it's unstable in a sense than it will be bigger than
what we expect. In that case we COW as we would already do.
Thoughts?
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists