The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Sohil Mehta <sohil.mehta@intel.com>
Cc: <sashiko-reviews@lists.linux.dev>, <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>, Xin Li <xin@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	"Nikunj A Dadhania" <nikunj@amd.com>,
	Shivansh Dhiman <shivansh.dhiman@amd.com>,
	"David Woodhouse" <dwmw@amazon.co.uk>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	"Maciej Wieczor-Retman" <maciej.wieczor-retman@intel.com>,
	"Chang S . Bae" <chang.seok.bae@intel.com>,
	Yosry Ahmed <yosry@kernel.org>,
	David Matlack <dmatlack@google.com>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH 3/4] KVM: VMX: Re-inject an ICEBP #DB as a privileged software exception
Date: Fri, 4 Dec 2026 19:48:31 +0800	[thread overview]
Message-ID: <axKoj_4-YB2OhuHC@intel.com> (raw)
In-Reply-To: <6294e225-2479-4bfc-b4d5-60d290f74009@intel.com>

On Thu, Dec 03, 2026 at 04:25:21PM +0800, Sohil Mehta wrote:
>> [Severity: Medium]
>> Can queueing an ICEBP #DB with a payload and EVENT_TYPE_PRIV_SWEXC corrupt
>> guest state if KVM exits to userspace (for example on a pending signal)
>> before injecting the exception?
>> 
>
>The window seems real. It happens because patch 2 leaves a queued INT1
>out of the vCPU events like INT3 and INTO, but those don't carry a
>payload. So the payload of a #DB that isn't saved still leaks out, to
>userspace or into DR6. However, I don't see how the guest state can be
>corrupted.
>
>My LLM says:
> - Without KVM_CAP_EXCEPTION_PAYLOAD, KVM writes the payload to DR6 when
>   userspace saves the vCPU state. After a restore, the guest
>   re-executes the ICEBP, and the new #DB writes the same DR6 bits
>   again.

I think it can be guest visible. After a restore, if an interrupt is
injected before the guest re-executes the ICEBP, the interrupt handler
can see the wrong DR6.

I am not sure how severe it is, though.

>This isn't really my area of expertise, so I would appreciate feedback
>on this. Does this seem worth fixing?

I think it is worth fixing. It isn't about how much impact a wrong DR6 has.
The logic of delivering the payload early should be explainable, and it
should only apply to hardware exceptions. Software exceptions, including
privileged ones, aren't saved/restored, so there is no reason to deliver
their payload early at all.

  reply	other threads:[~2026-12-04 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  8:02 [PATCH 0/4] KVM: VMX: Handle the #DB of an ICEBP as a privileged software exception Sohil Mehta
2026-12-02  8:02 ` [PATCH 1/4] KVM: x86: Track the event type of a queued exception Sohil Mehta
2026-12-02  8:02 ` [PATCH 2/4] KVM: nVMX: Don't drop an L1-injected INT1 whose delivery is interrupted Sohil Mehta
2026-12-04  9:40   ` Chao Gao
2026-12-02  8:02 ` [PATCH 3/4] KVM: VMX: Re-inject an ICEBP #DB as a privileged software exception Sohil Mehta
     [not found]   ` <sashiko-outbox-245215@kernel.org>
2026-12-03  8:25     ` Sohil Mehta
2026-12-04 11:48       ` Chao Gao [this message]
2026-12-02  8:02 ` [PATCH 4/4] KVM: selftests: Test how L1 sees the #DB of an ICEBP in L2 Sohil Mehta

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=axKoj_4-YB2OhuHC@intel.com \
    --to=chao.gao@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dmatlack@google.com \
    --cc=dwmw@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=mingo@redhat.com \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=seanjc@google.com \
    --cc=shivansh.dhiman@amd.com \
    --cc=skhan@linuxfoundation.org \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    --cc=xin@zytor.com \
    --cc=yosry@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