From: Greg Kroah-Hartman Date: Fri, 27 Sep 2024 12:01:02 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v6.1.112~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5197ee9bc40eaaead48c16b39314896340aed0c0;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch --- diff --git a/queue-5.10/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch b/queue-5.10/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch new file mode 100644 index 00000000000..5552016270a --- /dev/null +++ b/queue-5.10/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch @@ -0,0 +1,66 @@ +From a7fb0423c201ba12815877a0b5a68a6a1710b23a Mon Sep 17 00:00:00 2001 +From: Waiman Long +Date: Thu, 7 Dec 2023 08:46:14 -0500 +Subject: cgroup: Move rcu_head up near the top of cgroup_root +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Waiman Long + +commit a7fb0423c201ba12815877a0b5a68a6a1710b23a upstream. + +Commit d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU +safe") adds a new rcu_head to the cgroup_root structure and kvfree_rcu() +for freeing the cgroup_root. + +The current implementation of kvfree_rcu(), however, has the limitation +that the offset of the rcu_head structure within the larger data +structure must be less than 4096 or the compilation will fail. See the +macro definition of __is_kvfree_rcu_offset() in include/linux/rcupdate.h +for more information. + +By putting rcu_head below the large cgroup structure, any change to the +cgroup structure that makes it larger run the risk of causing build +failure under certain configurations. Commit 77070eeb8821 ("cgroup: +Avoid false cacheline sharing of read mostly rstat_cpu") happens to be +the last straw that breaks it. Fix this problem by moving the rcu_head +structure up before the cgroup structure. + +Fixes: d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU safe") +Reported-by: Stephen Rothwell +Closes: https://lore.kernel.org/lkml/20231207143806.114e0a74@canb.auug.org.au/ +Signed-off-by: Waiman Long +Acked-by: Yafang Shao +Reviewed-by: Yosry Ahmed +Reviewed-by: Michal Koutný +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/cgroup-defs.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -501,6 +501,10 @@ struct cgroup_root { + /* Unique id for this hierarchy. */ + int hierarchy_id; + ++ /* A list running through the active hierarchies */ ++ struct list_head root_list; ++ struct rcu_head rcu; /* Must be near the top */ ++ + /* The root cgroup. Root is destroyed on its release. */ + struct cgroup cgrp; + +@@ -510,10 +514,6 @@ struct cgroup_root { + /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ + atomic_t nr_cgrps; + +- /* A list running through the active hierarchies */ +- struct list_head root_list; +- struct rcu_head rcu; +- + /* Hierarchy-specific flags */ + unsigned int flags; + diff --git a/queue-5.10/series b/queue-5.10/series index c7f3ff8f752..55f992eb196 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -52,3 +52,4 @@ inet-inet_defrag-prevent-sk-release-while-still-in-use.patch x86-ibt-ftrace-search-for-__fentry__-location.patch ftrace-fix-possible-use-after-free-issue-in-ftrace_location.patch gpiolib-cdev-ignore-reconfiguration-without-direction.patch +cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch