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: <1290075978.2781.36.camel@edumazet-laptop>
Date:	Thu, 18 Nov 2010 11:26:18 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Sachin Sant <sachinp@...ibm.com>,
	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, davem@...emloft.net,
	linux-s390@...r.kernel.org, linux-next@...r.kernel.org,
	ursula.braun@...ibm.com, Jay Vosburgh <fubar@...ibm.com>
Subject: [PATCH net-2.6] bonding: fix a race in  IGMP handling

Le jeudi 18 novembre 2010 à 10:43 +0100, Eric Dumazet a écrit :
> Le jeudi 18 novembre 2010 à 10:33 +0100, Eric Dumazet a écrit :
> > 
> > 
> > 
> > Hmm, sorry but this wont work.
> > 
> > > diff -Narup linux-2.6-next/drivers/s390/net/lcs.c linux-2.6-next-new/drivers/s390/net/lcs.c
> > > --- linux-2.6-next/drivers/s390/net/lcs.c	2010-11-17 11:38:25.000000000 +0530
> > > +++ linux-2.6-next-new/drivers/s390/net/lcs.c	2010-11-18 11:59:46.000000000 +0530
> > > @@ -1269,10 +1269,10 @@ lcs_register_mc_addresses(void *data)
> > >  	in4_dev = in_dev_get(card->dev);
> > >  	if (in4_dev == NULL)
> > >  		goto out;
> > > -	read_lock(&in4_dev->mc_list_lock);
> > > +	rcu_read_lock();
> > 
> > If you use rcu_read_lock(), then you also need to 
> > use the rcu list iterators in lcs_remove_mc_addresses() and
> > lcs_set_mc_addresses()
> > 
> > Then, its strange this driver is not protected by RTNL at this stage.
> > 
> > Ah yes, it uses a kthread from its ndo_set_multicast_list() handler.
> > 
> > This seems not safe at all.

Actually this raises an interesting case for bonding as well.

Before my RCU conversion __bond_resend_igmp_join_requests() was unsafe.

For net-next-2.6, it is now safe (RCU is held), but needs a cleanup
patch to avoid sparse errors.

Thanks

[PATCH net-2.6] bonding: fix a race in IGMP handling

RCU conversion in IGMP code done in net-next-2.6 raised a race in
__bond_resend_igmp_join_requests().

It iterates in_dev->mc_list without appropriate protection (RTNL, or
read_lock on in_dev->mc_list_lock).

Another cpu might delete an entry while we use it and trigger a fault.

Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
Cc: Jay Vosburgh <fubar@...ibm.com>
---
 drivers/net/bonding/bond_main.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bdb68a6..71a1697 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -878,8 +878,10 @@ static void __bond_resend_igmp_join_requests(struct net_device *dev)
 	rcu_read_lock();
 	in_dev = __in_dev_get_rcu(dev);
 	if (in_dev) {
+		read_lock(&in_dev->mc_list_lock);
 		for (im = in_dev->mc_list; im; im = im->next)
 			ip_mc_rejoin_group(im);
+		read_unlock(&in_dev->mc_list_lock);
 	}
 
 	rcu_read_unlock();


--
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