From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74B2C2F8EAE; Sat, 12 Sep 2026 14:01:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789221700; cv=none; b=K6XDdZSa8kNPbYrQ8R6ECxHSJ44vEXJswN7hDz3T7IHZw7szRXojvpo5FltAa0KHbHcrsyrnJxJNrbvqZN0tZwFQcYzbraRSaZFN0GRb5q2OWSq/13zWxr7aeeFp1a89dDPeSCbCqFSxzXe58jVxmABXACBr1IYDtXG44oKrK+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789221700; c=relaxed/simple; bh=CXzCubyuSLjFFKVwsuqhSYIqJCZO4fOCOgy8uaYco6c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IBEmqloYeja4/lMVQsldDmig3jwCNPW/ZgYh8XEjrJeY3k4XHHQi/l9f1HnR1Ity3yT6phDTgwS6bD0sXlQ55r8SFN+Yo9X9iITb0M1Mr20VRe1rjmIjnmoKaypeEuKOYqrF0a5rRgKzShGnbXQoIp7RWInEQBc86NycD7lhI/c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hXqVNjtd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="hXqVNjtd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EE9F1F000FF; Sat, 12 Sep 2026 14:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789221699; bh=EE2VXCfWIj2EU6rwOc884/Ds2i1ji0NRJiCCnYOfUtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hXqVNjtdNAyp5FvdPfjeX7v3YF4F82TAlKPrW8YWFYHcDrmTzWx0VOS98ShQgscss 2wUw+I0tan5xeNUx3tqTGyvk6iOu8Eb9jbDPhdpj+joqJZb9ey10el85tNglgNjhIB G6YNMhuhlS6Ag8cFoAHYhkHV1O3jRQH6TTPAp0/s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Borntraeger , Matthew Rosato , Claudio Imbrenda Subject: [PATCH 6.6 0434/1424] KVM: s390: Free guest debug data on vcpu destroy Date: Sat, 12 Sep 2026 08:47:46 +0200 Message-ID: <20260912065617.001963208@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065607.279695368@linuxfoundation.org> References: <20260912065607.279695368@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Borntraeger commit e7f698b09d4a7c36b299acf680fc50fe868e2bcd upstream. kvm_s390_clear_bp_data() is only called from kvm_arch_vcpu_ioctl_set_guest_debug(), i.e. when user space changes or disables debugging. A vCPU that is destroyed while hardware breakpoints are still armed - the normal case when the VMM just exits or crashes - leaks hw_bp_info, hw_wp_info and all old_data buffers, since generic KVM frees the vCPU right after kvm_arch_vcpu_destroy(). That is bounded by MAX_BP_COUNT entries, so roughly 8 KiB per vCPU, but it is unbounded over VM lifetimes. The allocations are GFP_KERNEL_ACCOUNT, so the charge also outlives the exiting process and pins dying memcgs. Fix by clearing the debug data on vCPU destruction. Calling it unconditionally is fine: struct kvm_vcpu is zero allocated, so for a vCPU that never enabled debugging the counters are 0 and the pointers NULL. Fixes: 27291e2165b6 ("KVM: s390: hardware support for guest debugging") Cc: stable@vger.kernel.org Signed-off-by: Christian Borntraeger Reviewed-by: Matthew Rosato Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda Message-ID: <20260805110455.7200-8-borntraeger@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman --- arch/s390/kvm/kvm-s390.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -3437,6 +3437,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vc trace_kvm_s390_destroy_vcpu(vcpu->vcpu_id); kvm_s390_clear_local_irqs(vcpu); kvm_clear_async_pf_completion_queue(vcpu); + kvm_s390_clear_bp_data(vcpu); if (!kvm_is_ucontrol(vcpu->kvm)) sca_del_vcpu(vcpu); kvm_s390_update_topology_change_report(vcpu->kvm, 1);