[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNORDOZxpk8=dRNu86V5YcJeinAq0K=8PZs39HXDLwNNJw@mail.gmail.com>
Date: Thu, 21 May 2020 15:39:38 +0200
From: Marco Elver <elver@...gle.com>
To: Will Deacon <will@...nel.org>
Cc: "Paul E. McKenney" <paulmck@...nel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH -tip v2 09/11] data_race: Avoid nested statement expression
On Thu, 21 May 2020 at 15:31, Will Deacon <will@...nel.org> wrote:
>
> On Thu, May 21, 2020 at 01:08:52PM +0200, Marco Elver wrote:
> > It appears that compilers have trouble with nested statements
> > expressions, as such make the data_race() macro be only a single
> > statement expression. This will help us avoid potential problems in
> > future as its usage increases.
> >
> > Link: https://lkml.kernel.org/r/20200520221712.GA21166@zn.tnic
> > Signed-off-by: Marco Elver <elver@...gle.com>
> > ---
> > v2:
> > * Add patch to series in response to above linked discussion.
> > ---
> > include/linux/compiler.h | 9 ++++-----
> > 1 file changed, 4 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> > index 7444f026eead..1f9bd9f35368 100644
> > --- a/include/linux/compiler.h
> > +++ b/include/linux/compiler.h
> > @@ -211,12 +211,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
> > */
> > #define data_race(expr) \
> > ({ \
> > + __unqual_scalar_typeof(({ expr; })) __v; \
> > __kcsan_disable_current(); \
> > - ({ \
> > - __unqual_scalar_typeof(({ expr; })) __v = ({ expr; }); \
> > - __kcsan_enable_current(); \
> > - __v; \
> > - }); \
> > + __v = ({ expr; }); \
> > + __kcsan_enable_current(); \
> > + __v; \
>
> Hopefully it doesn't matter, but this will run into issues with 'const'
> non-scalar expressions.
Good point. We could move the kcsan_disable_current() into ({
__kcsan_disable_current(); expr; }).
Will fix for v3.
Thanks,
-- Marco
> Will
>
> --
> You received this message because you are subscribed to the Google Groups "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@...glegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20200521133150.GB6608%40willie-the-truck.
Powered by blists - more mailing lists