From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224tEWlJviK9YGFU4aAZNDhwpPJupdncZ1ZtTmhjNR+nKupP/WFd+RgmPzErT9UUAhsDPB/K ARC-Seal: i=1; a=rsa-sha256; t=1517248207; cv=none; d=google.com; s=arc-20160816; b=IC+1RPOdTLp0EVgNC2IVJ4uenqV6A/4pfGZ81ZQdnvjMqXu/KxeqVLRrc1lKvVRsep UcR6SinnLxgLrgL6hyr4gGV3WghTjgj4sTRPtef5cMvOOpl7LRLfmVXo14DPG2IFfDUb 8R2xQZe+bXaltmjo4P0lC78XhqcLsZXhm6aMSzjdX94pTJzbmOd3A8/Z9kAjD5X+ejdM GBjHO5/g9p101MBVszzQLFS2sbshLIqr3mIgB6R/itB+8WqHyXvMa36QxW4ES02BdYWV XEX1ezXJlRRK48J2FHnEMT2djKN75sGL/HMvN0SYP2yhcPIZ+CC8LSqXxcpDqXwWiDzJ VNfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=oyLr0iFig9qLT0sDWXKaclVmPQuPwyR5VDDtGakNmno=; b=w4kbItmpuWMj70ebrRoHS+xceSu+zlOHP8gbscEjXW9dx3X0N4IBc9hFvSFSWrK5yz mEqKa7GDlvMTixNHf8NocluS0uAIM9g7vGhCGqbiym2BdvjnFrCq7S+YAn4qo5VacFrW MOuucWww/yYx6JDGF9cu95o2OifFrcOCJ+IUrlwKpOZ7wbGTDZ89oWQCQz3wFH20AFas riwut70KmUJ3GkKD2x5DnmrAsh9HSAjtT0z3o6f/oc52D/rY/alThsT6CjOZTltJbMaO xKYugE1THKOTsAZGi9dWs6pqrET8yMSK6JZpBzZzlmVBvgnM8+DI9oFORvPnZOMiA5DF cybQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=YQNfA4bg; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 205.233.59.134 as permitted sender) smtp.mailfrom=peterz@infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=YQNfA4bg; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 205.233.59.134 as permitted sender) smtp.mailfrom=peterz@infradead.org Date: Mon, 29 Jan 2018 18:49:52 +0100 From: Peter Zijlstra To: David Woodhouse Cc: Thomas Gleixner , Josh Poimboeuf , linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick , Jason Baron , Tom Lendacky , Borislav Petkov Subject: Re: [PATCH 08/24] x86,sme: Annotate indirect call Message-ID: <20180129174952.GI2228@hirez.programming.kicks-ass.net> References: <20180123152539.374360046@infradead.org> <20180123152638.453859448@infradead.org> <1516963050.30244.188.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1516963050.30244.188.camel@infradead.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590397849625954556?= X-GMAIL-MSGID: =?utf-8?q?1590950056569173244?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Fri, Jan 26, 2018 at 10:37:30AM +0000, David Woodhouse wrote: > On Tue, 2018-01-23 at 16:25 +0100, Peter Zijlstra wrote: > > This is boot code, we run this _way_ before userspace comes along to > > poison our branch predictor. > > Hm, objtool knows about sections, doesn't it? Why it is whining about > indirect jumps in inittext anyway? > > In fact, why are we even *doing* retpolines in inittext? Not that we > are; since we flipped the ALTERNATIVE logic around, at that point we > still have the 'oldinstr' which is a bare jmp anyway. We might as well > do this: > > --- a/include/linux/init.h > +++ b/include/linux/init.h > @@ -37,10 +37,15 @@ >   * as gcc otherwise puts the data into the bss section and not into the init >   * section. >   */ > +#if defined(RETPOLINE) && !defined(MODULE) > +#define __noretpoline __attribute__((indirect_branch("keep"))) > +#else > +#define __noretpoline > +#endif >   >  /* These are for everybody (although not all archs will actually >     discard it in modules) */ > -#define __init         __section(.init.text) __cold __inittrace __latent_entropy > +#define __init         __section(.init.text) __cold __inittrace __latent_entropy __noretpoline We run module __init text concurrently with userspace.