lkml.org 
[lkml]   [2013]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 tip/core/rcu 01/13] rcu: Make rcu_assign_pointer's assignment volatile and type-safe
On Wed, Oct 09, 2013 at 02:29:34PM -0700, Paul E. McKenney wrote:
> From: Josh Triplett <josh@joshtriplett.org>
>
> rcu_assign_pointer needs to use ACCESS_ONCE to make the assignment to
> the destination pointer volatile, to protect against compilers too
> clever for their own good.
>
> In addition, since rcu_assign_pointer force-casts the source pointer to
> add the __rcu address space (overriding any existing address space), add
> an explicit check that the source pointer has the __kernel address space
> to start with.
>
> This new check produces warnings like this, when attempting to assign
> from a __user pointer:
>
> test.c:25:9: warning: incorrect type in argument 2 (different address spaces)
> test.c:25:9: expected struct foo *<noident>
> test.c:25:9: got struct foo [noderef] <asn:1>*badsrc
>
> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

See my responses to the cover letter; I'd suggest making this the last
patch of the series to avoid introducing and subsequently fixing
warnings.

I'd suggest adding the comment I mentioned in my second response as the
new first patch of the series, since it applies to the old version as
well; thus, the series would first add the comment documenting the
evaluate-once constraint, then add all the calls to rcu_access_pointer,
and finally add this patch introducing the sparse checking.

- Josh Triplett


\
 
 \ /
  Last update: 2013-10-10 00:41    [W:0.179 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site