]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Aug 2024 12:40:22 +0000 (14:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Aug 2024 12:40:22 +0000 (14:40 +0200)
added patches:
cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch

queue-6.1/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch b/queue-6.1/cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch
new file mode 100644 (file)
index 0000000..bf30189
--- /dev/null
@@ -0,0 +1,66 @@
+From a7fb0423c201ba12815877a0b5a68a6a1710b23a Mon Sep 17 00:00:00 2001
+From: Waiman Long <longman@redhat.com>
+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 <longman@redhat.com>
+
+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 <sfr@canb.auug.org.au>
+Closes: https://lore.kernel.org/lkml/20231207143806.114e0a74@canb.auug.org.au/
+Signed-off-by: Waiman Long <longman@redhat.com>
+Acked-by: Yafang Shao <laoar.shao@gmail.com>
+Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
+Reviewed-by: Michal Koutný <mkoutny@suse.com>
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -525,6 +525,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. The containing cgroup_root will be destroyed on its
+        * release. cgrp->ancestors[0] will be used overflowing into the
+@@ -538,10 +542,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;
index e14e8ccf8d8ece662fe14b4db975b1ab154948a6..034022327460a5582581ff4ef8116a19fbb46953 100644 (file)
@@ -33,3 +33,4 @@ drm-i915-add-a-function-to-mmap-framebuffer-obj.patch
 drm-i915-fix-a-null-vs-is_err-bug.patch
 drm-i915-gem-adjust-vma-offset-for-framebuffer-mmap-.patch
 binfmt_flat-fix-corruption-when-not-offsetting-data-.patch
+cgroup-move-rcu_head-up-near-the-top-of-cgroup_root.patch