From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Long Li <longli@microsoft.com>
Cc: kvm@vger.kernel.org, linux-hyperv@vger.kernel.org,
linux-kernel@vger.kernel.org, Jim Mattson <jmattson@google.com>,
Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: [PATCH v2 0/8] KVM: SVM: Fix exit_code bugs
Date: Tue, 30 Dec 2025 13:13:39 -0800 [thread overview]
Message-ID: <20251230211347.4099600-1-seanjc@google.com> (raw)
Fix (mostly benign) bugs in SVM where KVM treats exit codes as 32-bit values
instead of 64-bit values.
The most dangerous aspect of the mess is that simply fixing KVM would likely
break KVM-on-KVM setups if only L1 is patched. To try and avoid such
breakage while also fixing KVM, I opted to have KVM retain its checks on
only bits 31:0 if KVM is running as a VM (as detected by
X86_FEATURE_HYPERVISOR).
v2:
- Drop the nSVM #VMEXIT fixes (already merged).
- Collect reviews. [Yosry]
- Fix inverted svm_is_vmrun_failure() check. [Yosry]
- Use __print_symbolic_u64() and __print_flags_u64() in tracepoints. [Test Bot]
- Track exit_code as a u64 in KVM selftests.
- Make HV_SVM_EXITCODE_ENL an ull like everything else. [Michael]
- Add a compile-time assertion to verify HV_SVM_EXITCODE_ENL == SVM_EXIT_SW.
v1: https://lore.kernel.org/all/20251113225621.1688428-1-seanjc@google.com
Sean Christopherson (8):
KVM: SVM: Add a helper to detect VMRUN failures
KVM: SVM: Open code handling of unexpected exits in
svm_invoke_exit_handler()
KVM: SVM: Check for an unexpected VM-Exit after RETPOLINE "fast"
handling
KVM: SVM: Filter out 64-bit exit codes when invoking exit handlers on
bare metal
KVM: SVM: Treat exit_code as an unsigned 64-bit value through all of
KVM
KVM: SVM: Limit incorrect check on SVM_EXIT_ERR to running as a VM
KVM: SVM: Harden exit_code against being used in Spectre-like attacks
KVM: SVM: Assert that Hyper-V's HV_SVM_EXITCODE_ENL == SVM_EXIT_SW
arch/x86/include/asm/svm.h | 3 +-
arch/x86/include/uapi/asm/svm.h | 32 ++++++------
arch/x86/kvm/svm/hyperv.c | 7 ++-
arch/x86/kvm/svm/nested.c | 29 ++++-------
arch/x86/kvm/svm/sev.c | 36 +++++--------
arch/x86/kvm/svm/svm.c | 51 +++++++++++--------
arch/x86/kvm/svm/svm.h | 12 +++--
arch/x86/kvm/trace.h | 6 +--
include/hyperv/hvgdk.h | 2 +-
tools/testing/selftests/kvm/include/x86/svm.h | 3 +-
.../kvm/x86/svm_nested_soft_inject_test.c | 4 +-
11 files changed, 90 insertions(+), 95 deletions(-)
base-commit: 9448598b22c50c8a5bb77a9103e2d49f134c9578
--
2.52.0.351.gbe84eed79e-goog
next reply other threads:[~2025-12-30 21:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 21:13 Sean Christopherson [this message]
2025-12-30 21:13 ` [PATCH v2 1/8] KVM: SVM: Add a helper to detect VMRUN failures Sean Christopherson
2026-01-02 16:44 ` Yosry Ahmed
2025-12-30 21:13 ` [PATCH v2 2/8] KVM: SVM: Open code handling of unexpected exits in svm_invoke_exit_handler() Sean Christopherson
2026-01-02 11:41 ` Gupta, Pankaj
2025-12-30 21:13 ` [PATCH v2 3/8] KVM: SVM: Check for an unexpected VM-Exit after RETPOLINE "fast" handling Sean Christopherson
2025-12-30 21:13 ` [PATCH v2 4/8] KVM: SVM: Filter out 64-bit exit codes when invoking exit handlers on bare metal Sean Christopherson
2025-12-30 21:13 ` [PATCH v2 5/8] KVM: SVM: Treat exit_code as an unsigned 64-bit value through all of KVM Sean Christopherson
2025-12-30 21:13 ` [PATCH v2 6/8] KVM: SVM: Limit incorrect check on SVM_EXIT_ERR to running as a VM Sean Christopherson
2025-12-30 21:13 ` [PATCH v2 7/8] KVM: SVM: Harden exit_code against being used in Spectre-like attacks Sean Christopherson
2025-12-30 21:13 ` [PATCH v2 8/8] KVM: SVM: Assert that Hyper-V's HV_SVM_EXITCODE_ENL == SVM_EXIT_SW Sean Christopherson
2026-01-02 9:58 ` Vitaly Kuznetsov
2026-01-05 15:52 ` Sean Christopherson
2026-01-15 18:03 ` [PATCH v2 0/8] KVM: SVM: Fix exit_code bugs Sean Christopherson
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=20251230211347.4099600-1-seanjc@google.com \
--to=seanjc@google.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wei.liu@kernel.org \
--cc=yosry.ahmed@linux.dev \
/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®