summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorJim Mattson <jmattson@google.com>2016-07-08 15:36:06 -0700
committerSasha Levin <alexander.levin@verizon.com>2016-08-22 12:23:09 -0400
commit2aa2e066287e796f1ead8476a0b1306b10777f8f (patch)
tree8205eb9c9c00f8952364b1a5df85321eef7f10e3 /virt
parent6ef4fa7aa0b734e59c57ae5e7ba6446b3dcff4cd (diff)
downloadlwn-2aa2e066287e796f1ead8476a0b1306b10777f8f.tar.gz
lwn-2aa2e066287e796f1ead8476a0b1306b10777f8f.zip
KVM: nVMX: Fix memory corruption when using VMCS shadowing
[ Upstream commit 2f1fe81123f59271bddda673b60116bde9660385 ] When freeing the nested resources of a vcpu, there is an assumption that the vcpu's vmcs01 is the current VMCS on the CPU that executes nested_release_vmcs12(). If this assumption is violated, the vcpu's vmcs01 may be made active on multiple CPUs at the same time, in violation of Intel's specification. Moreover, since the vcpu's vmcs01 is not VMCLEARed on every CPU on which it is active, it can linger in a CPU's VMCS cache after it has been freed and potentially repurposed. Subsequent eviction from the CPU's VMCS cache on a capacity miss can result in memory corruption. It is not sufficient for vmx_free_vcpu() to call vmx_load_vmcs01(). If the vcpu in question was last loaded on a different CPU, it must be migrated to the current CPU before calling vmx_load_vmcs01(). Signed-off-by: Jim Mattson <jmattson@google.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 7d32b4e82e86..e013f90f7a29 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -139,6 +139,7 @@ int vcpu_load(struct kvm_vcpu *vcpu)
put_cpu();
return 0;
}
+EXPORT_SYMBOL_GPL(vcpu_load);
void vcpu_put(struct kvm_vcpu *vcpu)
{
@@ -148,6 +149,7 @@ void vcpu_put(struct kvm_vcpu *vcpu)
preempt_enable();
mutex_unlock(&vcpu->mutex);
}
+EXPORT_SYMBOL_GPL(vcpu_put);
static void ack_flush(void *_completed)
{