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 8D5603B9616; Sat, 17 Oct 2026 17:37:44 +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=1792258665; cv=none; b=uGz1NE6KgNv/42VX65XqOFoAt++RHVZAb4sjANaK596IFOINBT2TGqZxFpjB7+YILFGNX3mrHyHqGGyzm621X1IwLZbR8MpBp7vjTozkQuXdb/UWGUZsePpFajNb4pGWmY/ZCvcD0Up2KExrq3MvBF2y05NE1AT5dvABc2p72Iw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792258665; c=relaxed/simple; bh=BJExO/bzL6AvlQfJCnBD1sq4Hdrtt9Ql1kKgRA3vIfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=St9HoUEPlEm6f5nf5MyUaqz1Uz4hXeqCD6YdtFFeTzK+0t1ERBNCg4ZWygzUgxjv12exEmKt0wDV8/aYQC9RFx7h6hE1kdGNLIREAEBVFqvs5xm1ZenUG54hUhZ295u63Idu/8cdAc+E5WnBBMYPhQiJXjNPPfia5sjiGHQvCSM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jJiVoshs; 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="jJiVoshs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D98561F000C4; Sat, 17 Oct 2026 17:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792258664; bh=tN5qfjmEiOJIbqu+rkyH6+9a8ycQx8qKZLDaI51AS9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jJiVoshsE5xU72EeV4kBAUCCZ7M9+B8BuaQf8JcYCD4+HrTyeeAlHLXPrQ6UpSx7T 063ymPi7WB4JP1fLmmSbZQNBkaXsisobWa/xKS5L69NeO9ud57HgGLGxnVlCs/Xwqb 9aCD4nRsxOseenbs99atFEPYnj6SehRR5DChmU6g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yosry Ahmed , Sean Christopherson , Sasha Levin Subject: [PATCH 6.6 0958/1674] KVM: nSVM: Triple fault if restore host CR3 fails on nested #VMEXIT Date: Sat, 17 Oct 2026 17:53:50 +0200 Message-ID: <20261017160455.716345743@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yosry Ahmed [ Upstream commit 5d291ef0585ed880ed4dd71ea1a5965e0a65fb53 ] If loading L1's CR3 fails on a nested #VMEXIT, nested_svm_vmexit() returns an error code that is ignored by most callers, and continues to run L1 with corrupted state. A sane recovery is not possible in this case, and HW behavior is to cause a shutdown. Inject a triple fault instead, and do not return early from nested_svm_vmexit(). Continue cleaning up the vCPU state (e.g. clear pending exceptions), to handle the failure as gracefully as possible. >>From the APM: Upon #VMEXIT, the processor performs the following actions in order to return to the host execution context: ... if (illegal host state loaded, or exception while loading host state) shutdown else execute first host instruction following the VMRUN Remove the return value of nested_svm_vmexit(), which is mostly unchecked anyway. Fixes: d82aaef9c88a ("KVM: nSVM: use nested_svm_load_cr3() on guest->host switch") CC: stable@vger.kernel.org Signed-off-by: Yosry Ahmed Link: https://patch.msgid.link/20260303003421.2185681-10-yosry@kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Sasha Levin --- arch/x86/kvm/svm/nested.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 2be600876e0c3..d80f8dc6aeafa 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1149,9 +1149,8 @@ int nested_svm_vmexit(struct vcpu_svm *svm) nested_svm_uninit_mmu_context(vcpu); - rc = nested_svm_load_cr3(vcpu, vmcb01->save.cr3, false, true); - if (rc) - return 1; + if (nested_svm_load_cr3(vcpu, vmcb01->save.cr3, false, true)) + kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); /* * Drop what we picked up for L2 via svm_complete_interrupts() so it -- 2.53.0