Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-26 Thread Juergen Gross
On 27/04/17 00:04, Borislav Petkov wrote: > On Wed, Apr 26, 2017 at 08:24:12PM +0200, Juergen Gross wrote: >> I'm not feeling strong about it. So if you want to test for >> X86_FEATURE_XENPV to avoid setting X86_BUG_SYSRET_SS_ATTRS I'm fine >> with it. >> >> Will send V2 with that change. > > And

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-26 Thread Borislav Petkov
On Wed, Apr 26, 2017 at 08:24:12PM +0200, Juergen Gross wrote: > I'm not feeling strong about it. So if you want to test for > X86_FEATURE_XENPV to avoid setting X86_BUG_SYSRET_SS_ATTRS I'm fine > with it. > > Will send V2 with that change. And remove the corresponding clear_cpu_bug(c,

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-26 Thread Juergen Gross
On 26/04/17 08:35, Borislav Petkov wrote: > On Wed, Apr 26, 2017 at 06:45:42AM +0200, Juergen Gross wrote: >> The really clean solution would be to add this test to set_cpu_bug() > > No, the really clean solution is to set it once and not play toggle > games. > >> This would work. OTOH I'd

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-26 Thread Borislav Petkov
On Wed, Apr 26, 2017 at 06:45:42AM +0200, Juergen Gross wrote: > The really clean solution would be to add this test to set_cpu_bug() No, the really clean solution is to set it once and not play toggle games. > This would work. OTOH I'd prefer to test whether the bit should be > forced to remain

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Juergen Gross
On 25/04/17 21:18, Borislav Petkov wrote: > On Tue, Apr 25, 2017 at 08:34:34PM +0200, Juergen Gross wrote: >> And what happens when there is a scheduling event right here? >> __switch_to() will see X86_BUG_SYSRET_SS_ATTRS set and take a wrong >> path. > > So the whole thing we're doing right now

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Borislav Petkov
On Tue, Apr 25, 2017 at 09:17:13PM +0100, Andrew Cooper wrote: > The problem (for all ring-deprivileged virtuailsation; not just Xen PV), > is that I know what that that bug flag is for. I'm asking whether the xen guest boot sets a flag early - like XENPV, for example - which can differentiate

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Andrew Cooper
On 25/04/17 20:18, Borislav Petkov wrote: > On Tue, Apr 25, 2017 at 08:34:34PM +0200, Juergen Gross wrote: >> And what happens when there is a scheduling event right here? >> __switch_to() will see X86_BUG_SYSRET_SS_ATTRS set and take a wrong >> path. > So the whole thing we're doing right now is

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Borislav Petkov
On Tue, Apr 25, 2017 at 08:34:34PM +0200, Juergen Gross wrote: > And what happens when there is a scheduling event right here? > __switch_to() will see X86_BUG_SYSRET_SS_ATTRS set and take a wrong > path. So the whole thing we're doing right now is wrong: set bit and then clear bit. We should

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Juergen Gross
On 25/04/17 20:24, Borislav Petkov wrote: > On Tue, Apr 25, 2017 at 08:00:14PM +0200, Juergen Gross wrote: >> When running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set >> on AMD cpus. Xen will disable this via setup_clear_cpu_cap(), so test >> cpu_caps_cleared to not have disabled this

Re: [Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Borislav Petkov
On Tue, Apr 25, 2017 at 08:00:14PM +0200, Juergen Gross wrote: > When running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set > on AMD cpus. Xen will disable this via setup_clear_cpu_cap(), so test > cpu_caps_cleared to not have disabled this bit. > > This bug/feature bit is kind of

[Xen-devel] [PATCH] x86/amd: don't set X86_BUG_SYSRET_SS_ATTRS if forced to zero

2017-04-25 Thread Juergen Gross
When running as Xen pv guest X86_BUG_SYSRET_SS_ATTRS must not be set on AMD cpus. Xen will disable this via setup_clear_cpu_cap(), so test cpu_caps_cleared to not have disabled this bit. This bug/feature bit is kind of special as it will be used very early when switching threads. Setting the bit