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: <cd6cd1c0-f214-defa-74f0-ea53bd57cb9b@huaweicloud.com>
Date:   Sat, 25 Nov 2023 14:50:02 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     Song Liu <song@...nel.org>, Yu Kuai <yukuai1@...weicloud.com>
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        yi.zhang@...wei.com, yangerkun@...wei.com,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH -next v2 1/6] md: remove useless debug code to print
 configuration

Hi,

在 2023/11/25 0:49, Song Liu 写道:
> On Fri, Nov 24, 2023 at 1:12 AM Yu Kuai <yukuai1@...weicloud.com> wrote:
>>
>> Hi,
>>
>> 在 2023/11/24 16:17, Song Liu 写道:
>>> On Fri, Oct 20, 2023 at 7:25 PM Yu Kuai <yukuai1@...weicloud.com> wrote:
>>>>
>>>> From: Yu Kuai <yukuai3@...wei.com>
>>>>
>>>> One the one hand, print_conf() can be called without grabbing
>>>> 'reconfig_mtuex' and current rcu protection to access rdev through 'conf'
>>>> is not safe. Fortunately, there is a separate rcu protection to access
>>>> rdev from 'mddev->disks', and rdev is always removed from 'conf' before
>>>> 'mddev->disks'.
>>>>
>>>> On the other hand, print_conf() is just used for debug,
>>>> and user can always grab such information(/proc/mdstat and mdadm).
>>>>
>>>> There is no need to always enable this debug and try to fix misuse rcu
>>>> protection for accessing rdev from 'conf', hence remove print_conf().
>>>>
>>>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>>>
>>> I wouldn't call these debug functions useless. There is probably some
>>> users who use them for debugging (or even in some automations).
>>> How hard is it to keep these functions? Can we just add some lockdep
>>> to these functions to make sure they are called from safe places?
>>
>> Okay, I can keep these debug code, and since these code are
>> dereferencing rdev from conf, and they need new syncronization:
>>
>> 1) dereference rdev from mddev->disks instead of conf, and use
>> rdev->raid_disk >= 0 to judge if this rdev is in conf. There might
>> be a race window that rdev can be removed from conf, however, I think
>> this dones't matter. Or:
>>
>> 2) grab 'active_io' before print_conf(), to make sure rdev won't be
>> removed from conf.
> 
> I think for most of these cases, we can already do print_conf()
> safely (holding mutex/lock), no? We can grab active_io when it is
> really necessary.

Ok, I'll look into this, and send a v3 if there are no other corner
cases.

Thanks,
Kuai

> 
> Thanks,
> Song
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ