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 03F2E3BE630; Mon, 4 May 2026 14:14:58 +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=1777904098; cv=none; b=Rm4Zs7S3RdgDyJbejDJV5iFnbMXJOGGXk1NE/xgPk2n/9cMo1r8hXywqzsNWBCj416TmRt+6BsBzGFIE56dqxv5h6nQRdq6R+9WdDiw5eBcOqowSnfQ58uzGBY0aNUWDq8pqezMaq7EjvtWpby+duXt+WKurOndSFcXmXU9jkMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777904098; c=relaxed/simple; bh=TZoVfuMsLEdgE9eoJy4Ko8yBBJxWAuej3B/c/AJPJTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gcLIUvt6WxFD+lIkWFlNgdg1JYnvHMzfE7ri9n0VaQB8QDvyp6AJqdM2YdC9pq795fvdKA1FJiiTnZr+7dnJc5JIC4DSfnUADfSup1EK0VzM4ZMUx1VfymB7kmzxa6AlDD0cGjZcJZi5U330T42eoFwIF4AmBa5Pn6Df9/5QdaA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ad9X9sKa; 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="ad9X9sKa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E8D4C2BCB8; Mon, 4 May 2026 14:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777904097; bh=TZoVfuMsLEdgE9eoJy4Ko8yBBJxWAuej3B/c/AJPJTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ad9X9sKaZ+mvqk9yyUpFWJ64aEqtl8HKVTqTsj8Jby/lew5gpq/EHWfJ3fG7o/4uE k/kRrBDJhnTw3rh/ap+VEQ/5M41KQhEWRdWTLipxtqCULpgds4g+LJp+yv08UPwKn6 nk0ruj5JPRHw/Dmu5UTro0Wc90r9Xhdkh6lzNZhQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yosry Ahmed , Sean Christopherson Subject: [PATCH 6.18 182/275] KVM: nSVM: Always inject a #GP if mapping VMCB12 fails on nested VMRUN Date: Mon, 4 May 2026 15:52:02 +0200 Message-ID: <20260504135149.838894868@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260504135142.929052779@linuxfoundation.org> References: <20260504135142.929052779@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 6.18-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 @@ -966,12 +966,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);