From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224a1k9vBPpwWXRx+HywLU8WW7Fbg/hdLHLqbFhjTiDihmC1k1Q9AT1sF26ku/oTyVd/sMq8 ARC-Seal: i=1; a=rsa-sha256; t=1517411104; cv=none; d=google.com; s=arc-20160816; b=pYmpsfKi/GZPUN0geH3GQYDSEdVP5761LQwHf8kQP95UYbtqv2l/0FI3pC/4Q4Wv47 bqJ9I4PgtHSfp0UVqYtmabup6p+BT/YXPk/hpUrYwm1my2Wzn8nKh39W82Cid/8P6vZ7 +13ooJsfnFcjzNcIKYjw5fQLnc1Ku8yxNguGPma1TT0lsrdoe1GKWk/1UFU+SJmG7QR6 Bj/mvmedS2dfbd7WJl3e7n/JoETSBmd/Z3S5HaQ79H3K0fi0x0gYQRo1rkPgjjhZMtfM yvYa/OysWvK6MrEPEJWuPoZwTI8Z4TJ4yfmERLDom+LIEJ5iTOG4sgLzgKVV5BPG8M7s iltw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:arc-authentication-results; bh=ZJDEiLj39Wt293bp0OuS2zjDZl9HwYQpysaoclzEj5c=; b=MaDmRvKm3OAB3gl6rq3Jco6pukTEGbC6QtlK6Pg+vzrpk44F3fodraOKCKO2C88hD3 +KMd3IcooapPOBK2Rh5jUXGk7BA00edJKl2S7qQIX9eIF+DJiYB9vAeQMaR9SoYGkDYr 54EtE+xXDJLK5U1H4ZD18CO0OyNFHxL90M9G3L2irKmtNAoyWFbPTc1comiUHePWcSy1 wQniDj61q2jTkNU3oLTIr4YMWL9gKxUDr2MYhYd7DFdX/DBnLY0yfqXIEkeprreE48Jy jHDZLIjyJK0JsvoO3ypz7bdK4jP6SGEAq2SESmC8j8LqOSuxBMgGeGnwnKTXLyZ9Y0j4 DY9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jpoimboe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jpoimboe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Authentication-Results: mx.google.com; spf=pass (google.com: domain of jpoimboe@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=jpoimboe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Date: Wed, 31 Jan 2018 09:04:51 -0600 From: Josh Poimboeuf To: Peter Zijlstra Cc: David Woodhouse , Thomas Gleixner , 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: <20180131150451.5m2pg4u33d72bpbw@treble> References: <20180123152539.374360046@infradead.org> <20180123152638.453859448@infradead.org> <1516963050.30244.188.camel@infradead.org> <20180131092921.GI2269@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180131092921.GI2269@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590397849625954556?= X-GMAIL-MSGID: =?utf-8?q?1591120866162196675?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Wed, Jan 31, 2018 at 10:29:21AM +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: Ont the other hand, is there any harm in doing retpolines in .init.text? I also had a similar question about the ANNOTATE_RETPOLINE_SAFE thing. If there's no harm, it would be simpler and more robust to just do retpolines everywhere and not worry about special cases. (Forgetting paravirt for the moment, which is the eternal "special case".) I was also thinking about adding a debug option for _runtime_ retpoline verification that decodes all kernel text and reports any indirect branches it finds (yes, kind of like an in-kernel objtool). That would be a lot more straightforward without special cases. Obviously .init.text wouldn't be a problem there, but the other annotated safe locations would. -- Josh