From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C192D1A6827; Mon, 4 May 2026 14:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904123; cv=none; b=Oa4so0lbPMckc4OQyFoODArYLsTEhbOJLFoDGXCUztYSyPZSO2gQAhfNWiG+9GE6NjbmpzNL/NM5QRSRROLV+XNPTOZ0RBjR/iccQKE1GGz0STgRz4EeFdYwKXxs3eHIQsI3JDF/RpnHMAqSHeK75YNtBGCo2RvRepn6eIDLnQU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904123; c=relaxed/simple; bh=gu4r6XNoXtcSDPxAcdunJM88jQA+0qF6O1MZyImUsRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eEKxw7idH3FAJ9FpdTt+84EpFbj3zo3jDuW30MWoP6Z4E9Rr9y7/lyx8Ugeio2xUB1yM7JEMUpzKvVfHGt3M5cazzydB4FvIFmipGQtcBg16BATngdd2xigsn4APAQVMJg1NMQe2GjO4y8httojh0ST3ogr2WyEbhxzUR/zzijs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Gn9nCW+e; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Gn9nCW+e" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5737FC2BCB8; Mon, 4 May 2026 14:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777904123; bh=gu4r6XNoXtcSDPxAcdunJM88jQA+0qF6O1MZyImUsRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gn9nCW+eKIeJ/H14+EGomwAhlaf2JrdmmBGWTZcd0vrQOin5vGUO2yiVVGx5WqYU0 cXz88MUdJwBqMDbybpWoJhSRoomm5M6J2rYeNVPCWWuwj6t8Q64GrH/1WTnoarx3Aa Uol2Iem8Yjpg7YLnbo4ndcke11e/mfC7FLNTGvgg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yosry Ahmed , Sean Christopherson Subject: [PATCH 6.18 191/275] KVM: nSVM: Add missing consistency check for nCR3 validity Date: Mon, 4 May 2026 15:52:11 +0200 Message-ID: <20260504135150.173807606@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135142.929052779@linuxfoundation.org> References: <20260504135142.929052779@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yosry Ahmed commit b71138fcc362c67ebe66747bb22cb4e6b4d6a651 upstream. >>From the APM Volume #2, 15.25.4 (24593—Rev. 3.42—March 2024): When VMRUN is executed with nested paging enabled (NP_ENABLE = 1), the following conditions are considered illegal state combinations, in addition to those mentioned in “Canonicalization and Consistency Checks”: • Any MBZ bit of nCR3 is set. • Any G_PAT.PA field has an unsupported type encoding or any reserved field in G_PAT has a nonzero value. Add the consistency check for nCR3 being a legal GPA with no MBZ bits set. Note, the G_PAT.PA check is being handled separately[*]. Link: https://lore.kernel.org/kvm/20260205214326.1029278-3-jmattson@google.com [*] Fixes: 4b16184c1cca ("KVM: SVM: Initialize Nested Nested MMU context on VMRUN") Cc: stable@vger.kernel.org Signed-off-by: Yosry Ahmed Link: https://patch.msgid.link/20260303003421.2185681-16-yosry@kernel.org [sean: capture everything in CC(), massage changelog formatting] Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/nested.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -335,6 +335,10 @@ static bool __nested_vmcb_check_controls if (CC(control->asid == 0)) return false; + if (CC((control->nested_ctl & SVM_NESTED_CTL_NP_ENABLE) && + !kvm_vcpu_is_legal_gpa(vcpu, control->nested_cr3))) + return false; + if (CC(!nested_svm_check_bitmap_pa(vcpu, control->msrpm_base_pa, MSRPM_SIZE))) return false;