From: Liam Merwick <liam.merwick@oracle.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Alexander Potapenko <glider@google.com>,
James Houghton <jthoughton@google.com>,
Peter Gonda <pgonda@google.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH 2/2] KVM: SVM: Initialize vmsa_pa in VMCB to INVALID_PAGE if VMSA page is NULL
Date: Wed, 4 Jun 2025 12:15:28 +0100 [thread overview]
Message-ID: <18b86c31-e657-42e7-bca6-ddae52ead231@oracle.com> (raw)
In-Reply-To: <20250602224459.41505-3-seanjc@google.com>
On 02/06/2025 23:44, Sean Christopherson wrote:
> When creating an SEV-ES vCPU for intra-host migration, set its vmsa_pa to
> INVALID_PAGE to harden against doing VMRUN with a bogus VMSA (KVM checks
> for a valid VMSA page in pre_sev_run()).
>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
Tested-by: Liam Merwick <liam.merwick@oracle.com>
> ---
> arch/x86/kvm/svm/sev.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 93d899454535..5ebb265f2075 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -4471,8 +4471,12 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm)
> * the VMSA will be NULL if this vCPU is the destination for intrahost
> * migration, and will be copied later.
> */
> - if (svm->sev_es.vmsa && !svm->sev_es.snp_has_guest_vmsa)
> - svm->vmcb->control.vmsa_pa = __pa(svm->sev_es.vmsa);
> + if (!svm->sev_es.snp_has_guest_vmsa) {
> + if (svm->sev_es.vmsa)
> + svm->vmcb->control.vmsa_pa = __pa(svm->sev_es.vmsa);
> + else
> + svm->vmcb->control.vmsa_pa = INVALID_PAGE;
> + }
>
> /* Can't intercept CR register access, HV can't modify CR registers */
> svm_clr_intercept(svm, INTERCEPT_CR0_READ);
next prev parent reply other threads:[~2025-06-04 11:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 22:44 [PATCH 0/2] KVM: SVM: Fix a NULL VMSA deref with MOVE_ENC_CONTEXT Sean Christopherson
2025-06-02 22:44 ` [PATCH 1/2] KVM: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight Sean Christopherson
2025-06-03 15:21 ` James Houghton
2025-06-03 19:00 ` Sean Christopherson
2025-06-04 11:15 ` Liam Merwick
2025-06-02 22:44 ` [PATCH 2/2] KVM: SVM: Initialize vmsa_pa in VMCB to INVALID_PAGE if VMSA page is NULL Sean Christopherson
2025-06-04 11:15 ` Liam Merwick [this message]
2025-06-04 15:02 ` [PATCH 0/2] KVM: SVM: Fix a NULL VMSA deref with MOVE_ENC_CONTEXT Paolo Bonzini
2025-06-24 19:38 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18b86c31-e657-42e7-bca6-ddae52ead231@oracle.com \
--to=liam.merwick@oracle.com \
--cc=glider@google.com \
--cc=jthoughton@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pgonda@google.com \
--cc=seanjc@google.com \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).