From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965147AbeAKRZt (ORCPT + 1 other); Thu, 11 Jan 2018 12:25:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53778 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965102AbeAKRZs (ORCPT ); Thu, 11 Jan 2018 12:25:48 -0500 Date: Thu, 11 Jan 2018 11:25:27 -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: <20180111172527.oylssqcrzujoaqiv@treble> References: <1515688058.22302.366.camel@infradead.org> <20180111163326.deqtbqt72avfweup@treble> <1515688778.22302.372.camel@infradead.org> <20180111164826.v26m2vqfqw667zx2@treble> <1515689718.22302.378.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1515689718.22302.378.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.27]); Thu, 11 Jan 2018 17:25:48 +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: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