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] [day] [month] [year] [list]
Message-ID: <59cc7d35b0b1248a96313324fc21c95f3e5d1497.camel@nvidia.com>
Date: Thu, 15 Aug 2024 03:57:37 +0000
From: Jianbo Liu <jianbol@...dia.com>
To: "liuhangbin@...il.com" <liuhangbin@...il.com>
CC: "davem@...emloft.net" <davem@...emloft.net>, Tariq Toukan
	<tariqt@...dia.com>, "andy@...yhouse.net" <andy@...yhouse.net>, Gal Pressman
	<gal@...dia.com>, "jv@...sburgh.net" <jv@...sburgh.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>, "kuba@...nel.org"
	<kuba@...nel.org>, "edumazet@...gle.com" <edumazet@...gle.com>,
	"pabeni@...hat.com" <pabeni@...hat.com>, Saeed Mahameed <saeedm@...dia.com>,
	Leon Romanovsky <leonro@...dia.com>
Subject: Re: [PATCH net V3 1/3] bonding: implement xdo_dev_state_free and call
 it after deletion

On Thu, 2024-08-15 at 11:34 +0800, Hangbin Liu wrote:
> On Thu, Aug 15, 2024 at 01:23:05AM +0000, Jianbo Liu wrote:
> > On Wed, 2024-08-14 at 11:11 +0800, Hangbin Liu wrote:
> > > On Wed, Aug 14, 2024 at 02:03:58AM +0000, Jianbo Liu wrote:
> > > > On Tue, 2024-08-13 at 07:14 -0700, Jakub Kicinski wrote:
> > > > > On Tue, 13 Aug 2024 02:58:12 +0000 Jianbo Liu wrote:
> > > > > > > > +       rcu_read_lock();
> > > > > > > > +       bond = netdev_priv(bond_dev);
> > > > > > > > +       slave = rcu_dereference(bond-
> > > > > > > > >curr_active_slave);
> > > > > > > > +       real_dev = slave ? slave->dev : NULL;
> > > > > > > > +       rcu_read_unlock();  
> > > > > > > 
> > > > > > > What's holding onto real_dev once you drop the rcu lock
> > > > > > > here?  
> > > > > > 
> > > > > > I think it should be xfrm state (and bond device).
> > > > > 
> > > > > Please explain it in the commit message in more certain
> > > > > terms.
> > > > 
> > > > Sorry, I don't understand. The real_dev is saved in xs-
> > > > > xso.real_dev,
> > > > and also bond's slave. It's straightforward. What else do I
> > > > need to
> > > > explain?
> > > 
> > > I think Jakub means you need to make sure the real_dev is not
> > > freed
> > > during
> > > xfrmdev_ops. See bond_ipsec_add_sa(). You unlock it too early and
> > > later
> > > xfrmdev_ops is not protected.
> > 
> > This RCU lock is to protect the reading of curr_active_slave, which
> > is
> > pointing to a big stuct - slave struct, so there is no error to get
> > real_dev from slave->dev.
> 
> It's not about getting real_dev from slave->dev. As Jakub said,
> What's holding
> on real_dev once you drop the rcu lock?
> 

As you mentioned the lock, I explained what's it used for, so we will
not mix basic concepts and make things complicated. 
As for Jakub's question, I already answered. And I'm waiting for his
reply so I can better undestand how to modify if there is any. 

Thanks!
Jianbo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ