mbox series

[v2,0/2] KVM: SVM: Fix an STI shadow on VMRUN bug

Message ID 20250224165442.2338294-1-seanjc@google.com (mailing list archive)
Headers show
Series KVM: SVM: Fix an STI shadow on VMRUN bug | expand

Message

Sean Christopherson Feb. 24, 2025, 4:54 p.m. UTC
Fix a bug where KVM puts VMRUN in an STI shadow, which AMD CPUs bleed
into guest state if a #VMEXIT occurs before completing the VMRUN, e.g.
if vectoring an injected exception triggers an exit.

v2: Use "raw" variants to avoid tracing in noinstr code. [kernel test robot]

v1: https://lore.kernel.org/all/20250215010946.1201353-1-seanjc@google.com

Sean Christopherson (2):
  KVM: SVM: Set RFLAGS.IF=1 in C code, to get VMRUN out of the STI
    shadow
  KVM: selftests: Assert that STI blocking isn't set after event
    injection

 arch/x86/kvm/svm/svm.c                             | 14 ++++++++++++++
 arch/x86/kvm/svm/vmenter.S                         | 10 +---------
 .../selftests/kvm/x86/nested_exceptions_test.c     |  2 ++
 3 files changed, 17 insertions(+), 9 deletions(-)


base-commit: fed48e2967f402f561d80075a20c5c9e16866e53

Comments

Sean Christopherson Feb. 28, 2025, 11:40 p.m. UTC | #1
On Mon, 24 Feb 2025 08:54:40 -0800, Sean Christopherson wrote:
> Fix a bug where KVM puts VMRUN in an STI shadow, which AMD CPUs bleed
> into guest state if a #VMEXIT occurs before completing the VMRUN, e.g.
> if vectoring an injected exception triggers an exit.
> 
> v2: Use "raw" variants to avoid tracing in noinstr code. [kernel test robot]
> 
> v1: https://lore.kernel.org/all/20250215010946.1201353-1-seanjc@google.com
> 
> [...]

Applied to kvm-x86 fixes, thanks!

[1/2] KVM: SVM: Set RFLAGS.IF=1 in C code, to get VMRUN out of the STI shadow
      https://github.com/kvm-x86/linux/commit/be45bc4eff33
[2/2] KVM: selftests: Assert that STI blocking isn't set after event injection
      https://github.com/kvm-x86/linux/commit/f3513a335e71

--
https://github.com/kvm-x86/linux/tree/next