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 8711475801; Mon, 4 May 2026 14:03:10 +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=1777903390; cv=none; b=uwDsyZGN4VV1554bbeCxS7pI3uRcVhWRzGanZPquYVgNtutfTINpulSe+sj6leNKtzsNDN7HbqPeRLo5ZQBuSkypuiilc0QOrq7dF/9cIrr2Dbx4liaU0MUEJQaKjeeW3SYE6A6hxAR4poxriPrOI7Vxhqs0GmKSypXDiIEcyEc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777903390; c=relaxed/simple; bh=yLfz4y0GUTn/fq4U37VA8fNZGnKoAoAMBv16yRqL1QI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YIKMQJUgjoTmA1DFOeFmKSwnk/jncEbaau9IPevyD68pY835dlvdotYcEcCAi3venEVNoZERlGBZnsIey5Zp53EvcyTdrAUJJ6+dLxdT+cuhD0vApFlNUeKWMA9wf9rwgpafcGazNw7f6geimfIGQyJDD5VMPs9E34+Qs7q37Cw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D+VHI5ug; 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="D+VHI5ug" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EB5BC2BCB8; Mon, 4 May 2026 14:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777903390; bh=yLfz4y0GUTn/fq4U37VA8fNZGnKoAoAMBv16yRqL1QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D+VHI5uglLMncX+OMi3PRqV5A5O2N1KaQkv1DkCsoJsOBbjML9P05mNwAZfD0aNDJ DI28UpD4OV7sXmwv7e9Jc5Nd4Qtasqyh+Z22xb2ZZjvHb4XU4Y7Dw4LuZ88bFbdi++ UuHdi83sYJEAaP3vB+888vgGtLB4AKC7boQq4Htk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yosry Ahmed , Sean Christopherson Subject: [PATCH 7.0 216/307] KVM: nSVM: Always inject a #GP if mapping VMCB12 fails on nested VMRUN Date: Mon, 4 May 2026 15:51:41 +0200 Message-ID: <20260504135150.993771233@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135142.814938198@linuxfoundation.org> References: <20260504135142.814938198@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yosry Ahmed commit 01ddcdc55e097ca38c28ae656711b8e6d1df71f8 upstream. nested_svm_vmrun() currently only injects a #GP if kvm_vcpu_map() fails with -EINVAL. But it could also fail with -EFAULT if creating a host mapping failed. Inject a #GP in all cases, no reason to treat failure modes differently. Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory") CC: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Yosry Ahmed Link: https://patch.msgid.link/20260303003421.2185681-6-yosry@kernel.org Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm/nested.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1021,12 +1021,9 @@ int nested_svm_vmrun(struct kvm_vcpu *vc } vmcb12_gpa = svm->vmcb->save.rax; - ret = kvm_vcpu_map(vcpu, gpa_to_gfn(vmcb12_gpa), &map); - if (ret == -EINVAL) { + if (kvm_vcpu_map(vcpu, gpa_to_gfn(vmcb12_gpa), &map)) { kvm_inject_gp(vcpu, 0); return 1; - } else if (ret) { - return kvm_skip_emulated_instruction(vcpu); } ret = kvm_skip_emulated_instruction(vcpu);