From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964918AbeAKQsy (ORCPT + 1 other); Thu, 11 Jan 2018 11:48:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39608 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934718AbeAKQsw (ORCPT ); Thu, 11 Jan 2018 11:48:52 -0500 Date: Thu, 11 Jan 2018 10:48:26 -0600 From: Josh Poimboeuf To: David Woodhouse Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Andi Kleen , Paul Turner , Linus Torvalds , Greg Kroah-Hartman , Tim Chen , Dave Hansen , Kees Cook , Peter Zijlstra , Andy Lutomirski , Jiri Kosina , gnomes@lxorguk.ukuu.org.uk Subject: Re: [PATCH 2/3] objtool: Ignore retpoline alternatives Message-ID: <20180111164826.v26m2vqfqw667zx2@treble> References: <1515688058.22302.366.camel@infradead.org> <20180111163326.deqtbqt72avfweup@treble> <1515688778.22302.372.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1515688778.22302.372.camel@infradead.org> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 11 Jan 2018 16:48:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 11, 2018 at 04:39:38PM +0000, David Woodhouse wrote: > On Thu, 2018-01-11 at 10:33 -0600, Josh Poimboeuf wrote: > > On Thu, Jan 11, 2018 at 04:27:38PM +0000, David Woodhouse wrote: > > > > > > On Wed, 2018-01-10 at 19:48 -0600, Josh Poimboeuf wrote: > > > > > > > > > > > > +#define ANNOTATE_NOSPEC_ALTERNATIVE                            \ > > > > +       "999:\n\t"                                              \ > > > > +       ".pushsection .discard.nospec\n\t"                      \ > > > > +       ".long 999b - .\n\t"                                    \ > > > > +       ".popsection\n\t" > > > > + > > > > > >   Ick, numbers. Use .Lfoo_%= instead. > > > > > I seem to recall that not working with inline asm, maybe old versions of > > GCC don't like it or something?  I can try it and see if 0-day bot > > complains. > > You just need %= (for inline asm) instead of \@ (for .macro). > > I already fixed it up in > http://git.infradead.org/users/dwmw2/linux-retpoline.git/ and will get > nagmail from 0day shortly if it doesn't work :) > > (I love you Fengguang) I found a description from an old commit of mine: 3d1e236022cc ("objtool: Prevent GCC from merging annotate_unreachable()") > A workaround for this issue is to ensure that each instance of the > inline asm statement uses a different label, so that GCC sees the > statements are unique and leaves them alone. The inline asm ‘%=’ token > could be used for that, but unfortunately older versions of GCC don't > support it. So I implemented a poor man's version of it with the > __LINE__ macro. 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. 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. -- Josh