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: <7d2eae85-1b13-48c6-8722-e5d139ca316d@blackwall.org>
Date: Sun, 17 Dec 2023 16:19:14 +0200
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: Pedro Tammela <pctammela@...atatu.com>, netdev@...r.kernel.org
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, horms@...nel.org, jiri@...nulli.us, jhs@...atatu.com,
 victor@...atatu.com, martin@...ongswan.org, idosch@...dia.com,
 lucien.xin@...il.com, edwin.peer@...adcom.com, amcohen@...dia.com
Subject: Re: [PATCH net-next 1/2] net: rtnl: introduce
 rcu_replace_pointer_rtnl

On 15/12/2023 19:57, Pedro Tammela wrote:
> From: Jamal Hadi Salim <jhs@...atatu.com>
> 
> Introduce the rcu_replace_pointer_rtnl helper to lockdep check rtnl lock
> rcu replacements, alongside the already existing helpers.
> 
> This is a quality of life helper so instead of using:
>    rcu_replace_pointer(rp, p, lockdep_rtnl_is_held())
>    .. or the open coded..
>    rtnl_dereference() / rcu_assign_pointer()
>    .. or the lazy check version ..
>    rcu_replace_pointer(rp, p, 1)
> Use:
>    rcu_replace_pointer_rtnl(rp, p)
> 
> Signed-off-by: Jamal Hadi Salim <jhs@...atatu.com>
> Signed-off-by: Victor Nogueira <victor@...atatu.com>
> Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
> ---
>  include/linux/rtnetlink.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
> index 6a8543b34e2c..410529fca18b 100644
> --- a/include/linux/rtnetlink.h
> +++ b/include/linux/rtnetlink.h
> @@ -79,6 +79,18 @@ static inline bool lockdep_rtnl_is_held(void)
>  #define rtnl_dereference(p)					\
>  	rcu_dereference_protected(p, lockdep_rtnl_is_held())
>  
> +/**
> + * rcu_replace_pointer_rtnl - replace an RCU pointer under rtnl_lock, returning
> + * its old value
> + * @rp: RCU pointer, whose value is returned
> + * @p: regular pointer
> + *
> + * Perform a replacement under rtnl_lock, where @rp is an RCU-annotated
> + * pointer. The old value of @rp is returned, and @rp is set to @p
> + */
> +#define rcu_replace_pointer_rtnl(rp, p)			\
> +	rcu_replace_pointer(rp, p, lockdep_rtnl_is_held())
> +
>  static inline struct netdev_queue *dev_ingress_queue(struct net_device *dev)
>  {
>  	return rtnl_dereference(dev->ingress_queue);

Reviewed-by: Nikolay Aleksandrov <razor@...ckwall.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ