Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: syzbot <syzbot@kernel.org>, kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: x86: Exempt in-kernel PIC from "disappearing" interrupt warning
Date: Tue, 7 Jul 2026 14:25:35 -0700	[thread overview]
Message-ID: <ak1uzySYz-i1EImO@google.com> (raw)
In-Reply-To: <20260625212001.3B6561F000E9@smtp.kernel.org>

On Thu, Jun 25, 2026, sashiko-bot@kernel.org wrote:
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> [ ... ]
> > @@ -10857,7 +10857,9 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
> >  		if (r) {
> >  			int irq = kvm_cpu_get_interrupt(vcpu);
> >  
> > -			if (!WARN_ON_ONCE(irq == -1)) {
> > +			WARN_ON_ONCE(irq == -1 && !pic_in_kernel(vcpu->kvm));
> 
> [Severity: Medium]
> Does this inadvertently suppress the warning for APIC bugs in the default
> full-irqchip mode?
> 
> Since pic_in_kernel() evaluates to true when the in-kernel PIC is present,
> checking !pic_in_kernel() disables the warning entirely for all interrupt
> sources in that configuration. This appears to contradict the commit message
> intent of preserving the warning for other sources like the APIC.
> 
> [Severity: High]
> This is a pre-existing issue, but can a malicious guest still trigger this
> warning when KVM is configured with a split irqchip and Xen emulation is
> enabled?

Argh, yes.  

> If a guest concurrently toggles its evtchn_upcall_pending flag in memory
> while the host executes the event injection loop, it seems this path is
> directly reachable. 

Even more coarsely, userspace could disable Xen event stuff entirely via
KVM_XEN_HVM_CONFIG.  The easiest fix would be to condition the WARN on
!IS_ENABLED(CONFIG_KVM_XEN).  We could track if the VM has ever used Xen
emulation, but I don't think that's worth doing given that many deployments can
and should disable Xen emulation.

The other annoying issue is that vmx_check_nested_events() has the same flaw.
And I definitely don't want to toss that WARN either, because it recently found
a real bug that actually matters.

I'll send a v2 in the near-ish future to weed out CONFIG_KVM_XEN, and fix the
nVMX case as well, hopefully without having to duplicate too much code.

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25 21:10 [PATCH v2] KVM: x86: Exempt in-kernel PIC from "disappearing" interrupt warning syzbot
2026-06-25 21:20 ` sashiko-bot
2026-07-07 21:25   ` Sean Christopherson [this message]
2026-06-25 22:34 ` Aleksandr Nogikh
2026-06-25 22: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=ak1uzySYz-i1EImO@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=syzbot@kernel.org \
    /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