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]
Date:   Sat, 25 Jun 2022 11:17:26 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Zach O'Keefe <zokeefe@...gle.com>
CC:     "Kirill A. Shutemov" <kirill@...temov.name>,
        <akpm@...ux-foundation.org>, <shy828301@...il.com>,
        <willy@...radead.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 02/16] mm/huge_memory: access vm_page_prot with READ_ONCE
 in remove_migration_pmd

On 2022/6/25 2:40, Zach O'Keefe wrote:
> On 23 Jun 20:03, Miaohe Lin wrote:
>> On 2022/6/23 11:14, Kirill A. Shutemov wrote:
>>> On Thu, Jun 23, 2022 at 01:06:13AM +0800, Miaohe Lin wrote:
>>>> vma->vm_page_prot is read lockless from the rmap_walk, it may be updated
>>>> concurrently. Using READ_ONCE to prevent the risk of reading intermediate
>>>> values.
>>>
>>> Have you checked all other vm_page_prot reads that they hold mmap_lock?
>>
>> I took a glance when I made this patch.
>>
>>>
>>> I think the right fix would be to provide a helper to read vm_page_prot
>>> which does READ_ONCE() and use it everywhere. This seems more sustainable.
>>>
>>
>> This patch is inspired from the below commit
>>   6d2329f8872f ("mm: vm_page_prot: update with WRITE_ONCE/READ_ONCE")
>>
>> It changed all the places that need to use READ_ONCE. But remove_migration_pmd
>> is missed due to it's introduced later. It looks fine to add a helper to read
>> vm_page_prot which does READ_ONCE() but READ_ONCE is unneeded while under the
>> mmap_lock, so might it be a little overkill to add a helper because the helper
>> is used iff mmap_lock is not held?
>>
>> Thanks.
> 
> IMO adding the READ_ONCE() as proposed in fine. Adding a helper to be called
> dependent on locking context still requires the caller / dev to know what the
> locking context is - so I don't think it provides much benefit.

I tend to agree with Zach. Thanks!

> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ