Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-15 Thread Andersen, John
On Tue, Jul 14, 2020 at 09:41:29PM -0700, Sean Christopherson wrote: > On Tue, Jul 14, 2020 at 05:39:30AM +, Andersen, John wrote: > > With regards to FSGSBASE, are we open to validating and adding that to the > > DEFAULT set as a part of a separate patchset? This patchset is focused on > > rep

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-14 Thread Sean Christopherson
On Tue, Jul 14, 2020 at 05:39:30AM +, Andersen, John wrote: > With regards to FSGSBASE, are we open to validating and adding that to the > DEFAULT set as a part of a separate patchset? This patchset is focused on > replicating the functionality we already have natively. Kees added FSGSBASE pin

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-13 Thread Andersen, John
On Thu, Jul 09, 2020 at 09:27:43AM -0700, Andy Lutomirski wrote: > On Thu, Jul 9, 2020 at 9:22 AM Dave Hansen wrote: > > > > On 7/9/20 9:07 AM, Andy Lutomirski wrote: > > > On Thu, Jul 9, 2020 at 8:56 AM Dave Hansen wrote: > > >> On 7/9/20 8:44 AM, Andersen, John wrote: > > >>> Bits which

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-13 Thread Andersen, John
On Thu, Jul 09, 2020 at 09:27:43AM -0700, Andy Lutomirski wrote: > On Thu, Jul 9, 2020 at 9:22 AM Dave Hansen wrote: > > > > On 7/9/20 9:07 AM, Andy Lutomirski wrote: > > > On Thu, Jul 9, 2020 at 8:56 AM Dave Hansen wrote: > > >> On 7/9/20 8:44 AM, Andersen, John wrote: > > >>> Bits which

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-09 Thread Kees Cook
On Thu, Jul 09, 2020 at 09:22:09AM -0700, Dave Hansen wrote: > On 7/9/20 9:07 AM, Andy Lutomirski wrote: > > On Thu, Jul 9, 2020 at 8:56 AM Dave Hansen wrote: > >> On 7/9/20 8:44 AM, Andersen, John wrote: > >>> Bits which are allowed to be pinned default to WP for CR0 and > >>> SMEP, > >>

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-09 Thread Dave Hansen
On 7/9/20 9:07 AM, Andy Lutomirski wrote: > On Thu, Jul 9, 2020 at 8:56 AM Dave Hansen wrote: >> On 7/9/20 8:44 AM, Andersen, John wrote: >>> Bits which are allowed to be pinned default to WP for CR0 and SMEP, >>> SMAP, and UMIP for CR4. >> I think it also makes sense to have FSGSB

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-09 Thread Dave Hansen
On 7/9/20 8:44 AM, Andersen, John wrote: > > Bits which are allowed to be pinned default to WP for CR0 and SMEP, > SMAP, and UMIP for CR4. I think it also makes sense to have FSGSBASE in this set. I know it hasn't been tested, but I think we should do the legwork to test it. If

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-09 Thread Andersen, John
On Tue, Jul 07, 2020 at 11:51:54PM +0200, Paolo Bonzini wrote: > On 07/07/20 23:48, Dave Hansen wrote: > > On 7/7/20 2:12 PM, Sean Christopherson wrote: > > Let's say Intel loses its marbles and adds a CR4 bit that lets userspace > > write to kernel memory. Linux won't set it, but an attac

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-07 Thread Paolo Bonzini
On 07/07/20 23:48, Dave Hansen wrote: > On 7/7/20 2:12 PM, Sean Christopherson wrote: > Let's say Intel loses its marbles and adds a CR4 bit that lets userspace > write to kernel memory. Linux won't set it, but an attacker would go > after it, first thing. >> That's an orthogonal to pi

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-07 Thread Dave Hansen
On 7/7/20 2:12 PM, Sean Christopherson wrote: Let's say Intel loses its marbles and adds a CR4 bit that lets userspace write to kernel memory. Linux won't set it, but an attacker would go after it, first thing. > That's an orthogonal to pinning. KVM never lets the guest set CR4 bit

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-07-07 Thread Sean Christopherson
On Thu, Jun 18, 2020 at 07:51:10AM -0700, Dave Hansen wrote: > On 6/18/20 7:43 AM, Andersen, John wrote: > > On Thu, Jun 18, 2020 at 07:18:09AM -0700, Dave Hansen wrote: > >> On 6/17/20 12:07 PM, John Andersen wrote: > >>> +#define KVM_CR0_PIN_ALLOWED (X86_CR0_WP) > >>> +#define KVM_CR4_PIN_AL

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-06-18 Thread Dave Hansen
On 6/18/20 7:43 AM, Andersen, John wrote: > On Thu, Jun 18, 2020 at 07:18:09AM -0700, Dave Hansen wrote: >> On 6/17/20 12:07 PM, John Andersen wrote: >>> +#define KVM_CR0_PIN_ALLOWED(X86_CR0_WP) >>> +#define KVM_CR4_PIN_ALLOWED(X86_CR4_SMEP | X86_CR4_SMAP | >>> X86_CR4_UMIP) >> >>

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-06-18 Thread Andersen, John
On Thu, Jun 18, 2020 at 07:18:09AM -0700, Dave Hansen wrote: > On 6/17/20 12:07 PM, John Andersen wrote: > > +#define KVM_CR0_PIN_ALLOWED(X86_CR0_WP) > > +#define KVM_CR4_PIN_ALLOWED(X86_CR4_SMEP | X86_CR4_SMAP | > > X86_CR4_UMIP) > > Why *is* there an allowed set? Why don't we j

Re: [PATCH 2/4] KVM: x86: Introduce paravirt feature CR0/CR4 pinning

2020-06-18 Thread Dave Hansen
On 6/17/20 12:07 PM, John Andersen wrote: > +#define KVM_CR0_PIN_ALLOWED (X86_CR0_WP) > +#define KVM_CR4_PIN_ALLOWED (X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP) Why *is* there an allowed set? Why don't we just allow everything? Shouldn't we also pin any unknown bits? The CR4.FSGSBASE bit is