From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796277341; b=BZ/KRX1YzPWiGXoE4G/EToZxfFcxPHKUBuf41xHDA1Rv7/1lw+uMoz1sjS8pT2MnjDF2 Oh4xZuOztQjQQpbfk06Boyk8AxBK1sKEEIm4/YfeD6zh9ke0eepQVRzbncokkyRp4CrUJ pVaqh3yqKN/aPnq8vAFVtt5XiUvJIw+3IsdxaVQvIv2GuBruxxU47yfYaiKISODBuvf5X FM/Pq40ern19rFCVGG/Tm6Je2v8fm3viW8jogTH5cUYw1vu27afwLhBqWftjAZeestoEW Q+Un+IouPIUEPH1p3R30KmzQmZPfJmP5Likor+v2bnYmjImiYg4l72we0dn/Hf6ECFw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796277341; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=g9yFrjJlaJhZIrgLj9XZvDMJNKbxk6mA5rBJ4ewSG9I=; b=4gHAkd5ifOEyA8AP6/BDX1punNqLdRiyvmhso47TENvgVP1fHTn17C7fzx6V9RkFGkmv EBTfmd7PKdUUmsFzNi6YL+19wbEjRF0UF4zEgTy8fJ+wNib//oBCweCSrsRojv1zI8/F5 MLIaz4QKOXWLojBt8JaoCscgG2LaimFtNPctQ1+xOCNeZblIXkWm2Bq+aN3pams0kY+Fq sxGPFAg2dXpaai8LJ8KZaBfWqWNFFOztrloSOgRd2OlHRbzWtMCK2suVN4OdNiJiueGAD NID0P1gu8DtuEJATJfCkbyET+uYjBA3E7H/rcrki2hCD8SpWIX0PafGHJJINr7ivLTA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hkw018Kn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A92A2606A322 for ; Thu, 3 Dec 2026 05:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hkw018Kn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D00F1F000C1; Thu, 3 Dec 2026 05:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796277341; bh=g9yFrjJlaJhZIrgLj9XZvDMJNKbxk6mA5rBJ4ewSG9I=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hkw018KnLSSlCZBU22AQV+7VhpkKvMoRQvmpdby7ND926H9ptsMR/a1Iwcfthyrk4 GtNW+Vw4mgw4nO7lTNmFVO/sm/623NP6bP9MXFYwAUWVHAlXAS0u6fzsQaZRlvMGhY j0jtxQWSMz5pqvzTA3FyafEvoPHaJMsNno5jn45BY+lLdStLygsYz6Ncs54C7Q3or2 gTsA4IXpC89bRz8hzFlIjOoiWUQdMq/JulWqJxSOdRj9B16qfAXmoggMQ1zbnbQIRL 6L66C7yBHwnMo/LHDTjY6LlTS2uJQu5kR885kZaer2CdLpq7eLyoRUXsROv8LxHD2L SlmEwTI4ut+wg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 3/3] KVM: nVMX: Check the event injected into the HLT state on nested VM-Enter Reply-To: sashiko-reviews@lists.linux.dev To: "Zihui Guo" Cc: kvm@vger.kernel.org In-Reply-To: <20261203053449.25917-4-youzih27@gmail.com> References: <20261203053449.25917-1-youzih27@gmail.com> <20261203053449.25917-4-youzih27@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 05:55:39 +0000 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] KVM: nVMX: nested_check_guest_non_reg_state() rejects stale entry intr info -- commit 452383a9c0e3395f4748f51dbdcfd8ecc5c17e73 Author: Zihui Guo KVM: nVMX: Check the event injected into the HLT state on nested VM-Enter This commit adds a consistency check in nested_check_guest_non_reg_state() to reject disallowed VM-entry event injections when vmcs12's guest activity state is HLT. > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c > index 82618f74d4ad2..2712648915a90 100644 > --- a/arch/x86/kvm/vmx/nested.c > +++ b/arch/x86/kvm/vmx/nested.c [ ... ] > @@ -3292,6 +3310,11 @@ static int nested_check_guest_non_reg_state(struct= vmcs12 *vmcs12) > VMX_AR_DPL(vmcs12->guest_ss_ar_bytes) !=3D 0)) > return -EINVAL; > =20 > + if (CC(vmcs12->guest_activity_state =3D=3D GUEST_ACTIVITY_HLT && > + (vmcs12->vm_entry_intr_info_field & INTR_INFO_VALID_MASK) && > + !nested_hlt_event_allowed(vmcs12->vm_entry_intr_info_field))) > + return -EINVAL; [Severity: High] Can this reject stale vmcs12->vm_entry_intr_info_field during KVM_SET_NESTED_STATE when vcpu->arch.nested_run_pending is 0? If L1 enters an active L2 with CPU_BASED_HLT_EXITING clear and injects an event disallowed in HLT (such as #PF), vmcs12->vm_entry_intr_info_field keeps INTR_INFO_VALID_MASK set until prepare_vmcs12() runs on an L2-to-L1 exit. When L2 later executes HLT, L0 handles it in guest mode with nested_run_pending cleared. vmx_get_nested_state() -> sync_vmcs02_to_vmcs12() then sets guest_activity_state to GUEST_ACTIVITY_HLT without clearing the stale entry interruption info. On restore, vmx_set_nested_state() clears nested_run_pending and calls nested_vmx_check_restored_vmcs12() -> nested_vmx_check_guest_state() -> nested_check_guest_non_reg_state(), failing live migration with -EINVAL even though prepare_vmcs02_early() ignores vm_entry_intr_info_field then. Gating this check on vcpu->arch.nested_run_pending, as nested_vmx_check_guest_state() does for VM_ENTRY_LOAD_IA32_EFER, avoids rejecting stale state while still enforcing the check on nested VM-Enter. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203053449.2591= 7-1-youzih27@gmail.com?part=3D3