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: <20100412192441.GB27341@feather>
Date:	Mon, 12 Apr 2010 12:24:42 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	Eric Dumazet <eric.dumazet@...il.com>,
	David Howells <dhowells@...hat.com>,
	linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
	dipankar@...ibm.com, akpm@...ux-foundation.org,
	mathieu.desnoyers@...ymtl.ca, dvhltc@...ibm.com, niv@...ibm.com,
	tglx@...utronix.de, peterz@...radead.org, rostedt@...dmis.org,
	Valdis.Kletnieks@...edu
Subject: Re: [PATCH tip/core/urgent 1/4] rcu: add rcu_access_pointer and
 rcu_dereference_protected

On Fri, Apr 09, 2010 at 09:57:35AM -0700, Paul E. McKenney wrote:
> On Fri, Apr 09, 2010 at 11:24:18AM +0200, Eric Dumazet wrote:
> > Le vendredi 09 avril 2010 à 10:10 +0100, David Howells a écrit :
> > > Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
> > > 
> > > > +#define rcu_access_pointer(p) ((void *)ACCESS_ONCE(p))
> > > > ...
> > > > +#define rcu_access_pointer(p)		((void *)ACCESS_ONCE(p))
> > > 
> > > There's no difference between your two versions of rcu_access_pointer(), so
> > > you could move that whole construct outside of the #ifdef'ed section.
> > > 
> > > Other than that:
> > > 
> > > Acked-by: David Howells <dhowells@...hat.com>
> > 
> > I also prefer to keep type checking if possible
> > 
> > #define rcu_access_pointer(p)		(ACCESS_ONCE(p))
> 
> Yikes!  I was obsessing on preventing people from dereferencing the
> pointer, but you are quite right, they might be comparing it to a
> constant pointer to check for array bounds or for use of a statically
> allocated emergency-pool item.

If you want to prevent people from deferencing the pointer directly, or
from assigning it to some other pointer, you could use Sparse's
__attribute__((noderef)) and
__attribute__((address_space(...)).

See the definitions of __user and __iomem in include/linux/compiler.h
for instance.  (And, looking at that file, now __percpu.  Nice!)

You'd then have to explicitly use __force at the point where you
legitimately dereference it.

- Josh Triplett
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ