[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180129173020.hm3fbgcwn6ioso4k@treble>
Date: Mon, 29 Jan 2018 11:30:20 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: David Woodhouse <dwmw2@...radead.org>,
Andi Kleen <ak@...ux.intel.com>, Paul Turner <pjt@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...ux-foundation.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Dave Hansen <dave.hansen@...el.com>, tglx@...utronix.de,
Kees Cook <keescook@...gle.com>,
Rik van Riel <riel@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andy Lutomirski <luto@...capital.net>,
Jiri Kosina <jikos@...nel.org>, gnomes@...rguk.ukuu.org.uk,
x86@...nel.org, thomas.lendacky@....com
Subject: Re: [v8,02/12] objtool: Allow alternatives to be ignored
On Mon, Jan 29, 2018 at 09:15:26AM -0800, Guenter Roeck wrote:
> On Sun, Jan 28, 2018 at 03:06:42PM -0600, Josh Poimboeuf wrote:
> > On Mon, Jan 22, 2018 at 12:25:22PM -0800, Guenter Roeck wrote:
> > > Hi David,
> > >
> > > On Mon, Jan 22, 2018 at 07:34:04PM +0000, David Woodhouse wrote:
> > > > On Thu, 2018-01-18 at 11:41 -0800, Guenter Roeck wrote:
> > > > >
> > > > > > Not sure, does your gcc have retpolines? Give me your .o file and I can
> > > > > > diagnose it.
> > > > > >
> > > > > Yes, it does, only it is the gcc from the Google toolchain which may
> > > > > generate different code than the upstream version.
> > > > >
> > > > > I attached an affected object file. Please let me know if there is anything else
> > > > > I can do to help.
> > > > Disassembly of section .text.__x86.indirect_thunk:
> > > >
> > > > 0000000000000000 <__x86.indirect_thunk>:
> > > > 0: e8 04 00 00 00 callq 9 <__x86.indirect_thunk+0x9>
> > > > 5: f3 90 pause
> > > > 7: eb fc jmp 5 <__x86.indirect_thunk+0x5>
> > > > 9: 48 8d 64 24 08 lea 0x8(%rsp),%rsp
> > > > e: c3 retq
> > > >
> > > > That has the old-style CET-incompatible retpoline in a COMDAT section
> > > > in the .o file. What compiler options are being used for that? The
> > > > kernel should only use retpoline if GCC supports both of
> > > > -mindirect-branch=thunk-extern and -mindirect-branch-register, and this
> > > > compiler is doing *neither* of those.
> > >
> > > It uses "-mindirect-branch=thunk -mindirect-branch-loop=pause
> > > -fno-jump-tables", though I don't know if that even exists in
> > > upstream gcc (it is the gcc use for Chrome OS builds). I'll pass
> > > your feedback to our compiler team.
> > >
> > > Either case, I think it is less than optimal that objtool crashes
> > > with _any_ object code.
> >
> > I've got a pending fix for this, so that objtool doesn't seg fault, and
> > instead prints out a warning:
> >
> > quirks.o: warning: objtool: efi_delete_dummy_variable()+0x99: unsupported intra-function call
> > quirks.o: warning: objtool: If this is a retpoline, please patch it in with alternatives and annotate it with ANNOTATE_NOSPEC_ALTERNATIVE.
> >
> > The code is here, along with a few more fixes:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/jpoimboe/linux.git/log/?h=TODO-objtool-seg-fault
> >
>
> 'objtool: Improve retpoline alternative handling' works for me.
Thanks! I'll give you a
Reported-and-tested-by: Guenter Roeck <linux@...ck-us.net>
--
Josh
Powered by blists - more mailing lists