]> git.baikalelectronics.ru Git - kernel.git/commit
x86: kvm: mmu: use ept a/d in vmcs02 iff used in vmcs12
authorPeter Feiner <pfeiner@google.com>
Sat, 1 Jul 2017 00:26:32 +0000 (17:26 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 3 Jul 2017 13:12:44 +0000 (15:12 +0200)
commit2895adba5fb71395fd50d89225c2ff1a2b145166
tree42947745f20afe1510b952ca47497d7a33c72202
parent6914310325a43051c9fdf1dd35d685d99f883df1
x86: kvm: mmu: use ept a/d in vmcs02 iff used in vmcs12

EPT A/D was enabled in the vmcs02 EPTP regardless of the vmcs12's EPTP
value. The problem is that enabling A/D changes the behavior of L2's
x86 page table walks as seen by L1. With A/D enabled, x86 page table
walks are always treated as EPT writes.

Commit 4b124e733433 ("kvm: nVMX: support EPT accessed/dirty bits",
2017-03-30) tried to work around this problem by clearing the write
bit in the exit qualification for EPT violations triggered by page
walks.  However, that fixup introduced the opposite bug: page-table walks
that actually set x86 A/D bits were *missing* the write bit in the exit
qualification.

This patch fixes the problem by disabling EPT A/D in the shadow MMU
when EPT A/D is disabled in vmcs12's EPTP.

Signed-off-by: Peter Feiner <pfeiner@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/vmx.c