From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5A00616A956 for ; Sun, 3 May 2026 12:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777810658; cv=none; b=aoroGgioCP6800aN6QUjAhiIgq3FNbx+yRXA0NgHED9HYr7smS2wFob2JTAw+gVlkaY6H5y7tnuiGd7e7VtdcLK3E/UZ3IXQlZOQ0Vd2BanQKs76uPNlopjn1koKL39O9Ivt2GPA1OGtx9w+QwAWdknET5j7r1fWlZ0qEOxLu+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777810658; c=relaxed/simple; bh=SrAMzluE1DmJVfckUhG663R0/V9q2OI4r8qNnGNp6/Q=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=Hp0Se8vFlq4HeKQRf9uMemkV8hnwiX+10ArXfMubHyeLj7pjcTozp+cMcEbXJHsnUca95VvC206SbKe9yBIg6477fyMglughD/SxzAPPXFfII/90JarIgzzsry070SMkuXFU0w43wk/iatUtDxxNu4FbZ9sgl55sEBO8X2RBMS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zmMw5Fdi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zmMw5Fdi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9777C2BCB4; Sun, 3 May 2026 12:17:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777810658; bh=SrAMzluE1DmJVfckUhG663R0/V9q2OI4r8qNnGNp6/Q=; h=Subject:To:Cc:From:Date:From; b=zmMw5Fdi0vTgMSy3+dWTjNZdz7t80BjEgj/foFDp4V1OJmuy6ugWim1XZX+T4JkLj X9wr0pgD0Dc/wg3NWImLiV6PX7mXGmo2BpJWbIu/D1tAa0ruE1WNy6RoEdZrEfx8HV B0FW3KiE2tUIbHU63iJCljkzx2I3XRHgl4Aym1xs= Subject: FAILED: patch "[PATCH] KVM: nSVM: Triple fault if mapping VMCB12 fails on nested" failed to apply to 6.1-stable tree To: yosry@kernel.org,seanjc@google.com Cc: From: Date: Sun, 03 May 2026 14:17:30 +0200 Message-ID: <2026050330-chariot-irritant-d8cc@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 1b30e7551767cb95b3e49bb169c72bbd76b56e05 # git commit -s git send-email --to '' --in-reply-to '2026050330-chariot-irritant-d8cc@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1b30e7551767cb95b3e49bb169c72bbd76b56e05 Mon Sep 17 00:00:00 2001 From: Yosry Ahmed Date: Tue, 3 Mar 2026 00:34:02 +0000 Subject: [PATCH] KVM: nSVM: Triple fault if mapping VMCB12 fails on nested #VMEXIT KVM currently injects a #GP and hopes for the best if mapping VMCB12 fails on nested #VMEXIT, and only if the failure mode is -EINVAL. Mapping the VMCB12 could also fail if creating host mappings fails. After the #GP is injected, nested_svm_vmexit() bails early, without cleaning up (e.g. KVM_REQ_GET_NESTED_STATE_PAGES is set, is_guest_mode() is true, etc). Instead of optionally injecting a #GP, triple fault the guest if mapping VMCB12 fails since KVM cannot make a sane recovery. The APM states that a #VMEXIT will triple fault if host state is illegal or an exception occurs while loading host state, so the behavior is not entirely made up. Do not return early from nested_svm_vmexit(), continue cleaning up the vCPU state (e.g. switch back to vmcb01), to handle the failure as gracefully as possible. Fixes: cf74a78b229d ("KVM: SVM: Add VMEXIT handler and intercepts") CC: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Yosry Ahmed Link: https://patch.msgid.link/20260303003421.2185681-9-yosry@kernel.org Signed-off-by: Sean Christopherson diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 8c01916cb154..30c99bbe9927 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1199,12 +1199,8 @@ int nested_svm_vmexit(struct vcpu_svm *svm) struct vmcb *vmcb02 = svm->nested.vmcb02.ptr; int rc; - rc = nested_svm_vmexit_update_vmcb12(vcpu); - if (rc) { - if (rc == -EINVAL) - kvm_inject_gp(vcpu, 0); - return 1; - } + if (nested_svm_vmexit_update_vmcb12(vcpu)) + kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); /* Exit Guest-Mode */ leave_guest_mode(vcpu);