From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796306442; b=0zjEXHuNnu7vUlwu4M1bo+oHykWrZrl4VKHygLyxjLWpe6EB771MET21/FV1SM5U9gMB YK6ybKVz9/5Pbn75ia19Mwfrb3rmTqFhkf0ORwVybY6Ei78sQqLNgXyDvTdD5L0tpxQ+w Y1hajw04UR89mdZuS9IZcN96SU4b5WGIuUgfWa059YBZJF+UQQxCGchtviNwW73tHZsGF Iw2+emxiMxSiLPPHYx3xdkatCp5rP4SLWOOSPnFCo6y38SB8dyL9T4AwLj1LWxZZ48xpg hyeZMUD2/X4FiHF+oaqUuCvjCcz3Smxk7mduQAegKiomtLbqwXBBsr1HJpsw8BRqLaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306442; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=ONE+hm+WemsK85d3a8jelN9XHgM65C261viCTz6GYpw=; b=e0+WgRLBIvediKvTLC9sB4AWilv5rJlwpxAHeBaf3NlFL/eLOXdTxWYqVsQ7dN4YSh/5 1yjDlm25cKd4ZFPB3GNiFTxnozNC7xJbj0vdbclNTM0qQyRiIzun5CxjcKQrn5OUGKoMo ywqMgH88FVpv28WD0IGct97ryfXTNTu6gDZ3trl4B5mjJX9io1IOqPUAHWW9twXU2OQ1b YV/MYFl8xJelIGqQASRJSQjXD61iMrswA/UB3bxv8I9l4EZm6xY5H3QjX5Vx2T0Tb5qrI 16055Cj6ea5MVvjthba47ysK2jkjAq5kiiQErwr3pkuifCRCB1rA42ACphOzcvJsRlw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KGCCtmqx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9B98606A322; Thu, 3 Dec 2026 14:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KGCCtmqx Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C4BF1F00893; Thu, 3 Dec 2026 14:00:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796306441; bh=ONE+hm+WemsK85d3a8jelN9XHgM65C261viCTz6GYpw=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=KGCCtmqx3ooiyvcZTOyfn+5NWsMVDIJuvkXpz37J0g5NC/FxeBjpgNqQ4AUm/oLd5 MvDjk7ZfQDBXL9Bga3XXgTL8NoKCvhRoikDpt9iEERoaxWmCKJJMoEv/7zXlt8+ePg ro6BRY/l4i1aTKBz9ChiCpvzFEV96PpHqatCfmA9tw8I8wZKoXST8FA+0OgFnyT1hl LJLAyCN+Jmuf1ki/V996tgLtSXwZCq+BJeLD+ZufzxRf2/ZO+Y35RJ/0kzCOQIxFPL KPMQyfmmcwLUnXrcGLRGzEfSe8yK2pa8nhF/4vJ9xggW2I1+XAvhhjBfHhrpP0DFoy OvlFJvFIbnuFw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v8 04/22] ACPI: APEI: GHES: drain deferred work before freeing a source Reply-To: sashiko-reviews@lists.linux.dev To: "Ahmed Tiba" Cc: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-4-157aac88560b@arm.com> References: <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-0-157aac88560b@arm.com> <20261203-topics-ahmtib01-ras_ffh_arm_internal_review-v8-4-157aac88560b@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 14:00:40 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] ACPI: APEI: irq_work_sync() in ghes_remove() leaves concurrent UAF window - [Low] ACPI: APEI: missing Fixes trailer for commit 21480547c8b8 in ghes_remove() -- commit 3ddf2ff751b2a3ebd22a2b95b293aa447a0715c3 Author: Ahmed Tiba > ACPI: APEI: GHES: drain deferred work before freeing a source > > Queued error status nodes retain a pointer to their struct ghes so that > ghes_proc_in_irq() can process the record later. Device removal stops new > notifications, but it can free that source while previously queued IRQ > work still holds the pointer. > > Drain the global IRQ work after unregistering the notification source and > before releasing the GHES resources. > > Reported-by: sashiko-bot@kernel.org > Link: https://sashiko.dev/#/message/20260617140908.9FEA81F000E9%40smtp.ke= rnel.org > Signed-off-by: Ahmed Tiba [Severity: Low] This looks like a bug fix for the deferred processing path introduced in 21480547c8b8 ("ghes: add the needed hooks for EDAC error report"). Should this include: Fixes: 21480547c8b8 ("ghes: add the needed hooks for EDAC error report") > diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c > index 03eee0b2500e9..dd3a698990e21 100644 > --- a/drivers/acpi/apei/ghes.c > +++ b/drivers/acpi/apei/ghes.c > @@ -1926,6 +1926,7 @@ static void ghes_remove(struct platform_device *ghe= s_dev) > break; > } > =20 > + irq_work_sync(&ghes_proc_irq_work); > ghes_fini(ghes); > =20 > mutex_lock(&ghes_devs_mutex); [Severity: Medium] Can irq_work_sync(&ghes_proc_irq_work) return while another CPU is still dereferencing struct ghes inside ghes_proc_in_irq()? irq_work_single() clears IRQ_WORK_PENDING before invoking work->func(work) and clears the single IRQ_WORK_BUSY bit afterward with atomic_cmpxchg(). Because ghes_proc_irq_work is shared across all CPUs and NMI/SEA/SDEI sources, a second CPU can run it concurrently and clear IRQ_WORK_BUSY first. On !CONFIG_PREEMPT_RT kernels where arch_irq_work_has_interrupt() is true (x86 with APIC and arm64), irq_work_sync() only spins on IRQ_WORK_BUSY without an RCU grace period. Because sdei_unregister_ghes() also skips synchronize_rcu(), ghes_remove() can free struct ghes during ghes_do_proc(): CPU0 CPU1 CPU2 irq_work_single() clear IRQ_WORK_PENDING ghes_proc_in_irq() pop ghes_A node irq_work_queue() irq_work_single() clear IRQ_WORK_PENDING ghes_proc_in_irq() clear IRQ_WORK_BUSY ghes_remove(ghes_A) irq_work_sync() /* BUSY =3D=3D 0 */ ghes_fini(ghes_A) kfree(ghes_A) ghes_do_proc(ghes_A) <-- use-after-free Calling synchronize_rcu() after irq_work_sync(&ghes_proc_irq_work) would wait for any in-flight ghes_proc_in_irq() to complete, since irq_work runs with IRQs disabled on !CONFIG_PREEMPT_RT and in an RCU read-side critical section on CONFIG_PREEMPT_RT. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-topics-ahm= tib01-ras_ffh_arm_internal_review-v8-0-157aac88560b@arm.com?part=3D4