Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: TDX: Synthesize SHUTDOWN instead of returning -EIO on unhandled EPT violation
Date: Wed, 23 Sep 2026 10:13:41 -0700	[thread overview]
Message-ID: <arQIxfjw-2s-vsVL@google.com> (raw)
In-Reply-To: <20260923164348.2DB2D1F000FF@smtp.kernel.org>

On Wed, Sep 23, 2026, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] kvm: tdx: host log spam via repeated KVM_RUN on unhandled EPT violation
> --
> 
> commit 8eacf1c465f7e8b6cb99f1f4dae3c4af3bcde33c
> Author: Sean Christopherson <seanjc@google.com>
> 
> KVM: TDX: Synthesize SHUTDOWN instead of returning -EIO on unhandled EPT violation
> 
> This commit synthesizes a triple fault instead of returning -EIO when KVM
> encounters an EPT Violation from a guest accessing a pending page. This gives
> userspace the option to keep the VM alive or reboot it, rather than treating
> the situation as a fatal KVM bug.
> 
> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index 7173ef3fc398e..eb82f739a7c04 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> [ ... ]
> > @@ -1938,8 +1938,8 @@ static int tdx_handle_ept_violation(struct kvm_vcpu *vcpu)
> >  		if (tdx_is_sept_violation_unexpected_pending(vcpu)) {
> >  			pr_warn("Guest access before accepting 0x%llx on vCPU %d\n",
> >  				gpa, vcpu->vcpu_id);
> > -			kvm_vm_dead(vcpu->kvm);
> > -			return -EIO;
> > +			kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
> > +			return 1;
> 
> [Severity: High]
> Will this change allow a malicious or buggy userspace VMM to flood the host
> kernel log?

Well, a malicious VMM could already spam the logs, e.g. by creating a new VM or
or spinning up a huge number of VMs.  I.e. this is a pre-existing issue.  But I
agree that it should be ratelimited (or maybe converted to vcpu_debug_ratelimited()?).

> By replacing kvm_vm_dead() with KVM_REQ_TRIPLE_FAULT and returning 1, KVM
> will clear the request during vcpu_enter_guest() and exit to userspace with
> KVM_EXIT_SHUTDOWN. If the VMM ignores this exit and repeatedly calls KVM_RUN
> without resetting the vCPU, KVM will immediately re-enter the guest.
> 
> The guest will hit the exact same unexpected SEPT violation in
> tdx_handle_ept_violation(), triggering this unconditional pr_warn() again.
> This can create an infinite loop that spams dmesg.
> 
> >  		}
> >  		/*
> >  		 * Always treat SEPT violations as write faults.  Ignore the
> [ ... ]
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260923163315.1580860-1-seanjc@google.com?part=1

  reply	other threads:[~2026-09-23 17:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 16:33 [PATCH] KVM: TDX: Synthesize SHUTDOWN instead of returning -EIO on unhandled EPT violation Sean Christopherson
2026-09-23 16:43 ` sashiko-bot
2026-09-23 17:13   ` Sean Christopherson [this message]
2026-09-23 23:29 ` Edgecombe, Rick P
2026-09-23 23:51   ` Sean Christopherson
2026-09-24  0:31     ` Edgecombe, Rick P
2026-09-24  1:39 ` Xiaoyao Li
2026-09-24 14:13   ` Sean Christopherson
2026-09-24 14:40     ` Xiaoyao Li
2026-09-24 16:03       ` 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=arQIxfjw-2s-vsVL@google.com \
    --to=seanjc@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox