[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131009222656.GC11709@jtriplet-mobl1>
Date: Wed, 9 Oct 2013 15:26:56 -0700
From: Josh Triplett <josh@...htriplett.org>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
laijs@...fujitsu.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
niv@...ibm.com, tglx@...utronix.de, peterz@...radead.org,
rostedt@...dmis.org, dhowells@...hat.com, edumazet@...gle.com,
darren@...art.com, fweisbec@...il.com, sbw@....edu
Subject: Re: [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@...htriplett.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@...htriplett.org>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.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
--
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