diff options
author | Jim Mattson <jmattson@google.com> | 2018-05-09 17:02:05 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-05-14 18:24:26 +0200 |
commit | 3a2936dedd207b99c64bf1507a62a9ae44114220 (patch) | |
tree | 137cbab7344cb910caa650f51cf3fea92ebb85c8 /arch/x86/kvm/mmu.c | |
parent | 1313cc2bd8f6568dd8801feef446afbe43e6d313 (diff) | |
download | lwn-3a2936dedd207b99c64bf1507a62a9ae44114220.tar.gz lwn-3a2936dedd207b99c64bf1507a62a9ae44114220.zip |
kvm: mmu: Don't expose private memslots to L2
These private pages have special purposes in the virtualization of L1,
but not in the virtualization of L2. In particular, L1's APIC access
page should never be entered into L2's page tables, because this
causes a great deal of confusion when the APIC virtualization hardware
is being used to accelerate L2's accesses to its own APIC.
Signed-off-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ca04766edbd4..8af8c8f88bd7 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3807,6 +3807,14 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, struct kvm_memory_slot *slot; bool async; + /* + * Don't expose private memslots to L2. + */ + if (is_guest_mode(vcpu) && !kvm_is_visible_gfn(vcpu->kvm, gfn)) { + *pfn = KVM_PFN_NOSLOT; + return false; + } + slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn); async = false; *pfn = __gfn_to_pfn_memslot(slot, gfn, false, &async, write, writable); |