Message ID | 1509669327-3940-2-git-send-email-wanpeng.li@hotmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Nov 2, 2017 at 5:35 PM, Wanpeng Li <kernellwp@gmail.com> wrote: > From: Wanpeng Li <wanpeng.li@hotmail.com> > > According to the SDM, if the "load IA32_BNDCFGS" VM-entry controls is 1, the > following checks are performed on the field for the IA32_BNDCFGS MSR: > - Bits reserved in the IA32_BNDCFGS MSR must be 0. > - The linear address in bits 63:12 must be canonical. > > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Radim Krčmář <rkrcmar@redhat.com> > Cc: Jim Mattson <jmattson@google.com> > Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> > --- > v3 -> v4: > * simply condition > * use && instead of nested "if"s > > arch/x86/kvm/vmx.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index e6c8ffa..6cf3972 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -10805,6 +10805,11 @@ static int check_vmentry_postreqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, > return 1; > } > > + if (kvm_mpx_supported() && I think you kept the wrong conjunct from the previous version. Drop kvm_mpx_supported() and restore the test for (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS). > + (is_noncanonical_address(vmcs12->guest_bndcfgs & PAGE_MASK, vcpu) || > + (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD))) > + return 1; > + > return 0; > } > > -- > 2.7.4 >
2017-11-04 1:52 GMT+08:00 Jim Mattson <jmattson@google.com>: > On Thu, Nov 2, 2017 at 5:35 PM, Wanpeng Li <kernellwp@gmail.com> wrote: >> From: Wanpeng Li <wanpeng.li@hotmail.com> >> >> According to the SDM, if the "load IA32_BNDCFGS" VM-entry controls is 1, the >> following checks are performed on the field for the IA32_BNDCFGS MSR: >> - Bits reserved in the IA32_BNDCFGS MSR must be 0. >> - The linear address in bits 63:12 must be canonical. >> >> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> >> Cc: Paolo Bonzini <pbonzini@redhat.com> >> Cc: Radim Krčmář <rkrcmar@redhat.com> >> Cc: Jim Mattson <jmattson@google.com> >> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com> >> --- >> v3 -> v4: >> * simply condition >> * use && instead of nested "if"s >> >> arch/x86/kvm/vmx.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c >> index e6c8ffa..6cf3972 100644 >> --- a/arch/x86/kvm/vmx.c >> +++ b/arch/x86/kvm/vmx.c >> @@ -10805,6 +10805,11 @@ static int check_vmentry_postreqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, >> return 1; >> } >> >> + if (kvm_mpx_supported() && > > I think you kept the wrong conjunct from the previous version. Drop > kvm_mpx_supported() and restore the test for > (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS). Yeah, I misunderstand the English. Regards, Wanpeng Li
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index e6c8ffa..6cf3972 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -10805,6 +10805,11 @@ static int check_vmentry_postreqs(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, return 1; } + if (kvm_mpx_supported() && + (is_noncanonical_address(vmcs12->guest_bndcfgs & PAGE_MASK, vcpu) || + (vmcs12->guest_bndcfgs & MSR_IA32_BNDCFGS_RSVD))) + return 1; + return 0; }