diff options
author | Avi Kivity <avi@redhat.com> | 2011-06-12 17:14:08 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 12:16:27 +0200 |
commit | 45bd07b9d5202c910b31c92bd15572b560198c26 (patch) | |
tree | 3f4b996f14c03e166bc8636ad167d1c0662f4ac4 /arch/x86 | |
parent | KVM: MMU: Adjust shadow paging to work when SMEP=1 and CR0.WP=0 (diff) | |
download | linux-45bd07b9d5202c910b31c92bd15572b560198c26.tar.xz linux-45bd07b9d5202c910b31c92bd15572b560198c26.zip |
KVM: MMU: make kvm_mmu_reset_context() flush the guest TLB
kvm_set_cr0() and kvm_set_cr4(), and possible other functions,
assume that kvm_mmu_reset_context() flushes the guest TLB. However,
it does not.
Fix by flushing the tlb (and syncing the new root as well).
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/mmu.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index da0f3b081076..9c629b54d362 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3054,8 +3054,18 @@ static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) { + int r; + destroy_kvm_mmu(vcpu); - return init_kvm_mmu(vcpu); + r = init_kvm_mmu(vcpu); + + if (r) + goto err; + + kvm_mmu_sync_roots(vcpu); + kvm_mmu_flush_tlb(vcpu); +err: + return r; } EXPORT_SYMBOL_GPL(kvm_mmu_reset_context); |