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 A7D9C32BF24; Sat, 30 May 2026 16:54:50 +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=1780160091; cv=none; b=GnExOFp57945DmSdGlWuzABv0Jk3DqFASzfkXK0+OHDI8WUpmaC87JDhLoOlomrKvCJOTCwqV4oursCDgc4oSwreFWasNeInYLnWLzW67lSizomKrr3oSZyPH0wC+Zz7ZfT6Wu++NstRnJFofbIQCEOvalT3nCFkpuRtjel5HfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780160091; c=relaxed/simple; bh=CmjO9LXaApYXHh2N57h1qYNKoia3y4j7RJb3+aAeNxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QlOfphUV6OPvZgnjHltbPorWD9tl8TLr9DJ8LA8Epu1mnetqgSt7S0NqY0A28FCvQjRlxlPThxVXStX66xlTBfpUh6KM/Idh2RebN475QhTwuRxRDGvwJOBGS20DDFhR8dJcNbFkXLWz6+/sEpKJhBEgFU0q6IhOI6JpqqYxBTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eN+l0W/u; 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="eN+l0W/u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C89751F00893; Sat, 30 May 2026 16:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780160090; bh=1B7g9y3Z3u7cuZUtoWV0sHAciSbG4jfUkYXvL9TrW7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eN+l0W/uOsFWWrM5Sbx4nRQLgxGq3dVdMD8syTJCf1K1SLu5H4ekaxoC87UgwgPbY gyeZrkc7fJ0bd9zZlF+gPb6aQPqp2w9IiIMUOpGT26CcOzPjQxtCACD+oyE5dJvT87 +FYEy6bAG3ifWYeUsHTWAb14o7Ljl4nk9vuviZAs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yosry Ahmed , Sean Christopherson Subject: [PATCH 6.1 243/969] KVM: nSVM: Add missing consistency check for nCR3 validity Date: Sat, 30 May 2026 17:56:07 +0200 Message-ID: <20260530160307.172103308@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-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 @@ -257,6 +257,10 @@ static bool __nested_vmcb_check_controls if (CC((control->nested_ctl & SVM_NESTED_CTL_NP_ENABLE) && !npt_enabled)) 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;