[FYI PATCH 0/5] Missing TLB flushes

From: Paolo Bonzini
Date: Thu Jan 30 2020 - 13:02:04 EST


From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

The KVM hypervisor may provide a guest with ability to defer remote TLB
flush when the remote VCPU is not running. When this feature is used,
the TLB flush will happen only when the remote VPCU is scheduled to run
again. This will avoid unnecessary (and expensive) IPIs.

Under certain circumstances, when a guest initiates such deferred action,
the hypervisor may miss the request. It is also possible that the guest
may mistakenly assume that it has already marked remote VCPU as needing
a flush when in fact that request had already been processed by the
hypervisor. In both cases this will result in an invalid translation
being present in a vCPU, potentially allowing accesses to memory locations
in that guest's address space that should not be accessible.

Note that only intra-guest memory is vulnerable.

The attached patches address both of these problems:
1. The first patch makes sure the hypervisor doesn't accidentally clear
guest's remote flush request
2. The rest of the patches prevent the race between hypervisor
acknowledging a remote flush request and guest issuing a new one.

Boris Ostrovsky (5):
x86/kvm: Be careful not to clear KVM_VCPU_FLUSH_TLB bit
x86/kvm: Introduce kvm_(un)map_gfn()
x86/kvm: Cache gfn to pfn translation
x86/KVM: Make sure KVM_VCPU_FLUSH_TLB flag is not missed
x86/KVM: Clean up host's steal time structure

arch/x86/include/asm/kvm_host.h | 4 +-
arch/x86/kvm/x86.c | 69 +++++++++++++++---------
include/linux/kvm_host.h | 5 ++
include/linux/kvm_types.h | 9 +++-
virt/kvm/kvm_main.c | 113 ++++++++++++++++++++++++++++++++++------
5 files changed, 154 insertions(+), 46 deletions(-)

--
1.8.3.1