]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM/VMX: Move VERW closer to VMentry for MDS mitigation
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>
Mon, 4 Mar 2024 05:08:54 +0000 (21:08 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:48:44 +0000 (14:48 +0000)
commite81742f6e2eb1e2c62b766ee4546b2b7961d2db8
tree7ff007c6e0f2dfe2f1bb26a26457de6cb1ee563e
parentae46691220f736ee11aed25bb746fdfe4c90170b
KVM/VMX: Move VERW closer to VMentry for MDS mitigation

commit 43fb862de8f628c5db5e96831c915b9aebf62d33 upstream.

During VMentry VERW is executed to mitigate MDS. After VERW, any memory
access like register push onto stack may put host data in MDS affected
CPU buffers. A guest can then use MDS to sample host data.

Although likelihood of secrets surviving in registers at current VERW
callsite is less, but it can't be ruled out. Harden the MDS mitigation
by moving the VERW mitigation late in VMentry path.

Note that VERW for MMIO Stale Data mitigation is unchanged because of
the complexity of per-guest conditional VERW which is not easy to handle
that late in asm with no GPRs available. If the CPU is also affected by
MDS, VERW is unconditionally executed late in asm regardless of guest
having MMIO access.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/all/20240213-delay-verw-v8-6-a6216d83edb7%40linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/vmx/vmenter.S
arch/x86/kvm/vmx/vmx.c