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: <a8e1da0805200405t10fae448w589449e75a5abec6@mail.gmail.com>
Date:	Tue, 20 May 2008 19:05:21 +0800
From:	"Dave Young" <hidave.darkstar@...il.com>
To:	"Andrew Morton" <akpm@...ux-foundation.org>
Cc:	greg@...ah.com, matthew@....cx, kay.sievers@...y.org,
	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: Re: [PATCH 1/3][-mm] add class_reclassify macro

On Tue, May 20, 2008 at 6:02 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Tue, 20 May 2008 17:55:54 +0800 Dave Young <hidave.darkstar@...il.com> wrote:
>
>> Converting class semaphore to mutex cause lockdep warnings due to
>> class_interface_register/unregister will possible call device_add/del
>
> Shouldn't we just fix that?

Andrew, could you tell more?

>
>> For the class_interface users here add a class_reclassify macro to
>> reclassify the lock class of their struct class.
>>
>> Signed-off-by: Dave Young <hidave.darkstar@...il.com>
>>
>> ---
>> include/linux/device.h |    7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> --- linux/include/linux/device.h      2008-05-19 12:29:54.000000000 +0800
>> +++ linux.new/include/linux/device.h  2008-05-19 14:42:25.000000000 +0800
>> @@ -529,4 +529,11 @@ extern const char *dev_driver_string(str
>>       MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
>>  #define MODULE_ALIAS_CHARDEV_MAJOR(major) \
>>       MODULE_ALIAS("char-major-" __stringify(major) "-*")
>> +
>> +#define class_reclassify(class)                                              \
>> +do {                                                                 \
>> +     static struct lock_class_key    class_key;                      \
>> +     lockdep_set_class_and_name(&(class)->mutex, &class_key,         \
>> +                              (class)->name);                        \
>> +} while (0)
>>  #endif /* _DEVICE_H_ */
>
> I think it would need a lavish comment explaining what it is for, and
> the reasons for its existence.

Yes, will do.

>
> Perhaps this should be a kernel-wide thing in lockdep.h.  But then that
> would invite people to use it, and it looks like a bad thing.

I agree.
There's wellmeant lockdep warnings for some safe code logic every some time.
Yes, this macro violates the lockdep class-based rules, but it can act
as just supplementary. And it could help some users.

>
> device.h does not include lockdep.h, so putting this here assumes that
> callees have already included lockdep.h.  This is the sort of
> assumption which leads to compilation errors.
>
My wrong, thanks.

Regards
dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ