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]
Date:   Thu, 8 Aug 2019 13:09:20 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Michal Hocko <mhocko@...nel.org>,
        John Hubbard <jhubbard@...dia.com>
Cc:     john.hubbard@...il.com, Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Hellwig <hch@...radead.org>,
        Ira Weiny <ira.weiny@...el.com>, Jan Kara <jack@...e.cz>,
        Jason Gunthorpe <jgg@...pe.ca>,
        Jerome Glisse <jglisse@...hat.com>,
        LKML <linux-kernel@...r.kernel.org>, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org,
        Dan Williams <dan.j.williams@...el.com>,
        Daniel Black <daniel@...ux.ibm.com>,
        Matthew Wilcox <willy@...radead.org>,
        Mike Kravetz <mike.kravetz@...cle.com>
Subject: Re: [PATCH 1/3] mm/mlock.c: convert put_page() to put_user_page*()

On 8/8/19 8:21 AM, Michal Hocko wrote:
> On Wed 07-08-19 16:32:08, John Hubbard wrote:
>> On 8/7/19 4:01 AM, Michal Hocko wrote:
>>> On Mon 05-08-19 15:20:17, john.hubbard@...il.com wrote:
>>>> From: John Hubbard <jhubbard@...dia.com>
>>>>
>>>> For pages that were retained via get_user_pages*(), release those pages
>>>> via the new put_user_page*() routines, instead of via put_page() or
>>>> release_pages().
>>>
>>> Hmm, this is an interesting code path. There seems to be a mix of pages
>>> in the game. We get one page via follow_page_mask but then other pages
>>> in the range are filled by __munlock_pagevec_fill and that does a direct
>>> pte walk. Is using put_user_page correct in this case? Could you explain
>>> why in the changelog?
>>>
>>
>> Actually, I think follow_page_mask() gets all the pages, right? And the
>> get_page() in __munlock_pagevec_fill() is there to allow a pagevec_release() 
>> later.
> 
> Maybe I am misreading the code (looking at Linus tree) but munlock_vma_pages_range
> calls follow_page for the start address and then if not THP tries to
> fill up the pagevec with few more pages (up to end), do the shortcut
> via manual pte walk as an optimization and use generic get_page there.

That's true. However, I'm not sure munlocking is where the
put_user_page() machinery is intended to be used anyway? These are
short-term pins for struct page manipulation, not e.g. dirtying of page
contents. Reading commit fc1d8e7cca2d I don't think this case falls
within the reasoning there. Perhaps not all GUP users should be
converted to the planned separate GUP tracking, and instead we should
have a GUP/follow_page_mask() variant that keeps using get_page/put_page?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ