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: <c5bc3625-48a2-6b8d-b6f4-b3e8c18d11d7@huawei.com>
Date:   Tue, 21 Jun 2022 14:40:49 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     Muchun Song <songmuchun@...edance.com>,
        "Huang, Ying" <ying.huang@...el.com>,
        Qian Cai <quic_qiancai@...cinc.com>
CC:     <akpm@...ux-foundation.org>, <david@...hat.com>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/3] mm/swapfile: fix possible data races of
 inuse_pages

On 2022/6/21 11:39, Muchun Song wrote:
> On Tue, Jun 21, 2022 at 09:14:00AM +0800, Huang, Ying wrote:
>> Qian Cai <quic_qiancai@...cinc.com> writes:
>>
>>> On Mon, Jun 20, 2022 at 10:20:07PM +0800, Muchun Song wrote:
>>>> The lock does not protect the read sides. So the write side should be
>>>> fixed by WRITTE_ONCE().
>>>
>>> https://lwn.net/Articles/816854/
>>>
>>> "Unmarked writes (aligned and up to word size) can be treated as if they had
>>> used WRITE_ONCE() by building with
>>> CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y (also selected by default).
> 
> All right, CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC help us avoid KCSAN
> complaining.
> 
>>> Experience has shown that compilers are much less likely to destructively
>>> optimize in-kernel writes than reads. Some developers might therefore
>>> choose to use READ_ONCE() but omit the corresponding WRITE_ONCE(). Other
>>> developers might prefer the documentation benefits and long-term peace of
>>> mind accruing from explicit use of WRITE_ONCE()..."
>>
>> Thanks for pointing me to this great article.  So although not required
>> by KCSAN strictly, WRITE_ONCE() is still good for documentation, etc.
>> Just like we have done for swap_info_struct->highest_bit, etc.
>>
> 
> +1

I tend to agree with Muchun & Huang, Ying. Thanks all of you.

> 
>> Best Regards,
>> Huang, Ying
>>
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ