From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A00D1CD6E5D for ; Fri, 5 Jun 2026 08:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C+AVu30NqnGrzlli33H8FaPDoPlg+shGgut1ZgWQ//U=; b=0UDaw5GNf52krIMBVtHyXx8OpW 5QPQ6G6jCNrqI3nWlrPJDnGyFzwgKh/XbLsJvtL2mKC7ruXCUg9sYkY9wrgcZLDXzyx7U/PmOT0Oz 1fX40XYHrORbQaAdVrg7aYcTGfUXcztRTR0Q9mekWgB7CuksWqFX39TLqMqGTeMk0zJUWQxAyPcCr aOC0qUjxo3GjJJQ4IluIg1uY/kHaLKgU5fDT4pKTPueD4a8sKJ3XzP7iIroHkGP10nKvQhY7UcobE gCEJj8PkZy6EsYnIyzyEKUc4SF6t5By6xZAzVRbZ7fiTACo4M/Xy7bAtCqAWIWWVYCSUHN71kbAoj m8LiWAxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wVPhQ-00000000INp-26fs; Fri, 05 Jun 2026 08:14:40 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wVPhP-00000000INi-2Ya5 for linux-arm-kernel@lists.infradead.org; Fri, 05 Jun 2026 08:14:39 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 117E843C7C; Fri, 5 Jun 2026 08:14:39 +0000 (UTC) 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) 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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.