diff options
author | Avi Kivity <avi@qumranet.com> | 2007-03-21 18:11:36 +0200 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 10:52:26 +0300 |
commit | 6da63cf95f6a19fe0a302232048452c96b178e45 (patch) | |
tree | ee415a52fe660721ea6307cfcb207f6b4f285ff9 | |
parent | 038881c8bec0e9a796d1782c56e29e7c2456626d (diff) | |
download | linux-3.10-6da63cf95f6a19fe0a302232048452c96b178e45.tar.gz linux-3.10-6da63cf95f6a19fe0a302232048452c96b178e45.tar.bz2 linux-3.10-6da63cf95f6a19fe0a302232048452c96b178e45.zip |
KVM: Don't allow the guest to turn off the cpu cache
The cpu cache is a host resource; the guest should not be able to turn
it off (even for itself).
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | drivers/kvm/svm.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index d3cc1157d23..191bc45b83e 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -737,8 +737,10 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) } #endif vcpu->svm->cr0 = cr0; - vcpu->svm->vmcb->save.cr0 = cr0 | CR0_PG_MASK | CR0_WP_MASK; vcpu->cr0 = cr0; + cr0 |= CR0_PG_MASK | CR0_WP_MASK; + cr0 &= ~(CR0_CD_MASK | CR0_NW_MASK); + vcpu->svm->vmcb->save.cr0 = cr0; } static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |