Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Borislav Petkov
On Wed, Jan 31, 2018 at 12:44:41PM -0200, Eduardo Habkost wrote: > Also, if anybody don't like it, users can already specify, e.g., > "Broadwell,-hle,-rtm" or "Skylake,+spec_ctrl". > > QEMU only adds have the -noTSX and -IBRS CPU for convenience of > management systems that don't know how to check

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Arjan van de Ven
On 1/31/2018 2:15 AM, Thomas Gleixner wrote: Good luck with making all that work. on the Intel side we're checking what we can do that works and doesn't break things right now; hopefully we just end up with a bit in the arch capabilities MSR for "you should do RSB stuffing" and then the HV's c

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Dr. David Alan Gilbert
* Paolo Bonzini (pbonz...@redhat.com) wrote: > On 29/01/2018 22:13, Andi Kleen wrote: > >> What happens when someone introduces a > >> workaround tied to some other model numbers? > > There are already many of those in the tree for other issues and features. > > So far you managed to survive witho

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Paolo Bonzini
On 29/01/2018 22:13, Andi Kleen wrote: >> What happens when someone introduces a >> workaround tied to some other model numbers? > There are already many of those in the tree for other issues and features. > So far you managed to survive without. Likely that will be true > in the future too. "Gue

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Eduardo Habkost
On Wed, Jan 31, 2018 at 11:15:50AM +0100, Thomas Gleixner wrote: > On Wed, 31 Jan 2018, Christophe de Dinechin wrote: > > > On 30 Jan 2018, at 21:46, Alan Cox wrote: > > > > > >> If you are ever going to migrate to Skylake, I think you should just > > >> always tell the guests that you're running

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Eduardo Habkost
On Wed, Jan 31, 2018 at 02:04:49PM +, Dr. David Alan Gilbert wrote: > * Borislav Petkov (b...@suse.de) wrote: > > On Wed, Jan 31, 2018 at 12:30:36PM +, Dr. David Alan Gilbert wrote: > > > Indeed, it's only for this weird case where you suddenly need to change > > > it. > > > > No, there's

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Dr. David Alan Gilbert
* Borislav Petkov (b...@suse.de) wrote: > On Wed, Jan 31, 2018 at 12:30:36PM +, Dr. David Alan Gilbert wrote: > > Indeed, it's only for this weird case where you suddenly need to change > > it. > > No, there's more: > > .name = "Broadwell-noTSX", > .name = "Haswell-noTSX", Haswel

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Borislav Petkov
On Wed, Jan 31, 2018 at 12:30:36PM +, Dr. David Alan Gilbert wrote: > Indeed, it's only for this weird case where you suddenly need to change > it. No, there's more: .name = "Broadwell-noTSX", .name = "Haswell-noTSX", -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Dr. David Alan Gilbert
* Borislav Petkov (b...@suse.de) wrote: > On Wed, Jan 31, 2018 at 11:04:07AM +, Dr. David Alan Gilbert wrote: > > That half is the easy bit, we've already got that (thanks to Eduardo), > > QEMU has -IBRS variants of CPU types, so if you start a VM with > > -cpu Broadwell-IBRS > > Eww, a CPU mo

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Borislav Petkov
On Wed, Jan 31, 2018 at 11:04:07AM +, Dr. David Alan Gilbert wrote: > That half is the easy bit, we've already got that (thanks to Eduardo), > QEMU has -IBRS variants of CPU types, so if you start a VM with > -cpu Broadwell-IBRS Eww, a CPU model with a specific feature bit. I hope you guys don

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Christophe de Dinechin
> On 31 Jan 2018, at 11:15, Thomas Gleixner wrote: > > On Wed, 31 Jan 2018, Christophe de Dinechin wrote: >>> On 30 Jan 2018, at 21:46, Alan Cox wrote: >>> If you are ever going to migrate to Skylake, I think you should just always tell the guests that you're running on Skylake. Tha

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Dr. David Alan Gilbert
* Thomas Gleixner (t...@linutronix.de) wrote: > On Wed, 31 Jan 2018, Christophe de Dinechin wrote: > > > On 30 Jan 2018, at 21:46, Alan Cox wrote: > > > > > >> If you are ever going to migrate to Skylake, I think you should just > > >> always tell the guests that you're running on Skylake. That w

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Thomas Gleixner
On Wed, 31 Jan 2018, Christophe de Dinechin wrote: > > On 30 Jan 2018, at 21:46, Alan Cox wrote: > > > >> If you are ever going to migrate to Skylake, I think you should just > >> always tell the guests that you're running on Skylake. That way the > >> guests will always assume the worst case sit

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Christophe de Dinechin
> On 30 Jan 2018, at 21:46, Alan Cox wrote: > >> If you are ever going to migrate to Skylake, I think you should just >> always tell the guests that you're running on Skylake. That way the >> guests will always assume the worst case situation wrt Specte. > > Unfortunately if you do that then g

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-31 Thread Christophe de Dinechin
KarimAllah Ahmed writes: > From: David Woodhouse > > Not functional yet; just add the handling for it in the Spectre v2 > mitigation selection, and the X86_FEATURE_IBRS flag which will control > the code to be added in later patches. > > Also take the #ifdef CONFIG_RETPOLINE from around the RSB-

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Alan Cox
> If you are ever going to migrate to Skylake, I think you should just > always tell the guests that you're running on Skylake. That way the > guests will always assume the worst case situation wrt Specte. Unfortunately if you do that then guest may also decide to use other Skylake hardware featur

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Christian Borntraeger
On 01/30/2018 03:56 PM, Christophe de Dinechin wrote: > > >> On 30 Jan 2018, at 15:52, Christian Borntraeger >> wrote: >> >> >> >> On 01/30/2018 03:46 PM, Christophe de Dinechin wrote: >>> >>> On 30 Jan 2018, at 13:11, Christian Borntraeger wrote: On 01/30/2018

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Christophe de Dinechin
> On 30 Jan 2018, at 15:52, Christian Borntraeger > wrote: > > > > On 01/30/2018 03:46 PM, Christophe de Dinechin wrote: >> >> >>> On 30 Jan 2018, at 13:11, Christian Borntraeger >>> wrote: >>> >>> >>> >>> On 01/30/2018 01:23 AM, Linus Torvalds wrote: >>> [...] So I actuall

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Christian Borntraeger
On 01/30/2018 03:46 PM, Christophe de Dinechin wrote: > > >> On 30 Jan 2018, at 13:11, Christian Borntraeger >> wrote: >> >> >> >> On 01/30/2018 01:23 AM, Linus Torvalds wrote: >> [...] >>> >>> So I actually have a _different_ question to the virtualization >>> people. This includes the vmwar

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Christophe de Dinechin
> On 30 Jan 2018, at 13:11, Christian Borntraeger > wrote: > > > > On 01/30/2018 01:23 AM, Linus Torvalds wrote: > [...] >> >> So I actually have a _different_ question to the virtualization >> people. This includes the vmware people, but it also obviously >> incldues the Amazon AWS kind of

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Arjan van de Ven
On 1/29/2018 7:32 PM, Linus Torvalds wrote: On Mon, Jan 29, 2018 at 5:32 PM, Arjan van de Ven wrote: the most simple solution is that we set the internal feature bit in Linux to turn on the "stuff the RSB" workaround is we're on a SKL *or* as a guest in a VM. That sounds reasonable. However

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Christian Borntraeger
On 01/30/2018 01:23 AM, Linus Torvalds wrote: [...] > > So I actually have a _different_ question to the virtualization > people. This includes the vmware people, but it also obviously > incldues the Amazon AWS kind of usage. > > When you're a hypervisor (whether vmware or Amazon), why do you e

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 07:32:06PM -0800, Linus Torvalds wrote: > On Mon, Jan 29, 2018 at 5:32 PM, Arjan van de Ven > wrote: > > > > the most simple solution is that we set the internal feature bit in Linux > > to turn on the "stuff the RSB" workaround is we're on a SKL *or* as a guest > > in a V

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread Dr. David Alan Gilbert
* Linus Torvalds (torva...@linux-foundation.org) wrote: > Why do you even _care_ about the guest, and how it acts wrt Skylake? > What you should care about is not so much the guests (which do their > own thing) but protect guests from each other, no? > > So I'm a bit mystified by some of this dis

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread David Woodhouse
On Mon, 2018-01-29 at 16:23 -0800, Linus Torvalds wrote: > > Note on the unhappiness with some of the patches involved: what I do > *not* want to see is the "on every kernel entry" kind of garbage. > > So my unhappiness with the intel microcode patches is two-fold: > >  (a) the interface is nast

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-30 Thread David Woodhouse
On Mon, 2018-01-29 at 16:23 -0800, Linus Torvalds wrote: >   And the "big hammer" approach to spectre would seem to > be to just make sure the BTB and RSB are flushed at vmexit time - and > even then you might decide that you really want to just move it to > vmenter time, and only do it if the VM h

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Linus Torvalds
On Mon, Jan 29, 2018 at 5:32 PM, Arjan van de Ven wrote: > > the most simple solution is that we set the internal feature bit in Linux > to turn on the "stuff the RSB" workaround is we're on a SKL *or* as a guest > in a VM. That sounds reasonable. However, wouldn't it be even better to extend on

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Andi Kleen
> Right now, we are dealing with one workaround, which is tied to > Skylake-era model numbers. Yes, we could report a Skylake model > number, and Linux guests would use IBRS instead of retpoline. But this Nobody is planning to use IBRS and Linus has rejected it. > approach doesn't scale. What hap

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 02:25:12PM -0800, Andi Kleen wrote: > > I agree with your point that the common hypervisor practice to fake > old model numbers will break some of the workarounds. Hypervisors > may need to revisit their practice. > > > > In general, making these kinds of decisions based o

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Arjan van de Ven
On 1/29/2018 4:23 PM, Linus Torvalds wrote: Why do you even _care_ about the guest, and how it acts wrt Skylake? What you should care about is not so much the guests (which do their own thing) but protect guests from each other, no? the most simple solution is that we set the internal feature

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Tue, Jan 30, 2018 at 01:20:52AM +, David Dunn wrote: > Eduardo, > > This is why it would be good to have a CPUID bit that says: > "apply SkyLake RSB stuffing." That's preferable to "trust FMS" > for VMware. Agreed it would be more useful than "trust FMS". However, I believe a "no need to

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 02:12:02PM -0800, Jim Mattson wrote: > On Mon, Jan 29, 2018 at 1:50 PM, Eduardo Habkost wrote: > > On Mon, Jan 29, 2018 at 01:37:05PM -0800, Jim Mattson wrote: > >> For GCE, "you might be migrated to Skylake" is pretty much a > >> certainty. Even if you're in a zone that do

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread David Dunn
Eduardo, This is why it would be good to have a CPUID bit that says: "apply SkyLake RSB stuffing." That's preferable to "trust FMS" for VMware. If Intel defines such a feature flag, sets it on SkyLake, and Linux uses it... that would be very helpful for VMware. I won't speak for GCE and AWS.

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 05:10:11PM -0500, Konrad Rzeszutek Wilk wrote: [...] > The migration code could be 'tickled' (when arrived at the destination) > to recheck the CPUID and do the alternative logic to turn the > proper bits on. > > And this tickling could be as simple as an ACPI DSDT/AML code

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 02:49:51PM -0800, Jim Mattson wrote: > And if we expect to introduce Cascade Lake into the pool in the > future, we use a Cascade Lake model number? > > It sounds like you are suggesting that we set the model number to the > highest model number that will ever be introduced

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 10:29:28PM +, David Dunn wrote: > On Mon, 2018-01-29 at 13:45:07 -0800, Eduardo Habkost wrote: > > > Maybe a generic "family/model/stepping/microcode really matches > > the CPU you are running on" bit would be useful. The bit could > > be enabled only on host-passthrou

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Jim Mattson
The guest OS is responsible for protecting itself from intra-guest attacks. The hypervisor can't do that. We want to give the guest OS the tools it needs to make reasonable decisions about the intra-guest protections it wants to enable, in an environment where the virtual processor and the physical

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Linus Torvalds
On Mon, Jan 29, 2018 at 1:02 PM, David Woodhouse wrote: > > On Mon, 2018-01-29 at 12:44 -0800, Arjan van de Ven wrote: >> >> the objective is to have retpoline be safe everywhere and never use IBRS >> (Linus was also pretty clear about that) so I'm confused by your question Note on the unhappines

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Fred Jacobs
(Apologies as I was brought into this thread late, but I believe I have context). Could a new "feature" be enumerated on Skylake and beyond which specifies that a particular problem exists which requires different mitigation than on previous processors? Perhaps a CPUID bit enumerating this featur

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Jim Mattson
And if we expect to introduce Cascade Lake into the pool in the future, we use a Cascade Lake model number? It sounds like you are suggesting that we set the model number to the highest model number that will ever be introduced into the pool, at any time in the future. That approach would also fai

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Andi Kleen
> Even if we expose bit to indicate that FMS matches the underlying host, when > does the guest know to query that? The VM can be moved at any point in time, > including after the guest asks if FMS matches host. There's no way to enable these mitigations later, so if you always have to enable t

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread David Dunn
On Mon, 2018-01-29 at 13:45:07 -0800, Eduardo Habkost wrote: > Maybe a generic "family/model/stepping/microcode really matches > the CPU you are running on" bit would be useful. The bit could > be enabled only on host-passthrough (aka "-cpu host") mode. > > If we really want to be able to migrat

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Andi Kleen
I agree with your point that the common hypervisor practice to fake old model numbers will break some of the workarounds. Hypervisors may need to revisit their practice. > > In general, making these kinds of decisions based on F/M/S is probably > > unwise when running in a VM. > > Certainly. Th

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Jim Mattson
On Mon, Jan 29, 2018 at 1:50 PM, Eduardo Habkost wrote: > On Mon, Jan 29, 2018 at 01:37:05PM -0800, Jim Mattson wrote: >> For GCE, "you might be migrated to Skylake" is pretty much a >> certainty. Even if you're in a zone that doesn't currently have >> Skylake machines, chances are pretty good tha

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Konrad Rzeszutek Wilk
On Mon, Jan 29, 2018 at 07:44:21PM -0200, Eduardo Habkost wrote: > On Mon, Jan 29, 2018 at 09:02:39PM +, David Woodhouse wrote: > > > > > > On Mon, 2018-01-29 at 12:44 -0800, Arjan van de Ven wrote: > > > On 1/29/2018 12:42 PM, Eduardo Habkost wrote: > > > > > > > > The question is how the h

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 01:37:05PM -0800, Jim Mattson wrote: > For GCE, "you might be migrated to Skylake" is pretty much a > certainty. Even if you're in a zone that doesn't currently have > Skylake machines, chances are pretty good that it will have Skylake > machines some day in the not-too-dist

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 09:02:39PM +, David Woodhouse wrote: > > > On Mon, 2018-01-29 at 12:44 -0800, Arjan van de Ven wrote: > > On 1/29/2018 12:42 PM, Eduardo Habkost wrote: > > > > > > The question is how the hypervisor could tell that to the guest. > > > If Intel doesn't give us a CPUID

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Andi Kleen
> The question is about all the additional RSB-frobbing and call depth > counting and other bits that don't really even exist for Skylake yet in > a coherent form. We have had several patch kits posted that all are in a "coherent form" That was the original one http://lkml.iu.edu/hypermail/linux

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Jim Mattson
For GCE, "you might be migrated to Skylake" is pretty much a certainty. Even if you're in a zone that doesn't currently have Skylake machines, chances are pretty good that it will have Skylake machines some day in the not-too-distant future. In general, making these kinds of decisions based on F/M

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread David Woodhouse
On Mon, 2018-01-29 at 12:44 -0800, Arjan van de Ven wrote: > On 1/29/2018 12:42 PM, Eduardo Habkost wrote: > > > > The question is how the hypervisor could tell that to the guest. > > If Intel doesn't give us a CPUID bit that can be used to tell > > that retpolines are enough, maybe we should us

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Arjan van de Ven
On 1/29/2018 12:42 PM, Eduardo Habkost wrote: The question is how the hypervisor could tell that to the guest. If Intel doesn't give us a CPUID bit that can be used to tell that retpolines are enough, maybe we should use a hypervisor CPUID bit for that? the objective is to have retpoline be saf

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Mon, Jan 29, 2018 at 08:17:02PM +, David Woodhouse wrote: > On Mon, 2018-01-29 at 18:14 -0200, Eduardo Habkost wrote: > > > > Sorry for being confused here, as probably the answer is buried > > on a LKML thread somewhere.  The comment explains what the code > > does, but not why.  Why exact

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread David Woodhouse
On Mon, 2018-01-29 at 18:14 -0200, Eduardo Habkost wrote: > > Sorry for being confused here, as probably the answer is buried > on a LKML thread somewhere.  The comment explains what the code > does, but not why.  Why exactly IBRS is preferred on Skylake? > > I'm asking this because I would like

Re: [RFC,05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-29 Thread Eduardo Habkost
On Sat, Jan 20, 2018 at 08:22:56PM +0100, KarimAllah Ahmed wrote: > From: David Woodhouse > > Not functional yet; just add the handling for it in the Spectre v2 > mitigation selection, and the X86_FEATURE_IBRS flag which will control > the code to be added in later patches. > > Also take the #if

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread David Woodhouse
On Wed, 2018-01-24 at 07:09 -0800, Arjan van de Ven wrote: > On 1/24/2018 1:10 AM, Greg Kroah-Hartman wrote: > > Arjan, why do you think this can only be done as a whitelist? > > I suggested a minimum version list for those cpus that need it. > > microcode versions are tricky (and we've released be

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Arjan van de Ven
On 1/24/2018 1:10 AM, Greg Kroah-Hartman wrote: That means the whitelist ends up basically empty right now. Should I add a command line parameter to override it? Otherwise we end up having to rebuild the kernel every time there's a microcode release which covers a new CPU SKU (which is why I ki

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread David Woodhouse
On Wed, 2018-01-24 at 13:29 +0100, Peter Zijlstra wrote: > > Yes :/ > > We could look at extending x86_cpu_id and x86_match_cpu with a stepping > option I suppose, but that might be lots of churn. That goes all the way to mod_deviceinfo, and would be horrid. We could add an x86_match_cpu_steppi

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread David Woodhouse
On Wed, 2018-01-24 at 08:49 -0200, Henrique de Moraes Holschuh wrote: > On Wed, 24 Jan 2018, David Woodhouse wrote: > > > > I'm kind of tempted to turn it into a whitelist just by adding 1 to the > > microcode revision in each table entry. Sure, that N+1 might be another > > microcode build that a

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Peter Zijlstra
On Wed, Jan 24, 2018 at 12:14:51PM +, David Woodhouse wrote: > On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote: > > > > Typically tglx likes to use x86_match_cpu() for these things; see also > > commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to > > errata"). > > Ewww. >

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread David Woodhouse
On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote: > > Typically tglx likes to use x86_match_cpu() for these things; see also > commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to > errata"). Ewww. static u32 hsx_deadline_rev(void) {        switch (boot_cpu_data.x86_mask) {    

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Henrique de Moraes Holschuh
On Wed, 24 Jan 2018, David Woodhouse wrote: > I'm kind of tempted to turn it into a whitelist just by adding 1 to the > microcode revision in each table entry. Sure, that N+1 might be another > microcode build that also has issues but never saw the light of day... Watch out for the (AFAIK) still n

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Peter Zijlstra
> > > + for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) { > > > + if (c->x86_model == spectre_bad_microcodes[i].model && > > > + c->x86_mask == spectre_bad_microcodes[i].stepping) > > > + return (c->microcode <= > > > spectre_bad_microcodes[i].microcode

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Greg Kroah-Hartman
On Wed, Jan 24, 2018 at 09:02:21AM +, David Woodhouse wrote: > On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote: > > Typically tglx likes to use x86_match_cpu() for these things; see also > > commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to > > errata"). > > Thanks, will

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread David Woodhouse
On Wed, 2018-01-24 at 09:47 +0100, Peter Zijlstra wrote: > Typically tglx likes to use x86_match_cpu() for these things; see also > commit: bd9240a18edfb ("x86/apic: Add TSC_DEADLINE quirk due to > errata"). Thanks, will fix. I think we might also end up in whitelist mode, adding "known good" micr

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-24 Thread Peter Zijlstra
On Tue, Jan 23, 2018 at 08:58:36PM +, David Woodhouse wrote: > +static const struct sku_microcode spectre_bad_microcodes[] = { > + { INTEL_FAM6_KABYLAKE_DESKTOP, 0x0B, 0x80 }, > + { INTEL_FAM6_KABYLAKE_MOBILE, 0x0A, 0x80 }, > + { INTEL_FAM6_KABYLAKE_MOBILE, 0x0A, 0x80 }, > + {

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-23 Thread David Woodhouse
On Sun, 2018-01-21 at 15:31 +0100, Thomas Gleixner wrote: > >  > > XX: Do we want a microcode blacklist? > > Oh yes, we want a microcode blacklist. Ideally we refuse to load the > affected microcode in the first place and if its already loaded then at > least avoid to use the borked features. > >

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-22 Thread Woodhouse, David
On Mon, 2018-01-22 at 14:30 +0100, Greg Kroah-Hartman wrote: > We kind of do, you can submit patches to UEFI, but I doubt that the > processor-specific portions are actually present in the Tianocore code > to be able to be patched. This is just about which microcode your BIOS loads into the CPU be

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-22 Thread Greg Kroah-Hartman
On Mon, Jan 22, 2018 at 01:06:18PM +0100, Borislav Petkov wrote: > On Mon, Jan 22, 2018 at 10:51:53AM +0100, Peter Zijlstra wrote: > > That wouldn't be enough; AFAIU there's people with this stuff already > > flashed in their BIOS. So the kernel needs to deal with it one way or > > another. > > No

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-22 Thread Borislav Petkov
On Mon, Jan 22, 2018 at 10:51:53AM +0100, Peter Zijlstra wrote: > That wouldn't be enough; AFAIU there's people with this stuff already > flashed in their BIOS. So the kernel needs to deal with it one way or > another. Not a lot we can do there except maybe disable IBRS on those and users can go a

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-22 Thread Peter Zijlstra
On Sun, Jan 21, 2018 at 03:56:55PM +0100, Borislav Petkov wrote: > Also, blacklisting microcode for early loading will become an ugly dance > so I'd like to avoid it if possible. > > Thus, it would be much much easier if dracut/initrd creation thing > already filters those blacklisted blobs by loo

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-21 Thread David Woodhouse
> On Sat, 20 Jan 2018, KarimAllah Ahmed wrote: >> From: David Woodhouse >> >> Not functional yet; just add the handling for it in the Spectre v2 >> mitigation selection, and the X86_FEATURE_IBRS flag which will control >> the code to be added in later patches. >> >> Also take the #ifdef CONFIG_RE

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-21 Thread Borislav Petkov
On Sun, Jan 21, 2018 at 03:31:28PM +0100, Thomas Gleixner wrote: > Oh yes, we want a microcode blacklist. Ideally we refuse to load the > affected microcode in the first place and if its already loaded then at > least avoid to use the borked features. > > PR texts promising that Intel is committed

Re: [RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-21 Thread Thomas Gleixner
On Sat, 20 Jan 2018, KarimAllah Ahmed wrote: > From: David Woodhouse > > Not functional yet; just add the handling for it in the Spectre v2 > mitigation selection, and the X86_FEATURE_IBRS flag which will control > the code to be added in later patches. > > Also take the #ifdef CONFIG_RETPOLINE

[RFC 05/10] x86/speculation: Add basic IBRS support infrastructure

2018-01-20 Thread KarimAllah Ahmed
From: David Woodhouse Not functional yet; just add the handling for it in the Spectre v2 mitigation selection, and the X86_FEATURE_IBRS flag which will control the code to be added in later patches. Also take the #ifdef CONFIG_RETPOLINE from around the RSB-stuffing; IBRS mode will want that too.