From: Sean Christopherson <seanjc@google.com>
To: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Borislav Petkov <bp@alien8.de>,
Jim Mattson <jmattson@google.com>
Subject: Re: [PATCH 0/5] KVM: VMX: Fix MMIO Stale Data Mitigation
Date: Mon, 2 Jun 2025 16:41:35 -0700 [thread overview]
Message-ID: <aD42rwMoJ0gh5VBy@google.com> (raw)
In-Reply-To: <20250529033546.dhf3ittxsc3qcysc@desk>
On Wed, May 28, 2025, Pawan Gupta wrote:
> On Thu, May 22, 2025 at 06:17:51PM -0700, Sean Christopherson wrote:
> > Fix KVM's mitigation of the MMIO Stale Data bug, as the current approach
> > doesn't actually detect whether or not a guest has access to MMIO. E.g.
> > KVM_DEV_VFIO_FILE_ADD is entirely optional, and obviously only covers VFIO
>
> I believe this needs userspace co-operation?
Yes, more or less. If the userspace VMM knows it doesn't need to trigger the
side effects of KVM_DEV_VFIO_FILE_ADD (e.g. isn't dealing with non-coherent DMA),
and doesn't need the VFIO<=>KVM binding (e.g. for KVM-GT), then AFAIK it's safe
to skip KVM_DEV_VFIO_FILE_ADD, modulo this mitigation.
> > devices, and so is a terrible heuristic for "can this vCPU access MMIO?"
> >
> > To fix the flaw (hopefully), track whether or not a vCPU has access to MMIO
> > based on the MMU it will run with. KVM already detects host MMIO when
> > installing PTEs in order to force host MMIO to UC (EPT bypasses MTRRs), so
> > feeding that information into the MMU is rather straightforward.
> >
> > Note, I haven't actually verified this mitigates the MMIO Stale Data bug, but
> > I think it's safe to say no has verified the existing code works either.
>
> Mitigation was verifed for VFIO devices, but ofcourse not for the cases you
> mentioned above. Typically, it is the PCI config registers on some faulty
> devices (that don't respect byte-enable) are subject to MMIO Stale Data.
>
> But, it is impossible to test and confirm with absolute certainity that all
Yeah, no argument there.
> other cases are not affected. Your patches should rule out those cases as
> well.
>
> Regarding validating this, if VERW is executed at VMenter, mitigation was
> found to be effective. This is similar to other bugs like MDS. I am not a
> virtualization expert, but I will try to validate whatever I can.
If you can re-verify the mitigation works for VFIO devices, that's more than
good enough for me. The bar at this point is to not regress the existing mitigation,
anything beyond that is gravy.
I've verified the KVM mechanics of tracing MMIO mappings fairly well (famous last
words), the only thing I haven't sanity checked is that the existing coverage for
VFIO devices is maintained.
next prev parent reply other threads:[~2025-06-02 23:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 1:17 [PATCH 0/5] KVM: VMX: Fix MMIO Stale Data Mitigation Sean Christopherson
2025-05-23 1:17 ` [PATCH 1/5] KVM: x86: Avoid calling kvm_is_mmio_pfn() when kvm_x86_ops.get_mt_mask is NULL Sean Christopherson
2025-05-23 1:17 ` [PATCH 2/5] KVM: x86/mmu: Locally cache whether a PFN is host MMIO when making a SPTE Sean Christopherson
2025-05-23 1:17 ` [PATCH 3/5] KVM: VMX: Apply MMIO Stale Data mitigation if KVM maps MMIO into the guest Sean Christopherson
2025-05-29 4:27 ` Pawan Gupta
2025-05-29 22:19 ` Sean Christopherson
2025-05-29 23:40 ` Pawan Gupta
2025-06-02 23:45 ` Sean Christopherson
2025-06-03 1:29 ` Pawan Gupta
2025-05-23 1:17 ` [PATCH 4/5] Revert "kvm: detect assigned device via irqbypass manager" Sean Christopherson
2025-05-23 1:17 ` [PATCH 5/5] VFIO: KVM: x86: Drop kvm_arch_{start,end}_assignment() Sean Christopherson
2025-05-29 3:36 ` [PATCH 0/5] KVM: VMX: Fix MMIO Stale Data Mitigation Pawan Gupta
2025-06-02 23:41 ` Sean Christopherson [this message]
2025-06-03 1:22 ` Pawan Gupta
2025-06-07 2:52 ` Pawan Gupta
2025-06-25 22:25 ` 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=aD42rwMoJ0gh5VBy@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.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).