]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kvm: x86: vmx: fix vpid leak
authorRoman Kagan <rkagan@virtuozzo.com>
Thu, 19 Jul 2018 18:59:07 +0000 (21:59 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 20 Jul 2018 16:07:22 +0000 (18:07 +0200)
commit63aff65573d73eb8dda4732ad4ef222dd35e4862
treee156a616d972a9a7e060d7174b432c2d87f4a563
parent0a06d4256674c4e041945b52044941995fee237d
kvm: x86: vmx: fix vpid leak

VPID for the nested vcpu is allocated at vmx_create_vcpu whenever nested
vmx is turned on with the module parameter.

However, it's only freed if the L1 guest has executed VMXON which is not
a given.

As a result, on a system with nested==on every creation+deletion of an
L1 vcpu without running an L2 guest results in leaking one vpid.  Since
the total number of vpids is limited to 64k, they can eventually get
exhausted, preventing L2 from starting.

Delay allocation of the L2 vpid until VMXON emulation, thus matching its
freeing.

Fixes: 5c614b3583e7b6dab0c86356fa36c2bcbb8322a0
Cc: stable@vger.kernel.org
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c