Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3930896pxj; Mon, 21 Jun 2021 09:37:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNyPOG4ex9xtKWa2++s0BGpGuHRT/xJUlKu68fKXlV1mYRwC0mZXI0oxqkTg6shY9N/6ye X-Received: by 2002:a17:906:9516:: with SMTP id u22mr26028145ejx.442.1624293423292; Mon, 21 Jun 2021 09:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293423; cv=none; d=google.com; s=arc-20160816; b=Bqryaa/B9SiLYgmo8HZTd/R8vIfKss2fHjflDvL5TrfZBdu1E+f4yG31q/wmTRVRsB EAojYtruhjhxS+K0leqcnZdMu5WApSlqYim/oLzcS6iIXKFL0wufC4q4IwT/xahRD/xd A93Lb1bIbQV9Vkm+f4zbA/9N+3ObI2cdViMT1JLfaZb0jZ6xHuP3HzPX2qsBu0eu87li 1mHs5A0tt0ULEvbc35bG0xUy2uYm6nTI8ocEO2vEhThTE/+x0oWkgGw1/9lUS5Kv0xBt vK7b67+P3Ti6j+puuvR92TvSUPr0cTXE/A7aNhlidXHdfi9cgOPqTaMEWGX+wYhUVw66 afbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CJI4tk4Jwp+gyCj8BcLxoundO1MB8fN2nMjBoRkZ6Yc=; b=Vs/SoioCfuW4RwcYkjc/VcKP4F5b1nl7wvFF+/PLxkZ4HaJO8P21xyaXzbChTQEkgy qCT/tTPGqZqv7DZTNYaJg41wpiUZdyLQ5p9OiQwie9EbeGEIPzPwYd6fApZJi+N2S3bO DaM1qSDORc8m55fkjutj9tE4arbKumTJSROkGQpvBF/eS1lOr5V0hcvJRjvcRRb+3QR3 bo8c6NyuJNKKzxoIdAi1J0TfmI+yuf4YXq2qR/gKk5mklPJ845JIDySGwXy3yONQWkVF 5lOZCJWnaDPa5HKvBm851zsAAZU/jrukf5gwaNB/Cd3/k12HkDopGgcRWS6ESa3S1cgg V9QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gDDeZv0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 20si18363651edw.376.2021.06.21.09.36.41; Mon, 21 Jun 2021 09:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gDDeZv0U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233305AbhFUQfs (ORCPT + 99 others); Mon, 21 Jun 2021 12:35:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:54840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbhFUQcB (ORCPT ); Mon, 21 Jun 2021 12:32:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7874561380; Mon, 21 Jun 2021 16:25:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292749; bh=wmQijU7kKbKj7CTjjXlN4Qf/Ll7b92Zy7dVFKLFaTWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDDeZv0Uu1lwhAsKL8/qAn2mpI5yVFPxKeeksvELWxabYHDiRZMDTfQNWC2olgSeS 4jemThzyKEkFZ2Y9WMSLcbOqgUwgBf5JKeylPjnGsaGf5RV/WQ8PAwkjUES6GWtBFj 5S2beQRIealAoVG6ePRJNTPM09jFqZWkIs+riOV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wanpeng Li , Paolo Bonzini Subject: [PATCH 5.10 114/146] KVM: X86: Fix x86_emulator slab cache leak Date: Mon, 21 Jun 2021 18:15:44 +0200 Message-Id: <20210621154918.625077118@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wanpeng Li commit dfdc0a714d241bfbf951886c373cd1ae463fcc25 upstream. 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@vger.kernel.org Signed-off-by: Wanpeng Li Message-Id: <1623387573-5969-1-git-send-email-wanpengli@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -8021,6 +8021,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); }