From: Josh Poimboeuf <jpoimboe@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Andi Kleen <ak@linux.intel.com>, Paul Turner <pjt@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linux-foundation.org>,
Tim Chen <tim.c.chen@linux.intel.com>,
Dave Hansen <dave.hansen@intel.com>,
Kees Cook <keescook@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Andy Lutomirski <luto@amacapital.net>,
Jiri Kosina <jikos@kernel.org>,
gnomes@lxorguk.ukuu.org.uk
Subject: Re: [PATCH 2/3] objtool: Ignore retpoline alternatives
Date: Thu, 11 Jan 2018 11:25:27 -0600 [thread overview]
Message-ID: <20180111172527.oylssqcrzujoaqiv@treble> (raw)
In-Reply-To: <1515689718.22302.378.camel@infradead.org>
On Thu, Jan 11, 2018 at 04:55:18PM +0000, David Woodhouse wrote:
> On Thu, 2018-01-11 at 10:48 -0600, Josh Poimboeuf wrote:
> >
> > The above macro is protected by '#ifdef RETPOLINE', and I seriously
> > doubt 0-day is testing with an unreleased version of GCC. So you
> > shouldn't see a 0-day warning.
>
> It's actually #ifdef CONFIG_RETPOLINE isn't it?
>
> If you enable CONFIG_RETPOLINE but don't have a new compiler, you still
> get all the asm thunks (which are the easy-to-attack targets). Only if
> you have a new compiler is RETPOLINE also set.
#if defined(CONFIG_X86_64) && defined(RETPOLINE)
#define ANNOTATE_NOSPEC_ALTERNATIVE \
".Lannotate_%=:\n\t" \
".pushsection .discard.nospec\n\t" \
".long .Lannotate_%= - .\n\t" \
".popsection\n\t"
/*
* Since the inline asm uses the %V modifier which is only in newer GCC,
* the 64-bit one is dependent on RETPOLINE not CONFIG_RETPOLINE.
*/
# define CALL_NOSPEC \
...
> Also, the RSB stuffing we're looking at here is also needed for the
> IBRS-based mitigation, so won't even be under CONFIG_RETPOLINE by the
> time the IBRS patch set is beaten into shape on top. It'll probably be
> unconditional unless we get a CONFIG_IBRS_SUPPORT (which hasn't been
> suggested so far).
True. Maybe try changing the above to CONFIG_RETPOLINE and see if 0-day
complains.
> > I think I heard that retpolines won't be ported to anything older than
> > GCC 4.9, so maybe it's safe to use '%='. I don't remember when it was
> > introduced into GCC though.
>
> Hm. Peter? This is all your fault, right? Did you know you were making
> us ditch compatibility for older GCC?
>
> Precisely when *did* %= get added to GCC?
I'm still scratching my head about this one. From what I can tell, even
4.4 has it. I can't find any notes or old 0-day warnings which would
tell me, but I remember running into the problem multiple times, so I'm
pretty sure I'm not hallucinating.
> Note that we can also just resort to using .macro even from inline asm.
> It just takes a rather icky asm(".include ..."). :)
Ew :-)
--
Josh
next prev parent reply other threads:[~2018-01-11 17:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 1:48 [PATCH 0/3] objtool: retpoline compatibility Josh Poimboeuf
2018-01-11 1:48 ` [PATCH 1/3] objtool: Detect jumps to retpoline thunks Josh Poimboeuf
2018-01-11 1:48 ` [PATCH 2/3] objtool: Ignore retpoline alternatives Josh Poimboeuf
2018-01-11 16:27 ` David Woodhouse
2018-01-11 16:33 ` Josh Poimboeuf
2018-01-11 16:39 ` David Woodhouse
2018-01-11 16:48 ` Josh Poimboeuf
2018-01-11 16:55 ` David Woodhouse
2018-01-11 17:25 ` Josh Poimboeuf [this message]
2018-01-11 16:58 ` Peter Zijlstra
2018-01-11 17:05 ` Jiri Kosina
2018-01-11 17:01 ` Jiri Kosina
2018-01-11 17:05 ` Peter Zijlstra
2018-01-11 17:19 ` David Woodhouse
2018-01-11 17:23 ` Peter Zijlstra
2018-01-11 16:44 ` Peter Zijlstra
2018-01-11 17:29 ` Linus Torvalds
2018-01-11 17:37 ` Josh Poimboeuf
2018-01-11 17:43 ` David Woodhouse
2018-01-11 17:56 ` Peter Zijlstra
2018-01-12 20:36 ` Ingo Molnar
2018-01-11 17:57 ` David Woodhouse
2018-01-11 1:48 ` [PATCH 3/3] Revert "x86/retpoline: Temporarily disable objtool when CONFIG_RETPOLINE=y" Josh Poimboeuf
2018-01-11 10:22 ` [PATCH 0/3] objtool: retpoline compatibility David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180111172527.oylssqcrzujoaqiv@treble \
--to=jpoimboe@redhat.com \
--cc=ak@linux.intel.com \
--cc=dave.hansen@intel.com \
--cc=dwmw2@infradead.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linux-foundation.org \
--cc=jikos@kernel.org \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®