From nobody Sun Feb 8 18:48:32 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 E3193223702 for ; Thu, 15 Jan 2026 01:13:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439620; cv=none; b=jWim7lz8UCkI7SlsEnMK9bAM3ATKdLODTvy9ZCJYdotYDc3Cpb671T6BfEgx6Q6jZAezsBQlI9Mg7WnJRuGbktIH5mhDWJQGdLPXDN/Wb/8L8RJaWl8s31LtLVP3UQQ5fNKKrSPAhFCFJcr8o+pYvvL3YC7Ts68jxdrOyYHCFFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439620; c=relaxed/simple; bh=ChBGH0EIeAQB4+XYtp32lQzDWmZ2qjzvmHmcPEp31bw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lERJCmX8fQMhlaRpwaYDSEWINQfrfsKykJOQe0pWbuUQb1/8ZcOJI05QobfLGqpvrNIWYo8B853by/B2qVU7cbw7UONi/NLOntWu/AK70Bxr9j0r/t6SXD8GIfN5PaClkmVn6R6sBef+r9BkBjPOEFDuU85pITqovvzkEr2sOKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SHcI4Ojk; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SHcI4Ojk" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768439614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aQZKrV5jtvMOu7N9t4ncabozUsO3LP1NQaZvmuk0EHw=; b=SHcI4Ojk4so0EpLbpdpU7IeEMuWJWwWrSw3LUxWcpBXKwvyaMIoqueXTXP4fxfYWcCQFWh ceWqclXyIhOpRUIUMn81MGACU+oSCLexeMUzBUWYkW3FMjZOQA1l2dSrcCl5nzk4sqP/Y5 K7F1j6EyhvqfTsz7Wokw4cJq3Cgj2jU= From: Yosry Ahmed To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed , stable@vger.kernel.org Subject: [PATCH v4 04/26] KVM: nSVM: Always inject a #GP if mapping VMCB12 fails on nested VMRUN Date: Thu, 15 Jan 2026 01:12:50 +0000 Message-ID: <20260115011312.3675857-5-yosry.ahmed@linux.dev> In-Reply-To: <20260115011312.3675857-1-yosry.ahmed@linux.dev> References: <20260115011312.3675857-1-yosry.ahmed@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 m= emory") CC: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Yosry Ahmed --- arch/x86/kvm/svm/nested.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 03a2c4390676..5f9c5ccc4783 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1015,12 +1015,9 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) } =20 vmcb12_gpa =3D svm->vmcb->save.rax; - ret =3D kvm_vcpu_map(vcpu, gpa_to_gfn(vmcb12_gpa), &map); - if (ret =3D=3D -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); } =20 ret =3D kvm_skip_emulated_instruction(vcpu); --=20 2.52.0.457.g6b5491de43-goog