SDM Vol. 3C 29.3.1.5: "The activity-state field must not indicate the HLT state if the DPL (bits 6:5) in the access-rights field for SS is not 0." nested_check_guest_non_reg_state() only checks the range of the activity state. The hardware cannot catch this either, because KVM emulates the HLT state of L2 and never loads vmcs12's activity state into vmcs02, so L1 gets a successful VM-Enter where the architecture requires a VM-Entry failure due to invalid guest state. Fixes: 6dfacadd5858 ("KVM: nVMX: Add support for activity state HLT") Signed-off-by: Zihui Guo --- arch/x86/kvm/vmx/nested.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 92397516885d..82618f74d4ad 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3288,6 +3288,10 @@ static int nested_check_guest_non_reg_state(struct vmcs12 *vmcs12) vmcs12->guest_activity_state != GUEST_ACTIVITY_WAIT_SIPI)) return -EINVAL; + if (CC(vmcs12->guest_activity_state == GUEST_ACTIVITY_HLT && + VMX_AR_DPL(vmcs12->guest_ss_ar_bytes) != 0)) + return -EINVAL; + return 0; } -- 2.43.0