[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e3j5qgrdjad7ura7kodfzcagynvrkxv227ddg3jfjknzewvyay@h5pb67muiycd>
Date: Thu, 22 Jan 2026 01:28:01 +0000
From: Yosry Ahmed <yosry.ahmed@...ux.dev>
To: Jim Mattson <jmattson@...gle.com>
Cc: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Shuah Khan <shuah@...nel.org>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v2 2/8] KVM: x86: nSVM: Cache g_pat in
vmcb_save_area_cached
On Thu, Jan 15, 2026 at 03:21:41PM -0800, Jim Mattson wrote:
> To avoid TOCTTOU issues, all fields in the vmcb12 save area that are
> subject to validation must be copied to svm->nested.save prior to
> validation, since vmcb12 is writable by the guest. Add g_pat to this set in
> preparation for validting it.
>
> Fixes: 3d6368ef580a ("KVM: SVM: Add VMRUN handler")
g_pat is not currently used from VMCB12, so this patch isn't technically
fixing an issue, right? I suspect this only applies to patch 3.
Anyway, I think it's probably best to squash this into patch 3. Also
maybe CC stable?
> Signed-off-by: Jim Mattson <jmattson@...gle.com>
If you decide to keep this as an individual patch, feel free to add:
Reviewed-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
> ---
> arch/x86/kvm/svm/nested.c | 2 ++
> arch/x86/kvm/svm/svm.h | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index f295a41ec659..07a57a43fc3b 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -506,6 +506,8 @@ static void __nested_copy_vmcb_save_to_cache(struct vmcb_save_area_cached *to,
>
> to->dr6 = from->dr6;
> to->dr7 = from->dr7;
> +
> + to->g_pat = from->g_pat;
> }
>
> void nested_copy_vmcb_save_to_cache(struct vcpu_svm *svm,
> diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h
> index 7d28a739865f..39138378531e 100644
> --- a/arch/x86/kvm/svm/svm.h
> +++ b/arch/x86/kvm/svm/svm.h
> @@ -145,6 +145,7 @@ struct vmcb_save_area_cached {
> u64 cr0;
> u64 dr7;
> u64 dr6;
> + u64 g_pat;
> };
>
> struct vmcb_ctrl_area_cached {
> --
> 2.52.0.457.g6b5491de43-goog
>
Powered by blists - more mailing lists