From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 385F22DEA6B; Fri, 9 Oct 2026 14:51:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557502; cv=none; b=Ef0iQigEM9RyyqKsX75ATMBlK7I+YS9jqpcs6KWK8XtXqUL9GTdaxs0XROST3TbK3doarm61y92bMP79LsmgWrxbO2SYYW+cMJ7xiMfPhY9bHjQsTgUI7SpeDsJfDb9JQPV4mHkPrkCKEg81IZCefNt7KgK9HnlIQCY/GrDdUzE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557502; c=relaxed/simple; bh=M/Q43Dy11nMLp5IeZaG8HaG83lWABti6JIWpl0G/Wv8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OEctxI5vr9PNUONKDKMvRC5D1JswbCgrdQzeOxq+Sz94Bne+3Vl7xGFUvd14msl2mQgZxnHXz+Vp8UoT1VMttSs0HVt3Up95ixjB+OEwqds+RNnWvHfvIlwCQm3dpjS8Gz2moHXbjnTsbW8NXGaUiyzUvtqXfkBdBro3W0XHM/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IxR2Nsgg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IxR2Nsgg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C8211F000FF; Fri, 9 Oct 2026 14:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557501; bh=+Mi8RnwCnwhYJ+6HMsziKo5ZTW2NS2nhLLsVUd6yWBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IxR2NsggoUyWF/1SAJv3C5Zu11vy6AHOaibr6nyeibhMyOFp3brbgfj3LB1bNLoct u5yyGI9Et8ScxkUpxWrAeCJOIqEQYHdU8AvBBBWUmw8haXvGU2FDUfImwTYXWPQJ9o zClwB21hCls9+qu2HJosCXUETkA+Lv4+JWHTbaoA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jinwoo Lee , Stefan Teodorescu , Sean Christopherson , Sasha Levin Subject: [PATCH 6.18 396/403] KVM: x86: Re-pend GET_NESTED_STATE_PAGES if getting said pages fails Date: Fri, 9 Oct 2026 16:12:37 +0200 Message-ID: <20261009141001.619470963@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sean Christopherson [ Upstream commit 10180a277549339020b08000206092c07e0bff5a ] Re-pend GET_NESTED_STATE_PAGES before exiting to userspace if getting the nested pages fails in the KVM_RUN path. If userspace re-runs the vCPU, and vmcs02 holds valid PFNs from the *previous* run of L2, then KVM could re-enter L2 with stale, unpinned PFNs mapped into e.g. the vAPIC page. Note, both SVM and VMX (as of commit 11722439fb20 ("KVM: nVMX: Ensure KVM_REQ_GET_NESTED_STATE_PAGES is cleared on VM-Exit") ensure the request is cleared on VM-Exit (including the "forced" case), i.e. there is no risk of double-mapping due to emulated VMLAUNCH/VMRESUME/VMRUN *and* the request trying to map the nested pages. Fixes: 671ddc700fd0 ("KVM: nVMX: Don't leak L1 MMIO regions to L2") Cc: stable@vger.kernel.org Reported-by: Jinwoo Lee Closes: https://lore.kernel.org/all/20260813043932.3214460-1-rkskek9254@gmail.com Reported-by: Stefan Teodorescu Link: https://patch.msgid.link/20260921211608.1030158-2-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10708,6 +10708,7 @@ static int vcpu_enter_guest(struct kvm_v if (kvm_check_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu)) { if (unlikely(!kvm_nested_call(get_nested_state_pages)(vcpu))) { + kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); r = 0; goto out; }