public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling
@ 2024-05-23 12:18 Ravi Bangoria
  2024-05-23 12:18 ` [PATCH v3 1/3] KVM: SEV-ES: Prevent MSR access post VMSA encryption Ravi Bangoria
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ravi Bangoria @ 2024-05-23 12:18 UTC (permalink / raw)
  To: seanjc, pbonzini, nikunj.dadhania
  Cc: ravi.bangoria, thomas.lendacky, tglx, mingo, bp, dave.hansen, x86,
	hpa, michael.roth, pankaj.gupta, kvm, linux-kernel,
	santosh.shukla

Fix couple of interrelated issues:

o KVM currently allows userspace to access MSRs even after the VMSA is
  encrypted. This can result into issues if MSR update has side effects on
  VM configuration. Patch 1 fixes that by preventing KVM_{GET|SET}_MSRS
  for SEV-ES guests once VMSA is encrypted.

o As documented in APM, LBR Virtualization must be enabled for SEV-ES
  guests. However, KVM currently enables LBRV unconditionally without
  checking feature bit, which is wrong. Patch 2 prevents SEV-ES guests
  when LBRV support is missing.

o Although LBRV is enabled for SEV-ES guests, MSR_IA32_DEBUGCTLMSR was
  still intercepted. This can crash SEV-ES guest if used inadvertently.
  Patch 3 fixes it.

Patches prepared on kvm/next (6f627b425378)

v2: https://lore.kernel.org/r/20240416050338.517-1-ravi.bangoria@amd.com
v2->v3: Fix all affiliated issues along with fixing MSR_IA32_DEBUGCTLMSR
   interception:
 - Block KVM_{GET|SET}_MSRS for SEV-ES guests post VMSA encryption (new)
 - Block SEV-ES guest creation when LBRV is disabled/not supported (new)
 - Move LBRV enablement code after VMSA encryption to avoid a scenario
   where LBRV can be disabled inadvertently through MSR_IA32_DEBUGCTLMSR
   write. (new)
 - Removed all 'Reviewed-by' since the code has changed quite a bit.

Nikunj A Dadhania (1):
  KVM: SEV-ES: Prevent MSR access post VMSA encryption

Ravi Bangoria (2):
  KVM: SEV-ES: Disallow SEV-ES guests when X86_FEATURE_LBRV is absent
  KVM: SEV-ES: Fix LBRV code

 arch/x86/kvm/svm/sev.c | 21 +++++++++++++++------
 arch/x86/kvm/svm/svm.c | 42 ++++++++++++++++++++++++++++++++----------
 arch/x86/kvm/svm/svm.h |  7 ++++---
 3 files changed, 51 insertions(+), 19 deletions(-)

-- 
2.45.1


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

end of thread, other threads:[~2024-06-04 23:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 12:18 [PATCH v3 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling Ravi Bangoria
2024-05-23 12:18 ` [PATCH v3 1/3] KVM: SEV-ES: Prevent MSR access post VMSA encryption Ravi Bangoria
2024-05-28 16:31   ` Paolo Bonzini
2024-05-29 10:44     ` Ravi Bangoria
2024-06-04 23:10       ` Michael Roth
2024-05-23 12:18 ` [PATCH v3 2/3] KVM: SEV-ES: Disallow SEV-ES guests when X86_FEATURE_LBRV is absent Ravi Bangoria
2024-05-28 16:33   ` Paolo Bonzini
2024-05-29 10:43     ` Ravi Bangoria
2024-05-23 12:18 ` [PATCH v3 3/3] KVM: SEV-ES: Fix LBRV code Ravi Bangoria
2024-05-30 14:03   ` Tom Lendacky
2024-05-31  4:06     ` Ravi Bangoria

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