[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174065112192.10177.13367372055996559360.tip-bot2@tip-bot2>
Date: Thu, 27 Feb 2025 10:12:01 -0000
From: "tip-bot2 for Yosry Ahmed" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Yosry Ahmed <yosry.ahmed@...ux.dev>, Ingo Molnar <mingo@...nel.org>,
Jim Mattson <jmattson@...gle.com>, Josh Poimboeuf <jpoimboe@...nel.org>,
Sean Christopherson <seanjc@...gle.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject:
[tip: x86/bugs] KVM: nVMX: Always use IBPB to properly virtualize IBRS
The following commit has been merged into the x86/bugs branch of tip:
Commit-ID: 8c4f28cd81fe86033918eec69d5280b532c05842
Gitweb: https://git.kernel.org/tip/8c4f28cd81fe86033918eec69d5280b532c05842
Author: Yosry Ahmed <yosry.ahmed@...ux.dev>
AuthorDate: Thu, 27 Feb 2025 01:27:11
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Thu, 27 Feb 2025 10:57:21 +01:00
KVM: nVMX: Always use IBPB to properly virtualize IBRS
On synthesized nested VM-exits in VMX, an IBPB is performed if IBRS is
advertised to the guest to properly provide separate prediction domains
for L1 and L2. However, this is currently conditional on
X86_FEATURE_USE_IBPB, which depends on the host spectre_v2_user
mitigation.
In short, if spectre_v2_user=no, IBRS is not virtualized correctly and
L1 becomes susceptible to attacks from L2. Fix this by performing the
IBPB regardless of X86_FEATURE_USE_IBPB.
Fixes: 2e7eab81425a ("KVM: VMX: Execute IBPB on emulated VM-exit when guest has IBRS")
Signed-off-by: Yosry Ahmed <yosry.ahmed@...ux.dev>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Reviewed-by: Jim Mattson <jmattson@...gle.com>
Acked-by: Josh Poimboeuf <jpoimboe@...nel.org>
Acked-by: Sean Christopherson <seanjc@...gle.com>
Link: https://lore.kernel.org/r/20250227012712.3193063-6-yosry.ahmed@linux.dev
---
arch/x86/kvm/vmx/nested.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 1df427a..8a7af02 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -5026,8 +5026,7 @@ void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
* doesn't isolate different VMCSs, i.e. in this case, doesn't provide
* separate modes for L2 vs L1.
*/
- if (guest_cpu_cap_has(vcpu, X86_FEATURE_SPEC_CTRL) &&
- cpu_feature_enabled(X86_FEATURE_USE_IBPB))
+ if (guest_cpu_cap_has(vcpu, X86_FEATURE_SPEC_CTRL))
indirect_branch_prediction_barrier();
/* Update any VMCS fields that might have changed while L2 ran */
Powered by blists - more mailing lists