Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796110866; b=2c3TKtfu98KjZbdNSJTXqR7cZCUGW/Q77O6zPk16PPYH1TV0sTIX9cFFA1NJHIRGa06w 4JRSEctF/YeQQ5WnQaRngiixafImgi0mqksOcmXm84WkjpWbnvf7tjuF+3//h/zChKL8i bznmGHWYQN4Pq69hRsd0/dLhRrp+ZltDPU/iHT2h+yvcCp33xxX/cEKkUfcMAfQI5jpey sLCBjYKGhzWd1LsXqL0XYx5eAWNNng6PAom2LR6poYmtGYbg6Nm3wisV0AGo9dRGI89ac zfo2k5U3h0ofezKOQjp219YNqpLx+uzfV9ugfgUTE6/+/DVLiD0UsJPn1hPGLft7tww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796110866; h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=Nq+WCtSdIyabBTQ4sjqU0TBJntDHgxHozME1f7iOVC8=; b=35PdtRCjImJnZCNB/kcPoBq8LVdMBztuQhmGjNHQRypsXMV6e6ECqYBSE7Zsc9KZczr8 9G+pglKRkxe9Ybs7Mv0eYKXTa6WINjODeuPuiNhf/L96f2Jf6v20yzix+KI4+hqUT8T11 bL6BcXbaMddWaa14gwrMaOQLiO+K/wkToYRcpkh4+PLitR/iM2+zWDxq/uf2CXtUsIcnQ eJ9BNduqYyw6ZgWSuw4r0QJWo8FfeRA/9Cfx/ZeurTqMXS24K8oTctBp36Pli4kvo9P2Y f2gRVTw98uUa20p11iOhU/z7qPm4+qOq67/LM40DVV9M3ZG7GTZjkwKd3gKTxpJ8lKw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=Kz1zWH6D; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=SNsE7GHk; arc=none smtp.remote-ip=193.142.43.55 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31BCA606A31A for ; Tue, 1 Dec 2026 07:41:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31BCA606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=Kz1zWH6D; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=SNsE7GHk Date: Tue, 1 Dec 2026 08:41:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1796110864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Nq+WCtSdIyabBTQ4sjqU0TBJntDHgxHozME1f7iOVC8=; b=Kz1zWH6D95TyOpVDgwyTLzgsXURWOod4WWz6Gv/MNsQ4yNFadOqSZFjyBPwzvNgmgZlpZ6 rNWoE6uvrSRRxZVJbwkEa7qcqMgmVmGcLjS3z3TKUtesUHuosUfXGRadGLjW3KvAz0wmh9 gK1eyafdFASD/nw0h39FimizAgGkT65o2hqhjCR7Hlg2YpPlQ0biJnYNjgCKfdf1Mz547s jhGbtPfjCd2vXBJKQTieX4znjzyXjNtb3feyfRNGoEVuV8NUQ34eTr/RK/VR0GDyn4O0W2 OlX3luAKDBJA/YxI0n7Q25nKrFY8XOSvAQFJanR6QRcsCUMzrojeZkBpduHhBw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1796110864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Nq+WCtSdIyabBTQ4sjqU0TBJntDHgxHozME1f7iOVC8=; b=SNsE7GHkQUA7tt5oy+uOn9Tqcmv5gVZv7ntRztMZ1rmHF7B73ilQsFwMsY1zLSUL+ceMBX BRSGTZd5Kd0GioBw== From: Sebastian Andrzej Siewior To: "Vlastimil Babka (SUSE)" Cc: Jan Kiszka , Harry Yoo , Jiayuan Chen , linux-rt-devel@lists.linux.dev, Steven Rostedt , Clark Williams , "Peter Zijlstra (Intel)" , linux-kernel@vger.kernel.org, Florian Bezdeka Subject: Re: [PATCH v2] irq_work: Fix use-after-free in irq_work_single on PREEMPT_RT Message-ID: <20261201074102.kypEt88L@linutronix.de> References: <20260330073234.303732-1-jiayuan.chen@linux.dev> <16fda1b1-2c72-4d05-b1c8-f424ac2848c6@siemens.com> <20260819105259.7ENaDrl2@linutronix.de> <60887e69-ae28-495c-a6d7-7d0a94fd1aa8@siemens.com> <5c553fca-3a7a-4bd6-b41a-00594f854440@kernel.org> X-Mailing-List: linux-rt-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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