aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-02-19 10:23:05 -0500
committerAvi Kivity <avi@redhat.com>2010-04-25 05:34:19 -0400
commit4c7da8cb43c09e71a405b5aeaa58a1dbac3c39e9 (patch)
tree69c28e6a470b4d6b33e2d61d81e370557a4485b5 /arch/x86/kvm
parent6c3bd3d7660c35a703073b81eccfd5a3b7c15295 (diff)
KVM: SVM: Fix nested msr intercept handling
The nested_svm_exit_handled_msr() function maps only one page of the guests msr permission bitmap. This patch changes the code to use kvm_read_guest to fix the bug. Cc: stable@kernel.org Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/svm.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 4bc018333d76..4459c477af9f 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1461,19 +1461,13 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm)
1461{ 1461{
1462 u32 param = svm->vmcb->control.exit_info_1 & 1; 1462 u32 param = svm->vmcb->control.exit_info_1 & 1;
1463 u32 msr = svm->vcpu.arch.regs[VCPU_REGS_RCX]; 1463 u32 msr = svm->vcpu.arch.regs[VCPU_REGS_RCX];
1464 struct page *page;
1465 bool ret = false; 1464 bool ret = false;
1466 u32 t0, t1; 1465 u32 t0, t1;
1467 u8 *msrpm; 1466 u8 val;
1468 1467
1469 if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT))) 1468 if (!(svm->nested.intercept & (1ULL << INTERCEPT_MSR_PROT)))
1470 return false; 1469 return false;
1471 1470
1472 msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, &page);
1473
1474 if (!msrpm)
1475 goto out;
1476
1477 switch (msr) { 1471 switch (msr) {
1478 case 0 ... 0x1fff: 1472 case 0 ... 0x1fff:
1479 t0 = (msr * 2) % 8; 1473 t0 = (msr * 2) % 8;
@@ -1494,11 +1488,10 @@ static bool nested_svm_exit_handled_msr(struct vcpu_svm *svm)
1494 goto out; 1488 goto out;
1495 } 1489 }
1496 1490
1497 ret = msrpm[t1] & ((1 << param) << t0); 1491 if (!kvm_read_guest(svm->vcpu.kvm, svm->nested.vmcb_msrpm + t1, &val, 1))
1492 ret = val & ((1 << param) << t0);
1498 1493
1499out: 1494out:
1500 nested_svm_unmap(page);
1501
1502 return ret; 1495 return ret;
1503} 1496}
1504 1497