From: sashiko-bot@kernel.org
To: "Younho Choi" <gdool88@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Reject SMM on VMs with private memory
Date: Tue, 24 Nov 2026 03:42:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-230480@kernel.org> (raw)
In-Reply-To: <20261124032748.1221979-1-gdool88@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Critical] KVM: x86: pending SMI in
kvm_vcpu_ioctl_x86_set_vcpu_events() enters SMM
--
commit c37a22adf8ef4d4936cc15c833970255bb255e89
Author: Younho Choi <gdool88@gmail.com>
KVM: x86: Reject SMM on VMs with private memory
This commit prevents VMs with private memory from advertising
KVM_CAP_X86_SMM, emulating MSR_IA32_SMBASE, or enabling SMM via
KVM_SET_VCPU_EVENTS.
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index aad065d035fbb..467262520dc4d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3039,6 +3039,15 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
> | KVM_VCPUEVENT_VALID_TRIPLE_FAULT))
> return -EINVAL;
>
> + /*
> + * SMM is unsupported for VMs with private memory, which expose a single
> + * memslot address space; entering SMM would select address space 1 and
> + * alias it with address space 0 (see kvm_arch_nr_memslot_as_ids()).
> + */
> + if ((events->flags & KVM_VCPUEVENT_VALID_SMM) && events->smi.smm &&
> + kvm_arch_has_private_mem(vcpu->kvm))
> + return -EINVAL;
> +
> if (events->flags & KVM_VCPUEVENT_VALID_PAYLOAD) {
> if (!vcpu->kvm->arch.exception_payload_enabled)
> return -EINVAL;
[Severity: Critical]
Should this check also reject events->smi.pending (and
events->smi.smm_inside_nmi), matching the !CONFIG_KVM_SMM check further down
in kvm_vcpu_ioctl_x86_set_vcpu_events()?
Passing events.smi.smm = 0 and events.smi.pending = 1 on a VM with private
memory still sets vcpu->arch.smi_pending. On the next KVM_RUN,
kvm_check_and_inject_events() calls enter_smm() (or hits KVM_BUG_ON() in
vt_smi_allowed() on TDX VMs), entering address space 1 and triggering the
vcpu->last_used_slot generation-aliasing use-after-free in
kvm_vcpu_gfn_to_memslot().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124032748.1221979-1-gdool88@gmail.com?part=1
prev parent reply other threads:[~2026-11-24 3:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 3:27 [PATCH] KVM: x86: Reject SMM on VMs with private memory Younho Choi
2026-11-24 3:42 ` sashiko-bot [this message]
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=sashiko-outbox-230480@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gdool88@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.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