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 5245F395AF8 for ; Fri, 5 Jun 2026 08:14:39 +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=1780647280; cv=none; b=kod/z/TeBiGQrGKr2bcMw0Lgi0a1H2sVTksIkX4d6DwAOQHM5toGWXpQldVJcHHAWEEgUZvsmPD5QWPnioFDO0+D/YMTdxFehPTve5gnfdiGkoAsRsEGx7a0GobKvyEoCO6IU3YzCgZUE6ZmzDPXXGm+LLGMZNeqC7mBJG5WI78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780647280; c=relaxed/simple; bh=8XBmiOaz2qq3lmv5tAJGQZYmuvMmDe6pU7iuKsWyGXE=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=nmbGu0uncszYwSwIVO8Xhls9nH4j2Jyql9/K1pS3mbcl3n1AwYsAtvMK9AEf0ERRJItAo7MAd+qtPpaxc9Mv5yibjCjkbTyjAIcOVD7eOaw6ea3EOs1J/nDOfpL2nAtZRDbNgvZBFo/7YkquKbG/MMs4DBDH0kbuwJ/gvKBQc8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gpCmuU+f; 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="gpCmuU+f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5E451F00893; Fri, 5 Jun 2026 08:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780647278; bh=C+AVu30NqnGrzlli33H8FaPDoPlg+shGgut1ZgWQ//U=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=gpCmuU+fhgGO956a7EreaUj+WjQumEYo2fMB2lq3WbcoTGj4icT+qlWulpkr4/Upq aSwsE4wjIH/n56aKzWxnnYMyzbyqhEkaMahyWjXAtnCLXEgsspilF2tCCVjWFA0coT y2mRtkxQTX+GiogI/MhgD1QzxgIefgFSliwB2sPRBZyOZWaTiqDeceb//z3EJB5znW mQlAIlnbrgUumHzpLXS3Pkm/J1S86WS+kF+33aIKlSTkll+SrRlWMjSXP3gOSyyGmS fUT708bJ7gIW2bn4w++pTphYx/Qfg/VPQ3/WkgpA4+C3oEuUvgAPmHiLBO0xtd2pC/ /QCDDRCTky4ww== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-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 1wVPhM-00000009gce-3h6o; Fri, 05 Jun 2026 08:14:36 +0000 Date: Fri, 05 Jun 2026 09:17:56 +0100 Message-ID: <87a4t99z9n.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Hyunwoo Kim , joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, Sascha.Bischoff@arm.com, jic23@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev Subject: Re: [PATCH] KVM: arm64: vgic: Use list_del_rcu() when flushing pending LPIs 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: kvmarm@lists.linux.dev 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: oupton@kernel.org, imv4bel@gmail.com, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, Sascha.Bischoff@arm.com, jic23@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 05 Jun 2026 06:47:17 +0100, Oliver Upton wrote: > > Hi Hyunwoo, > > On Fri, Jun 05, 2026 at 06:16:08AM +0900, Hyunwoo Kim wrote: > > vgic_v3_fold_lr_state() walks the ap_list from last_lr_irq without holding > > the ap_list_lock, relying on vgic_irq being freed via kfree_rcu() and on > > interrupts being disabled. vgic_flush_pending_lpis() removes entries with > > list_del(), which clobbers a node's next pointer, so when another vCPU > > disables LPIs via GICR_CTLR the walk can follow the clobbered next pointer > > from a removed node, or from the node that last_lr_irq points to. > > > > Remove entries with list_del_rcu() so that the next pointer stays valid > > until the walk completes. > > > > Fixes: 3cfd59f81e0f ("KVM: arm64: GICv3: Handle LR overflow when EOImode==0") > > Signed-off-by: Hyunwoo Kim > > Changing only one of the writer paths to use the rculist helpers does > not make the ap_list an rculist. Insertions are not RCU-safe, nor are > deleations from vgic_prune_ap_list(). > > And TBH, the real bug here is the fact that vgic_v3_fold_lr_state() isn't > taking the ap_list_lock. Yup, that'd be more sensible. I need to convince myself that there is no possible path from vgic_v*_fold_lr() to vgic_irq_queue_unlock(), because that one does actually acquire that lock. M. -- Jazz isn't dead. It just smells funny.