From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, Harry Yoo <harry@kernel.org>,
Jiayuan Chen <jiayuan.chen@linux.dev>,
linux-rt-devel@lists.linux.dev,
Steven Rostedt <rostedt@goodmis.org>,
Clark Williams <clrkwllms@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
linux-kernel@vger.kernel.org,
Florian Bezdeka <florian.bezdeka@siemens.com>
Subject: Re: [PATCH v2] irq_work: Fix use-after-free in irq_work_single on PREEMPT_RT
Date: Tue, 1 Dec 2026 09:41:38 +0100 [thread overview]
Message-ID: <20261201084138.4kc3M7Mp@linutronix.de> (raw)
In-Reply-To: <20261201074102.kypEt88L@linutronix.de>
On 2026-12-01 08:41:02 [+0100], To Vlastimil Babka (SUSE) wrote:
> On 2026-11-27 21:44:52 [+0100], Vlastimil Babka (SUSE) wrote:
> > Hi,
> >
> > for slab we recently got proposed the AI fix below. While it seems correct
> > to me, it feels wrong to do such an ad-hoc workaround. I'd expect there
> > would be other cases where the work is static and no UAF can exist. Can we
> > accomodate them in a generic way? Thanks.
>
> Something like the below with the move of static_obj() to somewhere in
> mm/?
>
> diff --git a/kernel/irq_work.c b/kernel/irq_work.c
> index 73eabcbdcd50c..4e26a4ecdad8c 100644
> --- a/kernel/irq_work.c
> +++ b/kernel/irq_work.c
> @@ -305,7 +305,8 @@ void irq_work_sync(struct irq_work *work)
> * after removing IRQ_WORK_BUSY. It is always
> * accessed within a RCU-read section.
> */
> - synchronize_rcu();
> + if (!static_obj(&work->irqwait))
> + synchronize_rcu();
> return;
> }
I had this in quick testing and it almost hit nothing (as in avoided a
synchronize_rcu()). I got deferred_work_barrier() a few times after a
rmmod btrfs. I got sched_mm_cid_exit() which is non-static way more
often.
Initially I suggested this synchronize_rcu() and a RCU section because
almost everything was in place and cancel+ irq_work_sync() should not
happen *that* often. But it is more often than I expected.
There I am thinking to revive Jiayuan's original patch and solve this
issue without synchronize_rcu() and the need for a RCU read section.
This would avoid both issues.
Sebastian
prev parent reply other threads:[~2026-12-01 8:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-30 7:32 Jiayuan Chen
2026-04-02 6:50 ` Sebastian Andrzej Siewior
2026-06-05 10:31 ` Xi Ruoyao
2026-06-05 10:45 ` Sebastian Andrzej Siewior
2026-06-05 17:26 ` Xi Ruoyao
2026-05-11 14:31 ` [tip: irq/urgent] irq_work: Fix use-after-free in irq_work_single() " tip-bot2 for Jiayuan Chen
2026-08-19 10:44 ` [PATCH v2] irq_work: Fix use-after-free in irq_work_single " Jan Kiszka
2026-08-19 10:52 ` Sebastian Andrzej Siewior
2026-08-19 11:46 ` Jan Kiszka
2026-11-27 20:44 ` Vlastimil Babka (SUSE)
2026-12-01 7:41 ` Sebastian Andrzej Siewior
2026-12-01 8:41 ` Sebastian Andrzej Siewior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201084138.4kc3M7Mp@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=clrkwllms@kernel.org \
--cc=florian.bezdeka@siemens.com \
--cc=harry@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=jiayuan.chen@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®