From: Ravi Bangoria <ravi.bangoria@amd.com>
To: <seanjc@google.com>, <pbonzini@redhat.com>, <nikunj.dadhania@amd.com>
Cc: <ravi.bangoria@amd.com>, <thomas.lendacky@amd.com>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
<michael.roth@amd.com>, <pankaj.gupta@amd.com>,
<kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<santosh.shukla@amd.com>
Subject: [PATCH v4 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling
Date: Fri, 31 May 2024 04:46:41 +0000 [thread overview]
Message-ID: <20240531044644.768-1-ravi.bangoria@amd.com> (raw)
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)
v3: https://lore.kernel.org/r/20240523121828.808-1-ravi.bangoria@amd.com
v3->v4:
- Return -EINVAL instead of 0 while preventing MSR accesses post VMSA
encryption.
- Make 'lbrv' a global variable instead of passing it as function
argument, this follows the pattern used by other variables.
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 | 19 ++++++++++++++-----
arch/x86/kvm/svm/svm.c | 42 ++++++++++++++++++++++++++++++++----------
arch/x86/kvm/svm/svm.h | 4 +++-
3 files changed, 49 insertions(+), 16 deletions(-)
--
2.45.1
next reply other threads:[~2024-05-31 4:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 4:46 Ravi Bangoria [this message]
2024-05-31 4:46 ` [PATCH v4 1/3] KVM: SEV-ES: Prevent MSR access post VMSA encryption Ravi Bangoria
2024-05-31 4:46 ` [PATCH v4 2/3] KVM: SEV-ES: Disallow SEV-ES guests when X86_FEATURE_LBRV is absent Ravi Bangoria
2024-05-31 4:46 ` [PATCH v4 3/3] KVM: SEV-ES: Fix LBRV code Ravi Bangoria
2024-06-05 11:48 ` [PATCH] KVM: SNP: Fix LBR Virtualization for SNP guest Ravi Bangoria
2024-06-05 11:50 ` Paolo Bonzini
2024-06-05 11:52 ` Aithal, Srikanth
2024-06-03 17:05 ` [PATCH v4 0/3] KVM: SEV-ES: Fix KVM_{GET|SET}_MSRS and LBRV handling Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240531044644.768-1-ravi.bangoria@amd.com \
--to=ravi.bangoria@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj.dadhania@amd.com \
--cc=pankaj.gupta@amd.com \
--cc=pbonzini@redhat.com \
--cc=santosh.shukla@amd.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox