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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <528B9D72.1090004@gmail.com>
Date:	Tue, 19 Nov 2013 09:18:42 -0800
From:	John Fastabend <john.fastabend@...il.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>
CC:	davem@...emloft.net, John Fastabend <john.r.fastabend@...el.com>,
	netdev@...r.kernel.org, gospo@...hat.com, sassmann@...hat.com,
	Veaceslav Falico <vfalico@...hat.com>
Subject: Re: [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl
 lock held

On 11/19/2013 07:40 AM, Jeff Kirsher wrote:
> From: John Fastabend <john.r.fastabend@...el.com>
>
> It is useful to be able to walk all upper devices when bringing
> a device online where the RTNL lock is held. In this case it
> is safe to walk the all_adj_list because the RTNL lock is used
> to protect the write side as well.
>
> Here we rearrange the netdev_all_upper_get_next_dev_rcu into three
> routines:
>
> 	netdev_all_upper_get_next_dev_rcu()
> 	netdev_all_upper_get_next_dev_rtnl()
> 	netdev_all_upper_get_next_dev()
>
> One for RCU callers, one for RTNL callers and a final routine
> to implement the work. Both the _rcu and _rtnl variants are
> exposed. Where the net/ethernet/intel/ixgbe driver is a consumer
> of the _rtnl variant. netdev_all_upper_get_next_dev() is static.
>
> CC: Veaceslav Falico <vfalico@...hat.com>
> Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@...el.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> ---

[...]

NAK, lockdep_rtnl_is_held() is wrapped in CONFIG_PROVE_LOCKING,

	#ifdef CONFIG_PROVE_LOCKING
	extern int lockdep_rtnl_is_held(void);
	#endif /* #ifdef CONFIG_PROVE_LOCKING */

[...]

> +struct net_device *netdev_all_upper_get_next_dev_rtnl(struct net_device *dev,
> +						      struct list_head **iter)
> +{
> +	WARN_ON_ONCE(!lockdep_rtnl_is_held());

so this can cause a build error without CONFIG_PROVE_LOCKING. I can
either wrap this in a CONFIG_PROVE_LOCKING or do something like this,

  	extern int rtnl_is_locked(void);
  	#ifdef CONFIG_PROVE_LOCKING
  	extern int lockdep_rtnl_is_held(void);
	+#else
	+static inline int lockdep_rtnl_is_held(void)
	+{
	+       return 0;
	+}
	 #endif /* #ifdef CONFIG_PROVE_LOCKING */

The lazy way to do this is to wrap the call  site in rcu_read_{un}lock
but I would prefer not to do that.

> +	return netdev_all_upper_get_next_dev(dev, iter);
> +}

Sorry for the noise I'll spin a new version.

John

-- 
John Fastabend         Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ