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: <D2FD5D85-BA6D-492E-801F-E5003452DA70@nutanix.com>
Date:   Mon, 19 Jul 2021 17:23:14 +0000
From:   Tiberiu Georgescu <tiberiu.georgescu@...anix.com>
To:     Peter Xu <peterx@...hat.com>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Nadav Amit <nadav.amit@...il.com>,
        Jerome Glisse <jglisse@...hat.com>,
        "Kirill A . Shutemov" <kirill@...temov.name>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Alistair Popple <apopple@...dia.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Hildenbrand <david@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Matthew Wilcox <willy@...radead.org>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Hugh Dickins <hughd@...gle.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Ivan Teterevkov <ivan.teterevkov@...anix.com>,
        "Carl Waldspurger [C]" <carl.waldspurger@...anix.com>,
        Florian Schmidt <flosch@...anix.com>
Subject: Re: [PATCH v5 24/26] mm/pagemap: Recognize uffd-wp bit for
 shmem/hugetlbfs


> On 19 Jul 2021, at 17:03, Peter Xu <peterx@...hat.com> wrote:
> 
> On Mon, Jul 19, 2021 at 09:53:36AM +0000, Tiberiu Georgescu wrote:
>> 
>> Hello Peter,
> 
> Hi, Tiberiu,
> 
>> 
>>> On 15 Jul 2021, at 21:16, Peter Xu <peterx@...hat.com> wrote:
>>> 
>>> This requires the pagemap code to be able to recognize the newly introduced
>>> swap special pte for uffd-wp, meanwhile the general case for hugetlb that we
>>> recently start to support.  It should make pagemap uffd-wp support complete.
>>> 
>>> Signed-off-by: Peter Xu <peterx@...hat.com>
>>> ---
>>> fs/proc/task_mmu.c | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>> 
>>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>>> index 9c5af77b5290..988e29fa1f00 100644
>>> --- a/fs/proc/task_mmu.c
>>> +++ b/fs/proc/task_mmu.c
>>> @@ -1389,6 +1389,8 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm,
>>> 		flags |= PM_SWAP;
>>> 		if (is_pfn_swap_entry(entry))
>>> 			page = pfn_swap_entry_to_page(entry);
>>> +	} else if (pte_swp_uffd_wp_special(pte)) {
>>> +		flags |= PM_UFFD_WP;
>>> 	}
>> 
>> ^ Would it not be important to also add PM_SWAP to flags?
> 
> Hmm, I'm not sure; it's the same as a none pte in this case, so imho we still
> can't tell if it's swapped out or simply the pte got zapped but page cache will
> still hit (even if being swapped out may be the most possible case).

Yeah, that's true. Come to think of it, we also can't tell none pte from swapped
out shmem pages (all bits are cleared out).

> 
> What we're clear is we know it's uffd wr-protected, so maybe setting PM_UFFD_WP
> is still the simplest?

That's right, but if we were to require any of the differentiations above, how
does keeping another bit on the special pte sound to you? One to signal the location on swap or otherwise (none or zapped).

Is there any other clearer way to do it? We wouldn't want to overload the
special pte unnecessarily.

Thanks,

--
Tibi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ