[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2ea05111-1598-f82c-e868-0615bc003612@redhat.com>
Date: Fri, 11 Jun 2021 17:53:58 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Wanpeng Li <kernellwp@...il.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, stable@...r.kernel.org
Subject: Re: [PATCH] KVM: X86: Fix x86_emulator slab cache leak
On 11/06/21 06:59, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@...cent.com>
>
> Commit c9b8b07cded58 (KVM: x86: Dynamically allocate per-vCPU emulation context)
> tries to allocate per-vCPU emulation context dynamically, however, the
> x86_emulator slab cache is still exiting after the kvm module is unload
> as below after destroying the VM and unloading the kvm module.
>
> grep x86_emulator /proc/slabinfo
> x86_emulator 36 36 2672 12 8 : tunables 0 0 0 : slabdata 3 3 0
>
> This patch fixes this slab cache leak by destroying the x86_emulator slab cache
> when the kvm module is unloaded.
>
> Fixes: c9b8b07cded58 (KVM: x86: Dynamically allocate per-vCPU emulation context)
> Cc: stable@...r.kernel.org
> Signed-off-by: Wanpeng Li <wanpengli@...cent.com>
> ---
> arch/x86/kvm/x86.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 6d3955a6a763..fe26f33e8782 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8258,6 +8258,7 @@ void kvm_arch_exit(void)
> kvm_x86_ops.hardware_enable = NULL;
> kvm_mmu_module_exit();
> free_percpu(user_return_msrs);
> + kmem_cache_destroy(x86_emulator_cache);
> kmem_cache_destroy(x86_fpu_cache);
> #ifdef CONFIG_KVM_XEN
> static_key_deferred_flush(&kvm_xen_enabled);
>
Queued, thanks
Paolo
Powered by blists - more mailing lists