linux-stable/arch/x86/kvm
Pawan Gupta 15006289e5 x86/vmscape: Add conditional IBPB mitigation
Commit 2f8f173413 upstream.

VMSCAPE is a vulnerability that exploits insufficient branch predictor
isolation between a guest and a userspace hypervisor (like QEMU). Existing
mitigations already protect kernel/KVM from a malicious guest. Userspace
can additionally be protected by flushing the branch predictors after a
VMexit.

Since it is the userspace that consumes the poisoned branch predictors,
conditionally issue an IBPB after a VMexit and before returning to
userspace. Workloads that frequently switch between hypervisor and
userspace will incur the most overhead from the new IBPB.

This new IBPB is not integrated with the existing IBPB sites. For
instance, a task can use the existing speculation control prctl() to
get an IBPB at context switch time. With this implementation, the
IBPB is doubled up: one at context switch and another before running
userspace.

The intent is to integrate and optimize these cases post-embargo.

[ dhansen: elaborate on suboptimal IBPB solution ]

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-11 17:19:15 +02:00
..
mmu KVM: nSVM: Enter guest mode before initializing nested NPT MMU 2025-02-21 13:50:01 +01:00
svm KVM: x86: Drop kvm_x86_ops.set_dr6() in favor of a new KVM_RUN flag 2025-08-28 16:25:50 +02:00
vmx KVM: VMX: Flush shadow VMCS on emergency reboot 2025-08-28 16:26:13 +02:00
.gitignore
cpuid.c KVM: SVM: Advertise TSA CPUID bits to guests 2025-07-10 15:59:54 +02:00
cpuid.h KVM: x86: Cache CPUID.0xD XSTATE offsets+sizes during module init 2024-12-27 13:52:55 +01:00
debugfs.c
emulate.c
fpu.h
hyperv.c KVM: x86/pmu: Gate all "unimplemented MSR" prints on report_ignored_msrs 2025-08-28 16:25:49 +02:00
hyperv.h
i8254.c
i8254.h
i8259.c
ioapic.c
ioapic.h
irq_comm.c
irq.c
irq.h
Kconfig
kvm_cache_regs.h
kvm_emulate.h
kvm_onhyperv.c
kvm_onhyperv.h
kvm-asm-offsets.c
lapic.c KVM: x86: use array_index_nospec with indices that come from guest 2025-09-04 15:26:29 +02:00
lapic.h KVM: nVMX: Defer SVI update to vmcs01 on EOI when L2 is active w/o VID 2025-08-28 16:25:49 +02:00
Makefile
mmu.h
mtrr.c
pmu.c
pmu.h
reverse_cpuid.h KVM: SVM: Advertise TSA CPUID bits to guests 2025-07-10 15:59:54 +02:00
trace.h KVM: x86: Plumb "force_immediate_exit" into kvm_entry() tracepoint 2025-08-28 16:25:50 +02:00
tss.h
x86.c x86/vmscape: Add conditional IBPB mitigation 2025-09-11 17:19:15 +02:00
x86.h KVM: x86/pmu: Gate all "unimplemented MSR" prints on report_ignored_msrs 2025-08-28 16:25:49 +02:00
xen.c KVM: x86/xen: Allow 'out of range' event channel ports in IRQ routing table. 2025-07-17 18:32:07 +02:00
xen.h