linux/arch/x86/kvm
Rick Edgecombe f2fde6a5bc KVM: VMX: Move RSB stuffing to before the first RET after VM-Exit
The not-so-recent change to move VMX's VM-Exit handing to a dedicated
"function" unintentionally exposed KVM to a speculative attack from the
guest by executing a RET prior to stuffing the RSB.  Make RSB stuffing
happen immediately after VM-Exit, before any unpaired returns.

Alternatively, the VM-Exit path could postpone full RSB stuffing until
its current location by stuffing the RSB only as needed, or by avoiding
returns in the VM-Exit path entirely, but both alternatives are beyond
ugly since vmx_vmexit() has multiple indirect callers (by way of
vmx_vmenter()).  And putting the RSB stuffing immediately after VM-Exit
makes it much less likely to be re-broken in the future.

Note, the cost of PUSH/POP could be avoided in the normal flow by
pairing the PUSH RAX with the POP RAX in __vmx_vcpu_run() and adding an
a POP to nested_vmx_check_vmentry_hw(), but such a weird/subtle
dependency is likely to cause problems in the long run, and PUSH/POP
will take all of a few cycles, which is peanuts compared to the number
of cycles required to fill the RSB.

Fixes: 453eafbe65 ("KVM: VMX: Move VM-Enter + VM-Exit handling to non-inline sub-routines")
Reported-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Co-developed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-04-27 09:48:52 +02:00
..
vmx KVM: VMX: Move RSB stuffing to before the first RET after VM-Exit 2019-04-27 09:48:52 +02:00
cpuid.c ARM: some cleanups, direct physical timer assignment, cache sanitization 2019-03-15 15:00:28 -07:00
cpuid.h
debugfs.c
emulate.c KVM: x86: Always use 32-bit SMRAM save state for 32-bit kernels 2019-04-16 15:37:38 +02:00
hyperv.c x86: kvm: hyper-v: deal with buggy TLB flush requests from WS2012 2019-04-18 18:53:18 +02:00
hyperv.h x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID 2018-12-14 17:59:54 +01:00
i8254.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
i8254.h
i8259.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
ioapic.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
ioapic.h
irq.c
irq.h
irq_comm.c
Kconfig treewide: surround Kconfig file paths with double quotes 2018-12-22 00:25:54 +09:00
kvm_cache_regs.h KVM: x86: Add requisite includes to kvm_cache_regs.h 2018-12-14 12:34:22 +01:00
lapic.c KVM: lapic: Convert guest TSC to host time domain if necessary 2019-04-18 18:56:30 +02:00
lapic.h KVM: lapic: Allow user to disable adaptive tuning of timer advancement 2019-04-18 18:56:15 +02:00
Makefile KVM: x86: fix TRACE_INCLUDE_PATH and remove -I. header search paths 2019-01-25 19:12:37 +01:00
mmu.c kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-04-16 15:37:30 +02:00
mmu.h kvm: mmu: Fix overflow on kvm mmu page limit calculation 2019-04-16 15:37:30 +02:00
mmu_audit.c x86/kvm/mmu: make vcpu->mmu a pointer to the current MMU 2018-10-17 00:30:02 +02:00
mmutrace.h KVM: x86: fix handling of role.cr4_pae and rename it to 'gpte_size' 2019-03-28 17:27:03 +01:00
mtrr.c
page_track.c kvm: x86: Add memcg accounting to KVM allocations 2019-02-20 22:48:30 +01:00
paging_tmpl.h KVM: Replace old tlb flush function with new one to flush a specified range. 2018-12-21 11:28:41 +01:00
pmu.c KVM: x86: Raise #GP when guest vCPU do not support PMU 2019-04-16 15:37:34 +02:00
pmu.h
pmu_amd.c
svm.c KVM: x86: clear SMM flags before loading state while leaving SMM 2019-04-16 15:37:36 +02:00
trace.h KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing 2019-04-16 15:38:08 +02:00
tss.h
x86.c KVM: lapic: Allow user to disable adaptive tuning of timer advancement 2019-04-18 18:56:15 +02:00
x86.h KVM: lapic: Track lapic timer advance per vCPU 2019-04-18 18:55:41 +02:00