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: <87sgtfwg1m.fsf@notabene.neil.brown.name>
Date:   Thu, 16 May 2019 07:42:29 +1000
From:   NeilBrown <neilb@...e.com>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>, davem@...emloft.net
Cc:     herbert@...dor.apana.org.au, tgraf@...g.ch, netdev@...r.kernel.org,
        oss-drivers@...ronome.com,
        Jakub Kicinski <jakub.kicinski@...ronome.com>,
        Simon Horman <simon.horman@...ronome.com>
Subject: Re: [PATCH net] rhashtable: fix sparse RCU warnings on bit lock in bucket pointer

On Wed, May 15 2019, Jakub Kicinski wrote:

> Since the bit_spin_lock() operations don't actually dereference
> the pointer, it's fine to forcefully drop the RCU annotation.
> This fixes 7 sparse warnings per include site.
>
> Fixes: 8f0db018006a ("rhashtable: use bit_spin_locks to protect hash bucket.")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> Reviewed-by: Simon Horman <simon.horman@...ronome.com>

Hi, sorry for not responding to your initial post, but I'm otherwise
engaged this week and cannot give it any real time.  I don't object to
this patch, but I'll try to have a proper look next week, if only to
find out how I didn't get the warnings, as I was testing with sparse.

Thanks,
NeilBrown


> ---
>  include/linux/rhashtable.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
> index f7714d3b46bd..bea1e0440ab4 100644
> --- a/include/linux/rhashtable.h
> +++ b/include/linux/rhashtable.h
> @@ -325,27 +325,27 @@ static inline struct rhash_lock_head __rcu **rht_bucket_insert(
>   */
>  
>  static inline void rht_lock(struct bucket_table *tbl,
> -			    struct rhash_lock_head **bkt)
> +			    struct rhash_lock_head __rcu **bkt)
>  {
>  	local_bh_disable();
> -	bit_spin_lock(0, (unsigned long *)bkt);
> +	bit_spin_lock(0, (unsigned long __force *)bkt);
>  	lock_map_acquire(&tbl->dep_map);
>  }
>  
>  static inline void rht_lock_nested(struct bucket_table *tbl,
> -				   struct rhash_lock_head **bucket,
> +				   struct rhash_lock_head __rcu **bkt,
>  				   unsigned int subclass)
>  {
>  	local_bh_disable();
> -	bit_spin_lock(0, (unsigned long *)bucket);
> +	bit_spin_lock(0, (unsigned long __force *)bkt);
>  	lock_acquire_exclusive(&tbl->dep_map, subclass, 0, NULL, _THIS_IP_);
>  }
>  
>  static inline void rht_unlock(struct bucket_table *tbl,
> -			      struct rhash_lock_head **bkt)
> +			      struct rhash_lock_head __rcu **bkt)
>  {
>  	lock_map_release(&tbl->dep_map);
> -	bit_spin_unlock(0, (unsigned long *)bkt);
> +	bit_spin_unlock(0, (unsigned long __force *)bkt);
>  	local_bh_enable();
>  }
>  
> -- 
> 2.21.0

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ