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: <20140114045316.GV10038@linux.vnet.ibm.com>
Date:	Mon, 13 Jan 2014 20:53:16 -0800
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	Cong Wang <cwang@...pensource.com>,
	Tom Herbert <therbert@...gle.com>,
	netdev <netdev@...r.kernel.org>
Subject: Re: suspicious RCU usage in net/ipv4/ip_tunnel.c:80

On Mon, Jan 13, 2014 at 12:20:33AM -0800, Eric Dumazet wrote:
> On Sun, 2014-01-12 at 22:36 -0800, Cong Wang wrote:
> > > Please read rcu_dereference_protected() documentation in
> > > include/linux/rcupdate.h
> > 
> > I did before I replied.
> 
> 
> 
> > 
> > >
> > > Also you can run sparse, with CONFIG_SPARSE_RCU_POINTER=y in
> > > your .config
> > >
> > > make C=2 net/ipv4/ip_tunnel.o
> > >
> > > And then you'll know the answer to this question.
> > >
> > 
> > Sounds like it is only to shut up a sparse warning, then its name
> > is misleading, we clearly don't dereference it here.

OK, I'll bite...  This code invokes dst_release() which looks to me
like it dereferences this pointer:

void dst_release(struct dst_entry *dst)
{
	if (dst) {
		int newrefcnt;

		newrefcnt = atomic_dec_return(&dst->__refcnt);
		WARN_ON(newrefcnt < 0);
		if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) {
			dst = dst_destroy(dst);
			if (dst)
				__dst_free(dst);
		}
	}
}

If you really were not dereferencing the pointer, for example, if you
were only testing it against NULL or some such, then you can use
rcu_access_pointer().  This is a bit cheaper on DEC Alpha, FWIW.

You can think of rcu_dereference() as meaning "fetch this RCU-protected
pointer with intent to dereference()" if that helps.

Or am I missing your point?

> Historical reasons, you should have been there when Paul invented the
> name and lazy people like us let him do so !
> 
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b62730baea32f86fe91a7930e4b7ee8d82778b79

Indeed!  ;-)

And rcu_dereference() is at least an improvement over the earlier
hand-placed smp_read_barrier_depends().

							Thanx, Paul

> You are lucky, there is plenty of documentation, maybe too much..
> 
> 
> 
> --
> 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
> 

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