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 4274438398F; Sat, 12 Sep 2026 18:28:21 +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=1789237702; cv=none; b=jXsRj3mkebxxiVClSRtsy1o8cIxaNJr8UnR53JmsVoBvtJRKRPPgd74JFDr65+/mPdSYY6XKv2EFWqZu6q4pIDz8/nkbC9yn9EjjAd7xXNnWSGg5WzIaigX7AgSth9O08q4XEZOTW+rrQXK3gDf0MN1WEM5yObHku6ClpiMk/O8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789237702; c=relaxed/simple; bh=AtzVXCTJLJdEp09mdQ1JhcfoXHMNSwFFhd+duc7qJ7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UwOKtwzjAxk8Lg/svEzGWQTE2tcJPmHhOm6Vy1psTCD8sN6KSWuwXB9EI0Z+TbqUOMUH0I4jE7EFpuKkTiXWF1ZG+Pf+rMu0qqdnM5aY+CWMGPCnnuGf0Usi4SpeF17s1V55fCwkY0yQTDuDNfyJMp9E99IhWqIPMJOIeP1VDyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qrnn8C8A; 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="qrnn8C8A" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 168BE1F000FF; Sat, 12 Sep 2026 18:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789237701; bh=QiqwGfdOacgpo8D5kN0aI837GLxU0fTi62VSnF4Wwws=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qrnn8C8AzfTAiwmPZyH0Smbqy32s4RioqA1CW6KEC1gdZz/OgY54jcRPPGFC/tj1B AinCx3PzVJn++UWQHj893Am3tpY1Dvf37xU8Rkp8SOqYwrEHB53UFpFQomLNjfnXhk LirAArSa0xQJql1ojl548Bno/8ZHN8XXPPHhCeXU= 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 5.15 305/935] KVM: s390: Free guest debug data on vcpu destroy Date: Sat, 12 Sep 2026 08:55:35 +0200 Message-ID: <20260912065533.804154904@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065526.833703348@linuxfoundation.org> References: <20260912065526.833703348@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 5.15-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 @@ -2825,6 +2825,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);