From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226o+uVAxkV7Ce7Eo5RQjD15M8OyU8r2a/5ZlVR9al0tiIGfQtrnQiO50sjaSQrYnCbOSRMk ARC-Seal: i=1; a=rsa-sha256; t=1517248242; cv=none; d=google.com; s=arc-20160816; b=kiTroFHReRvWTwzzAvkIVQ4yMiIQ9Pzg0cBvwPhM+ymKakD6B5HfM/+fECF7ADmS0u S8+QQcIxnD4aCB23RwGp3Pui2tnQE1cpXQeRgkoE6WDnEspDxK6rqZJY+Booa1zRNzlC jnqi51xK1xHeH+7QO3HOLTJaPyCXyjCPVJ8hjl44A1sYEbUzuU6OBCJSEYEOhhuf0eZT vj2EjkdMdSO0O+qG/BmgHibMYfAH4XLO9Qk3VacorTRg1oOa6vsZLnYAvPSvzRLsTNtB 4l/yGokXww/goNN/rKoq/56tgQMv1PBkLST9LuXoxqdKkPETYR1Paj6JQdSowUyWdRY6 0WAQ== 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=h9D+R7OYmVtBFNxpoyHs6RNaJn21QwEtKOkiodmL4Vw=; b=CD91BoxdoQmnmNaapQS1YwAtHQ13/HhvCQ9psUeDwnNtTU9rvO/nduVym9oqlG0Poe dSAeg9JTu1M+XcEpa8ATqeqV1aneChfsibksK9xHpqpXfmZGjzbPfToCSNZCOl7JEMKT DlNuCo0SnPvzkcdWZFpTFXF1DnBLXsy20pj0xXWmq826yFI12h/yqk1ZNJ4WNZ9+6ULS ZCdoctVSK1EFx/wxIz4WF6f2KjfEM3L3Mspqo4ngxLG9/88/KbGwg7OfxTH209bulF2s nU8c/KgAMerEmxBfOAbN9Sib+ScAxhy+OpyKM7qBFbR+w8ybWfyelYoIgovcE3eYE/d0 1pig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Wblab6fj; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=peterz@infradead.org Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=Wblab6fj; spf=pass (google.com: best guess record for domain of peterz@infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=peterz@infradead.org Date: Mon, 29 Jan 2018 18:50:34 +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: <20180129175034.GF2295@hirez.programming.kicks-ass.net> References: <20180123152539.374360046@infradead.org> <20180123152638.453859448@infradead.org> <1516963050.30244.188.camel@infradead.org> <20180129174952.GI2228@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180129174952.GI2228@hirez.programming.kicks-ass.net> 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?1590950093018820343?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Mon, Jan 29, 2018 at 06:49:52PM +0100, Peter Zijlstra wrote: > 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 Clearly I cannot read... > >  /* 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.