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: <20120605112728.GB27795@secunet.com>
Date:	Tue, 5 Jun 2012 13:27:28 +0200
From:	Steffen Klassert <steffen.klassert@...unet.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Gao feng <gaofeng@...fujitsu.com>, serge.hallyn@...onical.com,
	ebiederm@...ssion.com, herbert@...dor.apana.org.au,
	davem@...emloft.net, netdev@...r.kernel.org,
	containers@...ts.linux-foundation.org
Subject: Re: [PATCH net-next v2 1/2] inetpeer: add namespace support for
 inetpeer

On Tue, Jun 05, 2012 at 10:57:06AM +0200, Eric Dumazet wrote:
> On Tue, 2012-06-05 at 15:52 +0800, Gao feng wrote:
> 
> > +static void __net_exit inetpeer_net_exit(struct net *net)
> > +{
> > +	inetpeer_invalidate_tree(net, AF_INET);
> > +	kfree(net->ipv4.peers);
> > +
> > +	inetpeer_invalidate_tree(net, AF_INET6);
> > +	kfree(net->ipv6.peers);
> > +}
> > +
> 
> Are we 1000% sure no code ever run in inetpeer land after this call ?
> 
> I would add
> 	net->ipv4.peers = NULL;
> 	net->ipv6.peers = NULL;
> 
> to catch NULL deref instead of strange errors, just in case.

I thought about that too, and I'm not absolutely sure.
The rest of this patch looks ok to me.

> 
> By the way, I think we have a bug in inetpeer_gc_worker()
> 
> Steffen ?
> 
> We have no rcu grace period to make sure the following is safe :
> 
> if (!atomic_read(&p->refcnt)) {
> 	list_del(&p->gc_list);
> 	kmem_cache_free(peer_cachep, p);
> }

I think this is ok as it is. inetpeer_invalidate_tree()
unlinks the whole inetpeer tree from the inetpeer base and
adds it to a gc_list. These intetpeer entries are stale,
they can't be looked up again. So noone should increment the
refcount, they just wait until the refcount get zero.

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