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 0ADA32C1595; Sun, 7 Jun 2026 10:30:30 +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=1780828230; cv=none; b=gDTqgy8MVzvXrq5cLvxkvl50enltyEAvHQ4xn6YulUmL/wK4x591DHi6V/rc8nbfoR70y0xje9pySZMIygugsGxR9vTT+p6fA2TDug40alfFwRj2FnRbWgx++IthRyw0BERAr56mGKCrdWsrd6+GzgcsGWhkvOtsbkkuWLt9ZWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828230; c=relaxed/simple; bh=P5nAU+CVGErc3WES3zgn4l9dcxuNRWCTgt5y7MiQJMQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MjrWD/tuhN43rAdyAKeq/CxeB6Wqm1Z0q3Z12GcWvQaDLfS0JFHnB0FB7iJuWjjhZLohk6Gl/Rsn7YGDitoDjH3PDEEZ5MGGJNdZv93C9owL8tPXRXdiICNVPufCf+fvu1xPbJYtR3E1lXggalYuDPmxTgk8KQaCZUGHph4L7rI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2aN1xp+z; 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="2aN1xp+z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1281C1F00893; Sun, 7 Jun 2026 10:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828229; bh=VQ0s9yG0ivWZPDIVs6F6O3lummEHIM4u4glwyuCJ2Zs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2aN1xp+zcCsZHvNYKknhqReKV0ZnA8+JvlaNHcDLBxlgBO2b/c/5NA7mTZzHzX2tR Qam0UodhRSTw7k06abSY/2wuW+vd3ttCw7ArAlf1MrBqrZIlpS7/vHSpjmoUMi9Ncf hG277ZeDpn36f9TuPRh/usSHiPgcjMRRDyWi1X/c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tom Lendacky , Michael Roth , Sean Christopherson , Paolo Bonzini Subject: [PATCH 7.0 165/332] KVM: SEV: WARN if KVM attempts to setup scratch area with min_len==0 Date: Sun, 7 Jun 2026 11:58:54 +0200 Message-ID: <20260607095734.126902131@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095728.031258202@linuxfoundation.org> References: <20260607095728.031258202@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 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Christopherson commit f185e05dce6f170f83c4ba602e969b1c3c7a22e6 upstream. Now that all paths in KVM properly validate the length needed for the scratch area, and are guaranteed to pass in a non-zero length, WARN if KVM attempts to configured the scratch area with min_len==0 to guard against future bugs. Cc: stable@vger.kernel.org Reviewed-by: Tom Lendacky Reviewed-by: Michael Roth Signed-off-by: Sean Christopherson Message-ID: <20260501202250.2115252-8-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/sev.c | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -3624,6 +3624,9 @@ static int setup_vmgexit_scratch(struct u64 scratch_gpa_beg, scratch_gpa_end; void *scratch_va; + if (WARN_ON_ONCE(!min_len)) + goto e_scratch; + scratch_gpa_beg = svm->sev_es.sw_scratch; if (!scratch_gpa_beg) { pr_err("vmgexit: scratch gpa not provided\n");