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=1796380339; b=jdxk2I3MAOZ/kbIoVsgOmEnGnDCe0nOS1fRnYys+zgpWUAtc0VXeLOeMmsBRlHVtGmKt EhT7NTpMGyG82ALhy44lFf/MJ7h2zzN+QRtVdtYatwOKMDjeQcEidf+gyqQb0YZDt47Ee 1PVhi4BZwUZ8ZUwEV0tR9o2pJeX0CPj7km7Z+n3l4OLyXNPdMB0wDZ4CV4jUl5p704sCU jACjlSr6AveCrcxbckGZvhGgdboHwiqVl0ZL0KOZcIWopB7/V68mhCEFgPpGQtnZ5FX4B UqAUzNfID0xkvnJF1mvld31tnLRf2BhdEE/lb5rHt8WQdExee1uA58mW8Wfza++WsLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380339; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=u/QftbvwMVbqFbreiCs08qpSQ1to7Kheuf2qqXh2HR4=; b=Il7+fkSB16Ksg/96QCWV4PJMLD778RTz01A/e9qlTsDHr7YwXXTb2kiTOHWXwHtXw5J5 FTZZDUjC0My3GnHct7gTCc4ybu6bl7YNY7G3FiFD3Zx0i/8Fs2jKJfZqqTiMjtk9QhtZ+ UPiQEvTelAtvCEy9DCfaNTWUCrr/UPneeqvQMpBMTAyzkHqN+FcEoqaADPS4UtyY87VaM LkFWgbcbV4fSFElN933ePrVvHrKb+u5BLplyobonEwJaQ8IM0xkFZ00wHuwEZa37X2Ww0 hcUMxiZnxIfpTX05de81+EMlAzxyLtPvy+1eA80TbDHLjHbgpLTlraDzVYDdEW5UKOg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=q8ohwURB; 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 C651A606A322; Fri, 4 Dec 2026 10:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=q8ohwURB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EF501F000C2; Fri, 4 Dec 2026 10:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380339; bh=u/QftbvwMVbqFbreiCs08qpSQ1to7Kheuf2qqXh2HR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=q8ohwURBSgy4n/9q6gRf1IPRLvJBxm+Zg7Pu7l6FJ0aBia7qFUMjyuvHPEC5uiIYt tfgg8lBgLd3RDN3/zDogp/SZwnirUUPgPVg4ol/AMtZMC0EeZ0Xd+lnxToLK+AcWN1 aHgcVNqWIIHWGZsveQKFzcOiRCaPSgiduBGAz0xM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiayuan Chen , Karl Mehltretter , Shakeel Butt , Tejun Heo , Sasha Levin Subject: [PATCH 7.3 232/742] cgroup/rstat: disable preemption in css_rstat_updated() Date: Fri, 4 Dec 2026 19:01:36 +0900 Message-ID: <20261204100641.234051826@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Karl Mehltretter [ Upstream commit c99f50e4acf86bfbbe313d79f281d83be1763260 ] BPF programs can call css_rstat_updated() with preemption enabled. The kfunc calls __css_rstat_updated(), which requires preemption to be disabled while it queues an rstat update. A cgroup iterator can hit the lockdep assertion on both RT and non-RT kernels. The cgroup_hierarchical_stats selftest can also hit it on PREEMPT_RT: spin_lock_irqsave() on trace_cgroup_path_lock leaves preemption and interrupts enabled there. Disable preemption in the BPF wrapper after validating the CPU and before calling __css_rstat_updated(). Fixes: 36df6e3dbd7e ("cgroup: make css_rstat_updated nmi safe") Reported-by: Jiayuan Chen Closes: https://lore.kernel.org/r/20251119111402.153727-1-jiayuan.chen@linux.dev/ Signed-off-by: Karl Mehltretter Acked-by: Shakeel Butt Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin --- kernel/cgroup/rstat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/cgroup/rstat.c b/kernel/cgroup/rstat.c index de816a43db9f0..d72fe721cea05 100644 --- a/kernel/cgroup/rstat.c +++ b/kernel/cgroup/rstat.c @@ -131,6 +131,7 @@ __bpf_kfunc void css_rstat_updated(struct cgroup_subsys_state *css, int cpu) if (unlikely(cpu < 0 || cpu >= nr_cpu_ids || !cpu_possible(cpu))) return; + guard(preempt)(); __css_rstat_updated(css, cpu); } -- 2.53.0