linux_dsm_epyc7002/arch/x86/kvm/vmx
Sean Christopherson 4af7715110 KVM: x86/mmu: Add explicit access mask for MMIO SPTEs
When shadow paging is enabled, KVM tracks the allowed access type for
MMIO SPTEs so that it can do a permission check on a MMIO GVA cache hit
without having to walk the guest's page tables.  The tracking is done
by retaining the WRITE and USER bits of the access when inserting the
MMIO SPTE (read access is implicitly allowed), which allows the MMIO
page fault handler to retrieve and cache the WRITE/USER bits from the
SPTE.

Unfortunately for EPT, the mask used to retain the WRITE/USER bits is
hardcoded using the x86 paging versions of the bits.  This funkiness
happens to work because KVM uses a completely different mask/value for
MMIO SPTEs when EPT is enabled, and the EPT mask/value just happens to
overlap exactly with the x86 WRITE/USER bits[*].

Explicitly define the access mask for MMIO SPTEs to accurately reflect
that EPT does not want to incorporate any access bits into the SPTE, and
so that KVM isn't subtly relying on EPT's WX bits always being set in
MMIO SPTEs, e.g. attempting to use other bits for experimentation breaks
horribly.

Note, vcpu_match_mmio_gva() explicits prevents matching GVA==0, and all
TDP flows explicit set mmio_gva to 0, i.e. zeroing vcpu->arch.access for
EPT has no (known) functional impact.

[*] Using WX to generate EPT misconfigurations (equivalent to reserved
    bit page fault) ensures KVM can employ its MMIO page fault tricks
    even platforms without reserved address bits.

Fixes: ce88decffd ("KVM: MMU: mmio page fault support")
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-08-22 10:09:24 +02:00
..
capabilities.h KVM: VMX: Include architectural defs header in capabilities.h 2019-04-30 21:32:21 +02:00
evmcs.c x86/kvm/nVMX: fix VMCLEAR when Enlightened VMCS is in use 2019-07-02 18:56:00 +02:00
evmcs.h x86/kvm/nVMX: fix VMCLEAR when Enlightened VMCS is in use 2019-07-02 18:56:00 +02:00
nested.c KVM: nVMX: Set cached_vmcs12 and cached_shadow_vmcs12 NULL after free 2019-07-22 13:55:49 +02:00
nested.h KVM: nVMX: Use descriptive names for VMCS sync functions and flags 2019-06-18 11:46:06 +02:00
ops.h KVM: VMX: remove unneeded 'asm volatile ("")' from vmcs_write64 2019-06-05 14:14:49 +02:00
pmu_intel.c KVM: x86/vPMU: reset pmc->counter to 0 for pmu fixed_counters 2019-07-17 12:23:20 +02:00
vmcs12.c KVM: nVMX: Move vmcs12 code to dedicated files 2018-12-14 12:34:30 +01:00
vmcs12.h KVM/arm updates for 5.3 2019-07-11 15:14:16 +02:00
vmcs_shadow_fields.h KVM: nVMX: shadow pin based execution controls 2019-06-18 17:10:50 +02:00
vmcs.h KVM: VMX: Leave preemption timer running when it's disabled 2019-06-18 17:10:46 +02:00
vmenter.S x86/kvm: Replace vmx_vmenter()'s call to kvm_spurious_fault() with UD2 2019-07-18 21:01:03 +02:00
vmx.c KVM: x86/mmu: Add explicit access mask for MMIO SPTEs 2019-08-22 10:09:24 +02:00
vmx.h KVM: VMX: Explicitly initialize controls shadow at VMCS allocation 2019-06-18 11:47:44 +02:00