summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/vmx.c
diff options
context:
space:
mode:
authorJim Mattson <jmattson@google.com>2017-05-24 10:49:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-21 07:44:59 +0200
commita40f0ccd4f1c2751d5df5d9a63b9cf93ff70d343 (patch)
treed7c9d18fd939fae079aecaef569242386839a699 /arch/x86/kvm/vmx.c
parentbe6f33a61f335cb06b3c8c2cee90214f97c4bda3 (diff)
kvm: x86: Guest BNDCFGS requires guest MPX support
commit 4439af9f911ae0243ffe4e2dfc12bace49605d8b upstream. The BNDCFGS MSR should only be exposed to the guest if the guest supports MPX. (cf. the TSC_AUX MSR and RDTSCP.) Fixes: 0dd376e709975779 ("KVM: x86: add MSR_IA32_BNDCFGS to msrs_to_save") Change-Id: I3ad7c01bda616715137ceac878f3fa7e66b6b387 Signed-off-by: Jim Mattson <jmattson@google.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r--arch/x86/kvm/vmx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 0e0c52e57e90..3d776b625766 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2812,7 +2812,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
msr_info->data = vmcs_readl(GUEST_SYSENTER_ESP);
break;
case MSR_IA32_BNDCFGS:
- if (!kvm_mpx_supported())
+ if (!kvm_mpx_supported() || !guest_cpuid_has_mpx(vcpu))
return 1;
msr_info->data = vmcs_read64(GUEST_BNDCFGS);
break;
@@ -2889,7 +2889,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
vmcs_writel(GUEST_SYSENTER_ESP, data);
break;
case MSR_IA32_BNDCFGS:
- if (!kvm_mpx_supported())
+ if (!kvm_mpx_supported() || !guest_cpuid_has_mpx(vcpu))
return 1;
vmcs_write64(GUEST_BNDCFGS, data);
break;