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:   Wed, 16 Mar 2022 09:48:59 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Leon Romanovsky <leon@...nel.org>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, jiri@...dia.com,
        idosch@...dia.com, petrm@...dia.com, simon.horman@...igine.com,
        louis.peens@...igine.com
Subject: Re: [PATCH net-next 1/6] devlink: expose instance locking and add
 locked port registering

On Wed, 16 Mar 2022 10:29:16 +0200 Leon Romanovsky wrote:
> Sorry that I'm asking you again same question.
> How will this devl_lock_is_held() be used in drivers?
> 
> Right now, if I decide to use this function in mlx5 (or in any other driver),
> the code will be something like this:
> 
> void func(...)
> {
>    ....
>    if (IS_ENABLED(CONFIG_LOCKDEP))
>    	if (rcu_dereference_protected(a, devl_lock_is_held(devlink) == b) {
> 		....
> }
> 
> The line "if (IS_ENABLED(CONFIG_LOCKDEP))" needs to be in every driver
> or it won't compile in release mode.

It follows the semantics of lockdep_is_held(), note that
rcu_dereference_protected() makes the last parameter dead 
code with LOCKDEP=n 

#define RCU_LOCKDEP_WARN(c, s) do { } while (0 && (c))

where (c) would be devl_lock_is_held()

so the call to devl_lock_is_held() is eliminated, and we 
won't get a linker error. There's no need for IS_ENABLED().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ