[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250609120038.41396-1-arefev@swemel.ru>
Date: Mon, 9 Jun 2025 15:00:37 +0300
From: Denis Arefev <arefev@...mel.ru>
To: stable@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
Julien Thierry <julien.thierry.kdev@...il.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org,
Oliver Upton <oliver.upton@...ux.dev>,
Quentin Perret <qperret@...gle.com>
Subject: [PATCH 5.10] KVM: arm64: Tear down vGIC on failed vCPU creation
From: Will Deacon <will@...nel.org>
commit 250f25367b58d8c65a1b060a2dda037eea09a672 upstream.
If kvm_arch_vcpu_create() fails to share the vCPU page with the
hypervisor, we propagate the error back to the ioctl but leave the
vGIC vCPU data initialised. Note only does this leak the corresponding
memory when the vCPU is destroyed but it can also lead to use-after-free
if the redistributor device handling tries to walk into the vCPU.
Add the missing cleanup to kvm_arch_vcpu_create(), ensuring that the
vGIC vCPU structures are destroyed on error.
Cc: <stable@...r.kernel.org>
Cc: Marc Zyngier <maz@...nel.org>
Cc: Oliver Upton <oliver.upton@...ux.dev>
Cc: Quentin Perret <qperret@...gle.com>
Signed-off-by: Will Deacon <will@...nel.org>
Reviewed-by: Marc Zyngier <maz@...nel.org>
Link: https://lore.kernel.org/r/20250314133409.9123-1-will@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@...ux.dev>
[Denis: minor fix to resolve merge conflict.]
Signed-off-by: Denis Arefev <arefev@...mel.ru>
---
Backport fix for CVE-2025-37849
Link: https://nvd.nist.gov/vuln/detail/cve-2025-37849
---
arch/arm64/kvm/arm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index afe8be2fef88..3adaa3216baf 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -294,7 +294,12 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
if (err)
return err;
- return create_hyp_mappings(vcpu, vcpu + 1, PAGE_HYP);
+ err = kvm_share_hyp(vcpu, vcpu + 1);
+ if (err)
+ kvm_vgic_vcpu_destroy(vcpu);
+
+ return err;
+
}
void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
--
2.43.0
Powered by blists - more mailing lists