On Thu, 22 May 2025 18:17:51 -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 > 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. > > [...] Applied 1-3 to kvm-x86 mmio, and 4-5 to 'kvm-x86 no_assignment' (which is based on 'irqs' and includes 'mmio' via a merge, to avoid having the mmio changes depend on the IRQ overhaul). [1/5] KVM: x86: Avoid calling kvm_is_mmio_pfn() when kvm_x86_ops.get_mt_mask is NULL https://github.com/kvm-x86/linux/commit/c126b46e6fa8 [2/5] KVM: x86/mmu: Locally cache whether a PFN is host MMIO when making a SPTE https://github.com/kvm-x86/linux/commit/ffe9d7966d01 [3/5] KVM: VMX: Apply MMIO Stale Data mitigation if KVM maps MMIO into the guest https://github.com/kvm-x86/linux/commit/83ebe7157483 [4/5] Revert "kvm: detect assigned device via irqbypass manager" https://github.com/kvm-x86/linux/commit/ff845e6a84c8 [5/5] VFIO: KVM: x86: Drop kvm_arch_{start,end}_assignment() https://github.com/kvm-x86/linux/commit/bbc13ae593e0 -- https://github.com/kvm-x86/kvm-unit-tests/tree/next