[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200617180621.GD56208@elver.google.com>
Date: Wed, 17 Jun 2020 20:06:21 +0200
From: Marco Elver <elver@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Mark Rutland <mark.rutland@....com>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Alexander Potapenko <glider@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...hat.com>, ndesaulniers@...gle.com,
Andy Lutomirski <luto@...capital.net>
Subject: Re: [PATCH -tip v3 1/2] kcov: Make runtime functions
noinstr-compatible
On Wed, Jun 17, 2020 at 06:36PM +0200, Peter Zijlstra wrote:
> On Wed, Jun 17, 2020 at 05:55:17PM +0200, Peter Zijlstra wrote:
> > On Wed, Jun 17, 2020 at 05:19:59PM +0200, Marco Elver wrote:
> >
> > > > Does GCC (8, as per the new KASAN thing) have that
> > > > __builtin_memcpy_inline() ?
> > >
> > > No, sadly it doesn't. Only Clang 11. :-/
> > >
> > > But using a call to __memcpy() somehow breaks with Clang+KCSAN. Yet,
> > > it's not the memcpy that BUGs, but once again check_preemption_disabled
> > > (which is noinstr!). Just adding calls anywhere here seems to results in
> > > unpredictable behaviour. Are we running out of stack space?
> >
> > Very likely, bad_iret is running on that entry_stack you found, and as
> > you found, it is puny.
> >
> > Andy wanted to make it a full page a while ago, so I suppose the
> > question is do we do that now?
>
> Andy suggested doing the full page; untested patches here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/entry
Yeah, that works, thanks! I think the stack increase alone fixes any
kind of crash due to the reproducer.
Also, my guess is this is not a hot function, right? One caveat to keep
in mind is that because it's not 'memcpy', the compiler will never
inline these memcpys (unlike before). Whether or not that actually makes
things faster or slower is anyone's guess though.
Thanks,
-- Marco
Powered by blists - more mailing lists