mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 08:41:02 +0100	[thread overview]
Message-ID: <20261201074102.kypEt88L@linutronix.de> (raw)
In-Reply-To: <5c553fca-3a7a-4bd6-b41a-00594f854440@kernel.org>

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;
 	}
 
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index fdae495bf918b..08dbdcbc46687 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -840,7 +840,7 @@ static int very_verbose(struct lock_class *class)
  * Is this the address of a static object:
  */
 #ifdef __KERNEL__
-static int static_obj(const void *obj)
+int static_obj(const void *obj)
 {
 	unsigned long addr = (unsigned long) obj;
 

Sebastian

  reply	other threads:[~2026-12-01  7: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 [this message]
2026-12-01  8:41           ` Sebastian Andrzej Siewior

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=20261201074102.kypEt88L@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®