diff mbox series

[1/2] kvm: nVMX: Enforce must-be-zero bits in the IA32_VMX_VMCS_ENUM MSR

Message ID 20190531184159.260151-1-aaronlewis@google.com (mailing list archive)
State New, archived
Headers show
Series [1/2] kvm: nVMX: Enforce must-be-zero bits in the IA32_VMX_VMCS_ENUM MSR | expand

Commit Message

Aaron Lewis May 31, 2019, 6:41 p.m. UTC
According to the SDM, bit 0 and bits 63:10 of the IA32_VMX_VMCS_ENUM
MSR are reserved and are read as 0.

Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/vmx/nested.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Krish Sadhukhan June 4, 2019, 5:52 p.m. UTC | #1
On 5/31/19 11:41 AM, Aaron Lewis wrote:
> According to the SDM, bit 0 and bits 63:10 of the IA32_VMX_VMCS_ENUM
> MSR are reserved and are read as 0.
>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> Reviewed-by: Jim Mattson <jmattson@google.com>
> ---
>   arch/x86/kvm/vmx/nested.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 6401eb7ef19c..3438279e76bb 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1219,6 +1219,8 @@ int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
>   	case MSR_IA32_VMX_EPT_VPID_CAP:
>   		return vmx_restore_vmx_ept_vpid_cap(vmx, data);
>   	case MSR_IA32_VMX_VMCS_ENUM:
> +		if (data & (GENMASK_ULL(63, 10) | BIT_ULL(0)))
> +			return -EINVAL;
>   		vmx->nested.msrs.vmcs_enum = data;
>   		return 0;
>   	default:


Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Aaron Lewis June 18, 2019, 2:15 p.m. UTC | #2
On Tue, Jun 4, 2019 at 10:52 AM Krish Sadhukhan
<krish.sadhukhan@oracle.com> wrote:
>
>
> On 5/31/19 11:41 AM, Aaron Lewis wrote:
> > According to the SDM, bit 0 and bits 63:10 of the IA32_VMX_VMCS_ENUM
> > MSR are reserved and are read as 0.
> >
> > Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> > Reviewed-by: Jim Mattson <jmattson@google.com>
> > Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> > ---
> >   arch/x86/kvm/vmx/nested.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index 6401eb7ef19c..3438279e76bb 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> > @@ -1219,6 +1219,8 @@ int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
> >       case MSR_IA32_VMX_EPT_VPID_CAP:
> >               return vmx_restore_vmx_ept_vpid_cap(vmx, data);
> >       case MSR_IA32_VMX_VMCS_ENUM:
> > +             if (data & (GENMASK_ULL(63, 10) | BIT_ULL(0)))
> > +                     return -EINVAL;
> >               vmx->nested.msrs.vmcs_enum = data;
> >               return 0;
> >       default:
>
>
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
>

ping
Aaron Lewis July 10, 2019, 4:08 p.m. UTC | #3
On Tue, Jun 18, 2019 at 7:15 AM Aaron Lewis <aaronlewis@google.com> wrote:
>
> On Tue, Jun 4, 2019 at 10:52 AM Krish Sadhukhan
> <krish.sadhukhan@oracle.com> wrote:
> >
> >
> > On 5/31/19 11:41 AM, Aaron Lewis wrote:
> > > According to the SDM, bit 0 and bits 63:10 of the IA32_VMX_VMCS_ENUM
> > > MSR are reserved and are read as 0.
> > >
> > > Signed-off-by: Aaron Lewis <aaronlewis@google.com>
> > > Reviewed-by: Jim Mattson <jmattson@google.com>
> > > Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> > > ---
> > >   arch/x86/kvm/vmx/nested.c | 2 ++
> > >   1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > > index 6401eb7ef19c..3438279e76bb 100644
> > > --- a/arch/x86/kvm/vmx/nested.c
> > > +++ b/arch/x86/kvm/vmx/nested.c
> > > @@ -1219,6 +1219,8 @@ int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
> > >       case MSR_IA32_VMX_EPT_VPID_CAP:
> > >               return vmx_restore_vmx_ept_vpid_cap(vmx, data);
> > >       case MSR_IA32_VMX_VMCS_ENUM:
> > > +             if (data & (GENMASK_ULL(63, 10) | BIT_ULL(0)))
> > > +                     return -EINVAL;
> > >               vmx->nested.msrs.vmcs_enum = data;
> > >               return 0;
> > >       default:
> >
> >
> > Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> >
>
> ping


ping
diff mbox series

Patch

diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 6401eb7ef19c..3438279e76bb 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -1219,6 +1219,8 @@  int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
 	case MSR_IA32_VMX_EPT_VPID_CAP:
 		return vmx_restore_vmx_ept_vpid_cap(vmx, data);
 	case MSR_IA32_VMX_VMCS_ENUM:
+		if (data & (GENMASK_ULL(63, 10) | BIT_ULL(0)))
+			return -EINVAL;
 		vmx->nested.msrs.vmcs_enum = data;
 		return 0;
 	default: