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] [day] [month] [year] [list]
Message-ID: <1e1ce97a-2a0c-d0a4-85ad-cf70a85d9146@huawei.com>
Date:   Fri, 16 Jul 2021 09:53:51 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     John Hubbard <jhubbard@...dia.com>
CC:     Michal Hocko <mhocko@...e.com>, Yu Zhao <yuzhao@...gle.com>,
        <akpm@...ux-foundation.org>, <hannes@...xchg.org>,
        <vbabka@...e.cz>, <axboe@...nel.dk>, <iamjoonsoo.kim@....com>,
        <alexs@...nel.org>, <apopple@...dia.com>, <minchan@...nel.org>,
        <david@...hat.com>, <shli@...com>, <hillf.zj@...baba-inc.com>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH 1/5] mm/vmscan: put the redirtied MADV_FREE pages back to
 anonymous LRU list

On 2021/7/16 8:01, John Hubbard wrote:
> On 7/15/21 4:30 AM, Miaohe Lin wrote:
> ...
>>>>> So, it seems lockless GUP can redirty the MADV_FREE page. But is it ok to just release
>>>>> a redirtied MADV_FREE pages? Because we hold the last reference here and the page will
>>>>> be freed anyway...
>>>>
>>>> I don't see how lockless GUP can redirty the page.  It can grab the
>>>> refcount, thus making the refcount here two.  Then the call to freeze
>>>> here fails and the page stays on the list.  But the lockless GUP checks
>>>> the page is still in the page table (and discovers it isn't, so releases
>>>> the reference count).  Am I missing a path that lets lockless GUP dirty
>>>> the page?
>>>>
>>>
>>> If a device driver pins some pages using gup, and the device then uses dma
>>> to write to those pages, then you could get there. That story is part of the
>>> reasoning that led to creating pin_user_pages(), which btw does not yet
>>> fully solve that case.
>>
>> Many thanks for your explanation.
>> So the similar scenario that is clarified in the __remove_mapping() is possible:
> 
> I probably should have added that the scenario I was describing is broken even
> before any patches that you might apply here. I was just trying to ensure that
> the complete list of scenarios was known.
> 

Many thanks for doing this! :)

> 
> 
> thanks,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ