[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YxT7NASKiuZDx6PT@slm.duckdns.org>
Date: Sun, 4 Sep 2022 09:23:32 -1000
From: Tejun Heo <tj@...nel.org>
To: Christian Brauner <brauner@...nel.org>
Cc: Gabriel Ryan <gabe@...columbia.edu>,
Abhishek Shah <abhishek.shah@...umbia.edu>,
linux-kernel@...r.kernel.org, andrii@...nel.org, ast@...nel.org,
bpf@...r.kernel.org, cgroups@...r.kernel.org, daniel@...earbox.net,
hannes@...xchg.org, john.fastabend@...il.com, kafai@...com,
kpsingh@...nel.org, lizefan.x@...edance.com,
netdev@...r.kernel.org, songliubraving@...com, yhs@...com
Subject: [PATCH cgroup/for-6.1] cgroup: Remove data-race around
cgrp_dfl_visible
>From dc79ec1b232ad2c165d381d3dd2626df4ef9b5a4 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@...nel.org>
Date: Sun, 4 Sep 2022 09:16:19 -1000
There's a seemingly harmless data-race around cgrp_dfl_visible detected by
kernel concurrency sanitizer. Let's remove it by throwing WRITE/READ_ONCE at
it.
Signed-off-by: Tejun Heo <tj@...nel.org>
Reported-by: Abhishek Shah <abhishek.shah@...umbia.edu>
Cc: Gabriel Ryan <gabe@...columbia.edu>
Reviewed-by: Christian Brauner (Microsoft) <brauner@...nel.org>
Link: https://lore.kernel.org/netdev/20220819072256.fn7ctciefy4fc4cu@wittgenstein/
---
Applied to cgroup/for-6.1.
Thanks.
kernel/cgroup/cgroup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 0005de2e2ed9..e0b72eb5d283 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2173,7 +2173,7 @@ static int cgroup_get_tree(struct fs_context *fc)
struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
int ret;
- cgrp_dfl_visible = true;
+ WRITE_ONCE(cgrp_dfl_visible, true);
cgroup_get_live(&cgrp_dfl_root.cgrp);
ctx->root = &cgrp_dfl_root;
@@ -6098,7 +6098,7 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
struct cgroup *cgrp;
int ssid, count = 0;
- if (root == &cgrp_dfl_root && !cgrp_dfl_visible)
+ if (root == &cgrp_dfl_root && !READ_ONCE(cgrp_dfl_visible))
continue;
seq_printf(m, "%d:", root->hierarchy_id);
--
2.37.3
Powered by blists - more mailing lists