public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: VMX: remove LFENCE in vmx_spec_ctrl_restore_host()
@ 2023-05-31 15:01 Jon Kohler
  2023-05-31 23:18 ` Josh Poimboeuf
  2023-06-01  0:29 ` Andrew Cooper
  0 siblings, 2 replies; 19+ messages in thread
From: Jon Kohler @ 2023-05-31 15:01 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Peter Zijlstra (Intel), Josh Poimboeuf, Pawan Gupta,
	Daniel Sneddon, kvm, linux-kernel
  Cc: Jon Kohler, Andrew Cooper

Remove barrier_nospec(), which translates to LFENCE, in
vmx_spec_ctrl_restore_host() as RSB-barriers (as defined by [1])
already exist prior to this point.

This LFENCE was added on commit fc02735b14ff ("KVM: VMX: Prevent guest
RSB poisoning attacks with eIBRS") in the 5.19 timeframe; however,
commit 2b1299322016 ("x86/speculation: Add RSB VM Exit protections") in
6.0 timeframe added a LFENCE for X86_FEATURE_RSB_VMEXIT_LITE was added
directly in vmx_vmexit, prior to CALL vmx_spec_ctrl_restore_host.

For posterity, vmx_spec_ctrl_restore_host also will execute WRMSR to
IA32_SPEC_CTRL for X86_FEATURE_KERNEL_IBRS or when guest/host MSR value
does not match, which serves as an additional RSB-barrier.

[1] https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/post-barrier-return-stack-buffer-predictions.html

Fixes: fc02735b14ff ("KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS")
Fixes: 2b1299322016 ("x86/speculation: Add RSB VM Exit protections")
Signed-off-by: Jon Kohler <jon@nutanix.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Daniel Sneddon <daniel.sneddon@linux.intel.com>
CC: Josh Poimboeuf <jpoimboe@kernel.org>
CC: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
CC: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 arch/x86/kvm/vmx/vmx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 44fb619803b8..98ca8b79aab1 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7130,8 +7130,6 @@ void noinstr vmx_spec_ctrl_restore_host(struct vcpu_vmx *vmx,
 	if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS) ||
 	    vmx->spec_ctrl != hostval)
 		native_wrmsrl(MSR_IA32_SPEC_CTRL, hostval);
-
-	barrier_nospec();
 }
 
 static fastpath_t vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu)
-- 
2.30.1 (Apple Git-130)


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-06-06  4:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31 15:01 [PATCH] KVM: VMX: remove LFENCE in vmx_spec_ctrl_restore_host() Jon Kohler
2023-05-31 23:18 ` Josh Poimboeuf
2023-05-31 23:58   ` Jon Kohler
2023-06-01  0:42     ` Josh Poimboeuf
2023-06-01  0:50       ` Andrew Cooper
2023-06-01  0:56         ` Josh Poimboeuf
2023-06-01  1:24         ` Pawan Gupta
2023-06-01  4:23           ` Josh Poimboeuf
2023-06-05 14:29             ` Jon Kohler
2023-06-05 16:35               ` Josh Poimboeuf
2023-06-05 16:39                 ` Jon Kohler
2023-06-05 17:31                   ` Pawan Gupta
2023-06-05 18:31                     ` Sean Christopherson
2023-06-05 19:57                       ` Jon Kohler
2023-06-05 20:01                       ` Josh Poimboeuf
2023-06-06  0:20                 ` Andrew Cooper
2023-06-06  3:59                   ` Josh Poimboeuf
2023-06-01  0:29 ` Andrew Cooper
2023-06-01  0:53   ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox