All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: Hao Zhang <hao_zhang_kdev@163.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: Mark nested RSM-created VM-Enter as untrusted
Date: Tue, 21 Jul 2026 07:42:45 -0700	[thread overview]
Message-ID: <al-E7uwCqS6na41W@google.com> (raw)
In-Reply-To: <20260721062426.C4EB81F000E9@smtp.kernel.org>

On Tue, Jul 21, 2026, sashiko-bot@kernel.org wrote:
> > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> > index 4d2bacd00ec4f..f54757bd83821 100644
> > --- a/arch/x86/kvm/svm/svm.c
> > +++ b/arch/x86/kvm/svm/svm.c
> 
> [ ... ]
> 
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index cc75feec05daa..333072cc9bce4 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -6720,7 +6720,8 @@ static int __vmx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath)
> >  	 * invalid guest state should never happen as that means KVM knowingly
> >  	 * allowed a nested VM-Enter with an invalid vmcs12.  More below.
> >  	 */
> > -	if (KVM_BUG_ON(vcpu->arch.nested_run_pending, vcpu->kvm))
> > +	if (KVM_BUG_ON(vcpu->arch.nested_run_pending == KVM_NESTED_RUN_PENDING,
> > +		       vcpu->kvm))
> >  		return -EIO;
> 
> [Severity: High]
> Does this allow the KVM_NESTED_RUN_PENDING_UNTRUSTED flag to leak and lock up
> the vCPU?
> 
> If a malicious L2 guest modifies SMRAM to create an invalid nested state, then
> executes RSM, vmx_leave_smm() restores this state and sets nested_run_pending
> to KVM_NESTED_RUN_PENDING_UNTRUSTED.

LOL, that is an impressively convoluted hallucination from Sashiko.  SMI is an
unconditional VM-Exit on Intel, and KVM doesn't support emulating parallel SMM,
i.e. it's impossible for L2 to have access to "live" SMRAM.

That said, leaving nested_run_pending set isn't good, and I missed that my
suggested "fix" would require tweaking the above KVM_BUG_ON().  I'll respond to
v3 with an alternative solution.

      reply	other threads:[~2026-07-21 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  6:08 [PATCH v2] KVM: x86: Mark nested RSM-created VM-Enter as untrusted Hao Zhang
2026-07-21  6:24 ` sashiko-bot
2026-07-21 14:42   ` Sean Christopherson [this message]

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=al-E7uwCqS6na41W@google.com \
    --to=seanjc@google.com \
    --cc=hao_zhang_kdev@163.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.