From nobody Sun Feb 8 19:54:50 2026 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 2D6DA246778 for ; Thu, 15 Jan 2026 01:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439635; cv=none; b=UPzg9m16XoEFpVsZnuAimA9/mxjhDMeEiunTmhOiEvPtO3eRF+MOErKzzmCr2+aX6axtR2Hjiwwey1GOVhg0k2ww3Q06Lmy1iovkYCh8IF5GxD9p4oUk3wrrueuV6wKTk90eMkRjqMFs83eXWrVFKPU1+JHbQreIvm1wJqB/3lE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768439635; c=relaxed/simple; bh=QJkGO6buZj2FN76R5TlJ5b0ubRqJ+gXCFYiyaYYmb0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ngR9Ejtjn8h5G1V6m7fc2Q2/Ff6TyoixRUa24Edy2tLvKFcDSqShQq/BLQhsYr6acmmYvTRR/e7vblgjs4YlnfqlNaQ4so6GOzCl+czaIyw002ydDm+igOVe6dWWzObU2xeFG64/2TesK68PR/G2UJ7+6t0t2BTlPaIfqkFN9as= 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=R7tjGHDz; arc=none smtp.client-ip=91.218.175.172 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="R7tjGHDz" 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=1768439622; 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=HgQ/8xsqXO4D4VmyqO8Kbk6TDo6HNO5HxtqHdsr2+Ow=; b=R7tjGHDzeEb1FJMQpguFh0YBIhTVbIlJruRu2QVg8rN6EhUMbQr+GuauFfhx9aiMIvOHkh 8q+hvp/ggx0uQFF61n6r5aPuq7sSjvh1dx98KpskmMZV42GCcdb8w2k4XER+kgaY90CPX3 kLcvYmhv97UMJa+u2QeO7eHP4GvsXWo= 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 09/26] KVM: nSVM: Make nested_svm_merge_msrpm() return an errno Date: Thu, 15 Jan 2026 01:12:55 +0000 Message-ID: <20260115011312.3675857-10-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" In preparation for moving nested_svm_merge_msrpm() within enter_svm_guest_mode(), which returns an errno, return an errno from nested_svm_merge_msrpm(). No functional change intended. Cc: stable@vger.kernel.org Signed-off-by: Yosry Ahmed --- arch/x86/kvm/svm/nested.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 536ca8e1d29f..0915785f7770 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -277,7 +277,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void) * is optimized in that it only merges the parts where KVM MSR permission = bitmap * may contain zero bits. */ -static bool nested_svm_merge_msrpm(struct kvm_vcpu *vcpu) +static int nested_svm_merge_msrpm(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); nsvm_msrpm_merge_t *msrpm02 =3D svm->nested.msrpm; @@ -304,17 +304,19 @@ static bool nested_svm_merge_msrpm(struct kvm_vcpu *v= cpu) #endif =20 if (!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_MSR_PROT))) - return true; + return 0; =20 for (i =3D 0; i < nested_svm_nr_msrpm_merge_offsets; i++) { const int p =3D nested_svm_msrpm_merge_offsets[i]; nsvm_msrpm_merge_t l1_val; gpa_t gpa; + int r; =20 gpa =3D svm->nested.ctl.msrpm_base_pa + (p * sizeof(l1_val)); =20 - if (kvm_vcpu_read_guest(vcpu, gpa, &l1_val, sizeof(l1_val))) - return false; + r =3D kvm_vcpu_read_guest(vcpu, gpa, &l1_val, sizeof(l1_val)); + if (r) + return r; =20 msrpm02[p] =3D msrpm01[p] | l1_val; } @@ -326,7 +328,7 @@ static bool nested_svm_merge_msrpm(struct kvm_vcpu *vcp= u) #endif svm->vmcb->control.msrpm_base_pa =3D __sme_set(__pa(svm->nested.msrpm)); =20 - return true; + return 0; } =20 /* @@ -1040,7 +1042,7 @@ int nested_svm_vmrun(struct kvm_vcpu *vcpu) if (enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, true)) goto out_exit_err; =20 - if (nested_svm_merge_msrpm(vcpu)) + if (!nested_svm_merge_msrpm(vcpu)) goto out; =20 out_exit_err: @@ -1941,7 +1943,7 @@ static bool svm_get_nested_state_pages(struct kvm_vcp= u *vcpu) if (CC(!load_pdptrs(vcpu, vcpu->arch.cr3))) return false; =20 - if (!nested_svm_merge_msrpm(vcpu)) { + if (nested_svm_merge_msrpm(vcpu)) { vcpu->run->exit_reason =3D KVM_EXIT_INTERNAL_ERROR; vcpu->run->internal.suberror =3D KVM_INTERNAL_ERROR_EMULATION; --=20 2.52.0.457.g6b5491de43-goog