From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Lendacky Subject: Re: [RFC 09/10] x86/enter: Create macros to restrict/unrestrict Indirect Branch Speculation Date: Tue, 23 Jan 2018 16:37:35 -0600 Message-ID: References: <1516476182-5153-1-git-send-email-karahmed@amazon.de> <1516476182-5153-10-git-send-email-karahmed@amazon.de> <243BE571-AF73-44B3-8D17-193F9E07686A@amacapital.net> <4e01a7a9-29e4-adcc-3f53-550fb7f3d370@amd.com> <1516724457.9521.156.camel@amazon.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: linux-kernel@vger.kernel.org, Andi Kleen , Andrea Arcangeli , Andy Lutomirski , Arjan van de Ven , Ashok Raj , Asit Mallick , Borislav Petkov , Dan Williams , Dave Hansen , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Janakarajan Natarajan , Joerg Roedel , Jun Nakajima , Laura Abbott , Linus Torvalds , Masami Hiramatsu , Paolo Bonzini , Andy Lutomirski , KarimAllah Ahmed Return-path: In-Reply-To: <1516724457.9521.156.camel@amazon.co.uk> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 1/23/2018 10:20 AM, Woodhouse, David wrote: > On Tue, 2018-01-23 at 10:12 -0600, Tom Lendacky wrote: >> >>>> +.macro UNRESTRICT_IB_SPEC >>>> +    ALTERNATIVE "jmp .Lskip_\@", "", X86_FEATURE_IBRS >>>> +    PUSH_MSR_REGS >>>> +    WRMSR_ASM $MSR_IA32_SPEC_CTRL, $0, $0 >>>   >> I think you should be writing 2, not 0, since I'm reasonably >> confident that we want STIBP on.  Can you explain why you're writing >> 0? >> >> Do we want to talk about STIBP in general?  Should it be (yet another) >> boot option to enable or disable?  If there is STIBP support without >> IBRS support, it could be a set and forget at boot time. > > We haven't got patches which enable STIBP in general. The kernel itself > is safe either way with retpoline, or because IBRS implies STIBP too > (that is, there's no difference between writing 1 and 3). > > So STIBP is purely about protecting userspace processes from one > another, and VM guests from one another, when they run on HT siblings. > > There's an argument that there are so many other information leaks > between HT siblings that we might not care. Especially as it's hard to > *tell* when you're scheduling, whether you trust all the processes (or > guests) on your HT siblings right now... let alone later when > scheduling another process if you need to *now* set STIBP on a sibling > which is no longer save from this process now running. > > I'm not sure we want to set STIBP *unconditionally* either because of > the performance implications. > > For IBRS we had an answer and it was just ugly. For STIBP we don't > actually have an answer for "how do we use this?". Do we? Not sure. Maybe to start, the answer might be to allow it to be set for the ultra-paranoid, but in general don't enable it by default. Having it enabled would be an alternative to someone deciding to disable SMT, since that would have even more of a performance impact. Thanks, Tom > >