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: <3ae3de70-0999-bf76-3da5-b1ef9d6a015a@huawei.com>
Date: Tue, 3 Sep 2024 20:22:17 +0800
From: "Leizhen (ThunderTown)" <thunder.leizhen@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>, Andrew Morton
	<akpm@...ux-foundation.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/5] debugobjects: Fix the misuse of global variables in
 fill_pool()



On 2024/9/3 19:43, Thomas Gleixner wrote:
> On Tue, Sep 03 2024 at 19:14, Leizhen wrote:
>> On 2024/9/3 17:37, Thomas Gleixner wrote:
>>> On Tue, Sep 03 2024 at 15:00, Leizhen wrote:
>>>>>> @@ -84,10 +85,7 @@ static int __data_racy                       debug_objects_fixups __read_mostly;
>>>>>>  static int __data_racy                 debug_objects_warnings __read_mostly;
>>>>>>  static int __data_racy                 debug_objects_enabled __read_mostly
>>>>>>                                         = CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT;
>>>>>> -static int __data_racy                 debug_objects_pool_size __read_mostly
>>>>>> -                                       = ODEBUG_POOL_SIZE;
>>>>>> -static int __data_racy                 debug_objects_pool_min_level __read_mostly
>>>>>> -                                       = ODEBUG_POOL_MIN_LEVEL;
>>>>>> +static int __data_racy                 obj_pool_min_free = ODEBUG_POOL_SIZE;
>>>>
>>>> Sorry, I rechecked it again. After this patch, obj_pool_min_free is referenced in the
>>>> same way as obj_pool_max_used. The only race point is located in debug_stats_show().
>>>> However, this reference point does not need to be included in the race analysis. So
>>>> there is no need to add __data_racy for obj_pool_min_free.
>>>
>>> The read races against the write, so KCSAN can detect it and complain, no?
>>
>> Oh, I just saw that there were a lot of other global variables in that function
>> that didn't mask KCSAN's detection. So I'll recheck each global variable.
>> However, for obj_pool_min_free, it seems that it would be better to just add
>> READ_ONCE() in debug_stats_show(). This does not prevent the compiler from
>> optimizing variable references in the lock.
>>
>> # define __data_racy volatile
> 
> This is only when KCSAN is enabled. Otherwise it's empty.
> 
> And if you do a READ_ONCE() then you need a corresponding WRITE_ONCE()
> to make sense. __data_racy is much simpler for that.

OK, I will use __data_racy, thanks

> 
> Thanks,
> 
>         tglx
> .
> 

-- 
Regards,
  Zhen Lei

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ