From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19F9FE7C4E9 for ; Wed, 4 Oct 2023 18:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243848AbjJDSIM (ORCPT ); Wed, 4 Oct 2023 14:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243846AbjJDSIL (ORCPT ); Wed, 4 Oct 2023 14:08:11 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D14F7A7 for ; Wed, 4 Oct 2023 11:08:08 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C27C433C8; Wed, 4 Oct 2023 18:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696442888; bh=vu48hY+zeCM3ilziIWj36ikEpNMisY34X4QMtfUJwiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8PL/zyUKdsVBLOpPETUAh/WeZMLFv8TIUgTU+lJK/xTXmLMKq1XRTyB/Q2DQCskc WcXKiLNaBk7LWt/knCl6IzSROE8ZUK5wBi/h+hJ73fmJNFbr+s+qzdBXk0XV8Is9Ft j/yk6htQg4d1h/NEh+Vt/+CfE5eRe83ZkmtUDay4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linux Kernel Functional Testing , syzbot+16e3f2c77e7c5a0113f9@syzkaller.appspotmail.com, Chengming Zhou , "Peter Zijlstra (Intel)" , Tejun Heo , Zhouyi Zhou , Marek Szyprowski , Ovidiu Panait , Sasha Levin Subject: [PATCH 5.15 144/183] cgroup: Fix suspicious rcu_dereference_check() usage warning Date: Wed, 4 Oct 2023 19:56:15 +0200 Message-ID: <20231004175210.036626286@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004175203.943277832@linuxfoundation.org> References: <20231004175203.943277832@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chengming Zhou commit f2aa197e4794bf4c2c0c9570684f86e6fa103e8b upstream. task_css_set_check() will use rcu_dereference_check() to check for rcu_read_lock_held() on the read-side, which is not true after commit dc6e0818bc9a ("sched/cpuacct: Optimize away RCU read lock"). This commit drop explicit rcu_read_lock(), change to RCU-sched read-side critical section. So fix the RCU warning by adding check for rcu_read_lock_sched_held(). Fixes: dc6e0818bc9a ("sched/cpuacct: Optimize away RCU read lock") Reported-by: Linux Kernel Functional Testing Reported-by: syzbot+16e3f2c77e7c5a0113f9@syzkaller.appspotmail.com Signed-off-by: Chengming Zhou Signed-off-by: Peter Zijlstra (Intel) Acked-by: Tejun Heo Tested-by: Zhouyi Zhou Tested-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220305034103.57123-1-zhouchengming@bytedance.com Signed-off-by: Ovidiu Panait Signed-off-by: Sasha Levin --- include/linux/cgroup.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index f425389ce4bb2..0d97d1cf660f7 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -451,6 +451,7 @@ extern struct mutex cgroup_mutex; extern spinlock_t css_set_lock; #define task_css_set_check(task, __c) \ rcu_dereference_check((task)->cgroups, \ + rcu_read_lock_sched_held() || \ lockdep_is_held(&cgroup_mutex) || \ lockdep_is_held(&css_set_lock) || \ ((task)->flags & PF_EXITING) || (__c)) -- 2.40.1