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 D5BD63C13F9; Sat, 17 Oct 2026 16:45:24 +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=1792255525; cv=none; b=fW9wFrhC5s0SOdaxKLLTpw/hHrsbBzD5mttKZsYp08Axu9X27U3/WoXEUZ0FeOkFL4nYKThu4I/EtYRl1QJrV3uAkdWnqAjCIKkZC0UuISQw9ILS8x6OhtaL8FJEQ/FbbhTDH6EhrqxCXvLrsJXDWDWW824GU6DTcbGTTfcHqWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792255525; c=relaxed/simple; bh=AM+UIoKiYopB7DmucApKiPE1O+4AVKfzupnSqkoBuWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ouK8GHpdXrx1N3X4wKuWnICfQlJf1vRnHnZXP9rOBE1xvqUidLhhkLY91IX7+43qMMMZp6cJii13ZP0ZwH5tSu//vH0dUEKldpl8XbkcLmgLfvIaSYbO9R0ntubN+6MD1n2itgLFCQpaHbsgWCcj9SjZl2xKXXVmQPc8usyli1k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jWPMr2xN; 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="jWPMr2xN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 207A11F000C5; Sat, 17 Oct 2026 16:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792255524; bh=0kGKgiSpd3ps3fckle7NAuuZeF+NV3YwGMPL3OklOnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jWPMr2xN/kvHSjmywHoP0qYIy1A7v2OVXhRBXTP+k/K6Fx6cozOgK8O41p1/4kXjC aR6oVQgjkQ+20c3AyncFgMP8K7S3/KnCMuPqk4eT+vGoJ+rn48ZkVTTursh3y4otrG +PEWLJYbWUQVZ8JTCXqVsDs9yLxQVtIST4xkxuwk= 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.12 806/869] KVM: nSVM: Triple fault if restore host CR3 fails on nested #VMEXIT Date: Sat, 17 Oct 2026 18:00:47 +0200 Message-ID: <20261017160057.562698809@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160036.979869304@linuxfoundation.org> References: <20261017160036.979869304@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.12-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 636f0354fa815..4aee865718fe3 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1163,9 +1163,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