]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: fix shadow on EPT
authorGleb Natapov <gleb@redhat.com>
Wed, 9 Oct 2013 16:13:19 +0000 (19:13 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Oct 2013 09:39:57 +0000 (11:39 +0200)
commit606947c636ee1d1ef5e9d4535e989176e21114d4
tree31475e605ac4068d647cb2be76d9851910302751
parent0028286448af2189734539a86ef25b44f7b10174
KVM: nVMX: fix shadow on EPT

c76bc711e3d0ed broke shadow on EPT. This patch reverts it and fixes PAE
on nEPT (which reverted commit fixed) in other way.

Shadow on EPT is now broken because while L1 builds shadow page table
for L2 (which is PAE while L2 is in real mode) it never loads L2's
GUEST_PDPTR[0-3].  They do not need to be loaded because without nested
virtualization HW does this during guest entry if EPT is disabled,
but in our case L0 emulates L2's vmentry while EPT is enables, so we
cannot rely on vmcs12->guest_pdptr[0-3] to contain up-to-date values
and need to re-read PDPTEs from L2 memory. This is what kvm_set_cr3()
is doing, but by clearing cache bits during L2 vmentry we drop values
that kvm_set_cr3() read from memory.

So why the same code does not work for PAE on nEPT? kvm_set_cr3()
reads pdptes into vcpu->arch.walk_mmu->pdptrs[]. walk_mmu points to
vcpu->arch.nested_mmu while nested guest is running, but ept_load_pdptrs()
uses vcpu->arch.mmu which contain incorrect values. Fix that by using
walk_mmu in ept_(load|save)_pdptrs.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c