From: Melody Wang <huibo.wang@amd.com>
To: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Cc: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
"Ashish Kalra" <ashish.kalra@amd.com>,
Michael Roth <michael.roth@amd.com>,
"Melody Wang" <huibo.wang@amd.com>
Subject: [PATCH 0/6] SEV-SNP restricted injection hypervisor patches
Date: Wed, 7 Aug 2024 00:57:54 +0000 [thread overview]
Message-ID: <cover.1722989996.git.huibo.wang@amd.com> (raw)
Operating systems may not handle unexpected interrupt or exception sequences.
A malicious hypervisor can inject random interrupt or exception sequences,
putting guest drivers or guest OS kernels into an unexpected state, which could
lead to security issues.
To address this concern, SEV-SNP restricts the injection of interrupts and
exceptions to those only allowed by the guest. Restricted Injection disables
all hypervisor-based interrupt queuing and event injection for all vectors,
allowing only a single vector, #HV (28), which is reserved for SNP guest use
but is never generated by hardware. #HV is only permitted to be injected into
VMSAs that execute with Restricted Injection.
Guests operating with Restricted Injection are expected to communicate with the
hypervisor about events via a software-managed para-virtualization interface.
This interface can utilize #HV injection as a doorbell to inform the guest that
new events have occurred. This patch set implements Restricted Injection on the
KVM side directly into VMPL0.
Overview:
The GHCB 2.0 specification[1] defines #HV doorbell page and the #HV doorbell
page NAE event allows for an SEV-SNP guest to register a doorbell page for use
with the hypervisor injection exception (#HV). When Restricted Injection is
active, only #HV exceptions can be injected into the guest, and the hypervisor
follows the GHCB #HV doorbell communication to inject the exception or
interrupt. Restricted Injection can be enabled by setting the bit in
vmsa_features.
The patchset is rebased on the kvm/next (commit 1773014a975919195be71646fc2c2cad1570fce4).
Testing:
The patchset has been tested with the sev-snp guest, ovmf and qemu supporting
restricted injection.
Four test sets:
1.ls -lr /
2.apt update
3.fio
4.perf
Thanks
Melody
Melody Wang (6):
x86/sev: Define the #HV doorbell page structure
KVM: SVM: Add support for the SEV-SNP #HV doorbell page NAE event
KVM: SVM: Inject #HV when restricted injection is active
KVM: SVM: Inject NMIs when restricted injection is active
KVM: SVM: Inject MCEs when restricted injection is active
KVM: SVM: Enable restricted injection for an SEV-SNP guest
arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/kvm-x86-ops.h | 1 +
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/include/asm/sev-common.h | 1 +
arch/x86/include/asm/svm.h | 41 +++++
arch/x86/include/uapi/asm/kvm.h | 1 +
arch/x86/include/uapi/asm/svm.h | 5 +
arch/x86/kvm/svm/sev.c | 277 ++++++++++++++++++++++++++++-
arch/x86/kvm/svm/svm.c | 44 ++++-
arch/x86/kvm/svm/svm.h | 26 ++-
arch/x86/kvm/vmx/main.c | 1 +
arch/x86/kvm/vmx/vmx.c | 5 +
arch/x86/kvm/vmx/x86_ops.h | 1 +
arch/x86/kvm/x86.c | 7 +
14 files changed, 407 insertions(+), 5 deletions(-)
--
2.34.1
[1] https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56421.pdf
next reply other threads:[~2024-08-07 0:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 0:57 Melody Wang [this message]
2024-08-07 0:57 ` [PATCH 1/6] x86/sev: Define the #HV doorbell page structure Melody Wang
2024-08-07 0:57 ` [PATCH 2/6] KVM: SVM: Add support for the SEV-SNP #HV doorbell page NAE event Melody Wang
2024-08-07 0:57 ` [PATCH 3/6] KVM: SVM: Inject #HV when restricted injection is active Melody Wang
2024-08-07 0:57 ` [PATCH 4/6] KVM: SVM: Inject NMIs " Melody Wang
2024-08-07 1:00 ` Melody Wang
2024-08-07 1:00 ` [PATCH 5/6] KVM: SVM: Inject MCEs " Melody Wang
2024-08-07 23:30 ` kernel test robot
2024-08-07 1:00 ` [PATCH 6/6] KVM: SVM: Enable restricted injection for an SEV-SNP guest Melody Wang
2024-08-07 23:49 ` Thomas Gleixner
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=cover.1722989996.git.huibo.wang@amd.com \
--to=huibo.wang@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.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