From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: seanjc@google.com, xinyang@anthropic.com
Subject: [PATCH 0/5] KVM: x86: check validity of nested state when returning from SMM
Date: Tue, 10 Mar 2026 21:24:09 +0100 [thread overview]
Message-ID: <20260310202414.406078-1-pbonzini@redhat.com> (raw)
The VMCS/VMCB state for a suspended L2 guest can become invalid while
the L1 guest is in SMM, for example via changes to the eVMCS or to the
in-memory image of the VMCB. On Intel systems this can also happen via
KVM_SET_NESTED_STATE with KVM_STATE_NESTED_SMM_GUEST_MODE and a
corrupted VMCS12 image (kvm-amd.ko stores the flag in memory rather
than out of band, so it's not affected).
Because of this, nested state has to be checked for validity when
RSM is executed and would re-enter L2. The existing checks already
exist as part of KVM_SET_NESTED_STATE (the other "not your usual
VMLAUNCH/VMRESUME/VMRUN" path that performs a nested vmentry),
so extract them to new functions and move them to the leave_smm
callback.
Paolo
Paolo Bonzini (5):
KVM: VMX: check validity of VMCS controls when returning from SMM
KVM: SVM: check validity of VMCB when returning from SMM
selftests: kvm: extract common functionality out of smm_test.c
selftests: kvm: add a test that VMX validates controls on RSM
KVM: x86: clarify leave_smm() return value
arch/x86/kvm/svm/nested.c | 12 +-
arch/x86/kvm/svm/svm.c | 8 +-
arch/x86/kvm/svm/svm.h | 1 +
arch/x86/kvm/vmx/nested.c | 39 +++--
arch/x86/kvm/vmx/nested.h | 1 +
arch/x86/kvm/vmx/vmx.c | 8 +-
tools/testing/selftests/kvm/Makefile.kvm | 1 +
tools/testing/selftests/kvm/include/x86/smm.h | 17 ++
.../testing/selftests/kvm/lib/x86/processor.c | 26 +++
.../kvm/x86/evmcs_smm_controls_test.c | 150 ++++++++++++++++++
tools/testing/selftests/kvm/x86/smm_test.c | 27 +---
11 files changed, 247 insertions(+), 43 deletions(-)
create mode 100644 tools/testing/selftests/kvm/include/x86/smm.h
create mode 100644 tools/testing/selftests/kvm/x86/evmcs_smm_controls_test.c
--
2.53.0
next reply other threads:[~2026-03-10 20:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 20:24 Paolo Bonzini [this message]
2026-03-10 20:24 ` [PATCH 1/5] KVM: VMX: check validity of VMCS controls " Paolo Bonzini
2026-03-10 20:24 ` [PATCH 2/5] KVM: SVM: check validity of VMCB " Paolo Bonzini
2026-03-10 21:37 ` Yosry Ahmed
2026-03-10 21:45 ` Sean Christopherson
2026-03-10 21:46 ` Yosry Ahmed
2026-03-11 16:53 ` Paolo Bonzini
2026-03-10 20:24 ` [PATCH 3/5] selftests: kvm: extract common functionality out of smm_test.c Paolo Bonzini
2026-03-10 20:24 ` [PATCH 4/5] selftests: kvm: add a test that VMX validates controls on RSM Paolo Bonzini
2026-03-10 20:24 ` [PATCH 5/5] KVM: x86: clarify leave_smm() return value 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=20260310202414.406078-1-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--cc=xinyang@anthropic.com \
/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
all inboxes | Powered by JetHome®