From: Jim Mattson Date: Wed, 31 Dec 2025 14:39:17 +0000 (-0500) Subject: KVM: SVM: Mark VMCB_NPT as dirty on nested VMRUN X-Git-Tag: v5.15.198~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=610ef5893628311d14643a0b2df02229902d1eeb;p=thirdparty%2Fkernel%2Fstable.git KVM: SVM: Mark VMCB_NPT as dirty on nested VMRUN [ Upstream commit 7c8b465a1c91f674655ea9cec5083744ec5f796a ] Mark the VMCB_NPT bit as dirty in nested_vmcb02_prepare_save() on every nested VMRUN. If L1 changes the PAT MSR between two VMRUN instructions on the same L1 vCPU, the g_pat field in the associated vmcb02 will change, and the VMCB_NPT clean bit should be cleared. Fixes: 4bb170a5430b ("KVM: nSVM: do not mark all VMCB02 fields dirty on nested vmexit") Cc: stable@vger.kernel.org Signed-off-by: Jim Mattson Link: https://lore.kernel.org/r/20250922162935.621409-3-jmattson@google.com Signed-off-by: Sean Christopherson [ adapted vmcb02 local variable to svm->vmcb direct access pattern ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index ca4a6311bac9c..4ce2bef00e406 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -456,6 +456,7 @@ static void nested_vmcb02_prepare_save(struct vcpu_svm *svm, struct vmcb *vmcb12 bool new_vmcb12 = false; nested_vmcb02_compute_g_pat(svm); + vmcb_mark_dirty(svm->vmcb, VMCB_NPT); /* Load the nested guest state */ if (svm->nested.vmcb12_gpa != svm->nested.last_vmcb12_gpa) {