Skip to content

Commit 6ffa92f

Browse files
jsmattsonjrgregkh
authored andcommitted
kvm: vmx: Check value written to IA32_BNDCFGS
commit 4531662d1abf6c1f0e5c2b86ddb60e61509786c8 upstream. Bits 11:2 must be zero and the linear addess in bits 63:12 must be canonical. Otherwise, WRMSR(BNDCFGS) should raise #GP. Fixes: 0dd376e ("KVM: x86: add MSR_IA32_BNDCFGS to msrs_to_save") 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>
1 parent a40f0cc commit 6ffa92f

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

arch/x86/include/asm/msr-index.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@
405405
#define MSR_IA32_TSC_ADJUST 0x0000003b
406406
#define MSR_IA32_BNDCFGS 0x00000d90
407407

408+
#define MSR_IA32_BNDCFGS_RSVD 0x00000ffc
409+
408410
#define MSR_IA32_XSS 0x00000da0
409411

410412
#define FEATURE_CONTROL_LOCKED (1<<0)

arch/x86/kvm/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,9 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
28912891
case MSR_IA32_BNDCFGS:
28922892
if (!kvm_mpx_supported() || !guest_cpuid_has_mpx(vcpu))
28932893
return 1;
2894+
if (is_noncanonical_address(data & PAGE_MASK) ||
2895+
(data & MSR_IA32_BNDCFGS_RSVD))
2896+
return 1;
28942897
vmcs_write64(GUEST_BNDCFGS, data);
28952898
break;
28962899
case MSR_IA32_TSC:

0 commit comments

Comments
 (0)