[PATCH v3 0/2] KVM: nVMX: Add the activity-state cross-checks VM-entry requires

From: amirmohammad.eftekhar

Date: Thu Oct 22 2026 - 17:52:34 EST


From: Amirmohammad Eftekhar <amirmohammad.eftekhar@xxxxxxxx>

nested_check_guest_non_reg_state() only verifies that guest_activity_state is
one of ACTIVE/HLT/WAIT_SIPI; it performs none of the activity-state cross-checks
that VM entry requires. Per Intel's SDM, "Checks on Guest Non-Register State":
the activity state must indicate the active state when the interruptibility-state
field blocks by STI or MOV SS, and when the valid bit of the VM-entry
interruption-information field is set the interruption "must not be one that
would normally be blocked" in the activity state -- for wait-for-SIPI, "No
interruptions are allowed".

KVM cannot rely on hardware to catch either miss: prepare_vmcs02() never writes
GUEST_ACTIVITY_STATE, so vmcs02 always carries the active state while the
injection is copied into vmcs02, and the physical VMLAUNCH sees a legal pair and
succeeds. The missed-exit WARN in __nested_vmx_vmexit() cannot fire for this
class either, since the offending field is stripped before hardware sees vmcs02.

The two checks share this justification but are independent changes, so they are
split into separate patches per review feedback.

v3:
- split into two patches, one per consistency check (Sean)
- drop the comment that merely restated the code (Sean)
v2: clean resend of v1 (v1 was whitespace-damaged in transit by a mail client).

Amirmohammad Eftekhar (2):
KVM: nVMX: Reject nested VM-entry in a non-active state blocked by
STI/MOV-SS
KVM: nVMX: Reject nested VM-entry in wait-for-SIPI with a pending
event injection

arch/x86/kvm/vmx/nested.c | 9 +++++++++
1 file changed, 9 insertions(+)

--
2.34.1