From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 F40FF2C15BB for ; Tue, 9 Jun 2026 10:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781001123; cv=none; b=TxYvC4KdjzLKxA5UhdH8FGftJ+HuqbqlnE69Obk9xjcPFZqbvZUFF+iviM6mKgVbwwcidHe6xDTqx0BzEuuIzVlPZONWHcGrshttvGIW/tlR9TN4cahas46BiSSNgETh/uzGQ79pqdoWp0jquaEfjSXnIAUHnNLHjX94QZ+va34= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781001123; c=relaxed/simple; bh=kvLTDnHk5jHdDccBC4DF1a8gIAhewOmhZMFYdCmFCjw=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=EAnC9MT9oM2leiWe3pHSEBj5XOln9suvhvdD/3YAF41kGowp9rv6lVAgmkEdqk3AMIcpCvlBbTt0KIdJLLQ9xshzovVXHW0Ymu2rzbI43eVVPAGaDgxwVjdFhOvSUUyV5VRd5XRc1/jnkda2/y1ebesVofsgG7ELVi8qX4zwkU8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kSk9sgj1; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kSk9sgj1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EDEA1F00893; Tue, 9 Jun 2026 10:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781001122; bh=3bi2l8ntRklXacewtAmub2WWWkpvoyqi+I4rfwge7cc=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=kSk9sgj19xO3h6AKOAC/wO56W34Io5hqzXo70eZ6frJN9BY9yZqE8zEESoBJ6zPPI 2ScTgU5DnWxlN5n+jNBEbW7KVSfV1SeTfwcivvynqLv/cV3XFFjNITTftjoi+TP452 lSVG62wtE17WfQsu0Eakio1gKYOYq0tOnA4Aly/2ogFMwVnVFKZbN1rPwKlpf+4YzW puF7sZVImZeMP42cx3X9yjtQ2tj5WdWB+Z8mjMLQo9Ytek5m8l424+GOHp/RmZFhUf rKP/cmYkJrT1k0PZhSRehJRWeDB0jvqHCcYibR8f2dg+eV0fObd8WSMXhCiMpvf322 gl2z1GFZcNsrA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wWtkW-0000000Arpv-2Tpd; Tue, 09 Jun 2026 10:32:00 +0000 Date: Tue, 09 Jun 2026 11:32:00 +0100 Message-ID: <86h5nct36n.wl-maz@kernel.org> From: Marc Zyngier To: Hyunwoo Kim Cc: gregkh@linuxfoundation.org, stable@vger.kernel.org, oupton@kernel.org Subject: Re: [PATCH 6.18.y] KVM: arm64: Take the SRCU lock for page table walks in fault injection and AT emulation In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: imv4bel@gmail.com, gregkh@linuxfoundation.org, stable@vger.kernel.org, oupton@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Tue, 09 Jun 2026 10:48:08 +0100, Hyunwoo Kim wrote: > > [ Upstream commit f2ca45b50d4216c9cc7ffabf50d9ad1932209251 ] > > walk_s1() and kvm_walk_nested_s2() expect to be called while holding > kvm->srcu to guard against memslot changes. While this is generally > the case, __kvm_at_s12() and __kvm_find_s1_desc_level() call into the > respective walkers without taking kvm->srcu. > > Fix by acquiring kvm->srcu prior to the table walk in both instances. > > Cc: stable@vger.kernel.org > Fixes: 50f77dc87f13 ("KVM: arm64: Populate level on S1PTW SEA injection") > Fixes: be04cebf3e78 ("KVM: arm64: nv: Add emulation of AT S12E{0,1}{R,W}") > Suggested-by: Oliver Upton > Signed-off-by: Hyunwoo Kim > Reviewed-by: Oliver Upton > Link: https://patch.msgid.link/aiAZfdeyanIvP8SD@v4bel > Signed-off-by: Marc Zyngier > [ Hyunwoo Kim: __kvm_at_s12() still returns void in 6.18.y, so the > surrounding context differs from upstream (return; instead of > return ret;); the added scoped_guard() is unchanged. ] > Signed-off-by: Hyunwoo Kim > --- > arch/arm64/kvm/at.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c > index be26d5aa668c..e6de6aac6ede 100644 > --- a/arch/arm64/kvm/at.c > +++ b/arch/arm64/kvm/at.c > @@ -1528,7 +1528,8 @@ void __kvm_at_s12(struct kvm_vcpu *vcpu, u32 op, u64 vaddr) > /* Do the stage-2 translation */ > ipa = (par & GENMASK_ULL(47, 12)) | (vaddr & GENMASK_ULL(11, 0)); > out.esr = 0; > - ret = kvm_walk_nested_s2(vcpu, ipa, &out); > + scoped_guard(srcu, &vcpu->kvm->srcu) > + ret = kvm_walk_nested_s2(vcpu, ipa, &out); > if (ret < 0) > return; > > @@ -1623,7 +1624,8 @@ int __kvm_find_s1_desc_level(struct kvm_vcpu *vcpu, u64 va, u64 ipa, int *level) > } > > /* Walk the guest's PT, looking for a match along the way */ > - ret = walk_s1(vcpu, &wi, &wr, va); > + scoped_guard(srcu, &vcpu->kvm->srcu) > + ret = walk_s1(vcpu, &wi, &wr, va); > switch (ret) { > case -EINTR: > /* We interrupted the walk on a match, return the level */ Thanks for going the extra mile and doing the backport, much appreciated. Acked-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible.