Commit dc79ec1b authored by Tejun Heo's avatar Tejun Heo

cgroup: Remove data-race around cgrp_dfl_visible

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: default avatarTejun Heo <tj@kernel.org>
Reported-by: default avatarAbhishek Shah <abhishek.shah@columbia.edu>
Cc: Gabriel Ryan <gabe@cs.columbia.edu>
Reviewed-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
Link: https://lore.kernel.org/netdev/20220819072256.fn7ctciefy4fc4cu@wittgenstein/
parent c0f2df49
...@@ -2173,7 +2173,7 @@ static int cgroup_get_tree(struct fs_context *fc) ...@@ -2173,7 +2173,7 @@ static int cgroup_get_tree(struct fs_context *fc)
struct cgroup_fs_context *ctx = cgroup_fc2context(fc); struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
int ret; int ret;
cgrp_dfl_visible = true; WRITE_ONCE(cgrp_dfl_visible, true);
cgroup_get_live(&cgrp_dfl_root.cgrp); cgroup_get_live(&cgrp_dfl_root.cgrp);
ctx->root = &cgrp_dfl_root; ctx->root = &cgrp_dfl_root;
...@@ -6098,7 +6098,7 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns, ...@@ -6098,7 +6098,7 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
struct cgroup *cgrp; struct cgroup *cgrp;
int ssid, count = 0; int ssid, count = 0;
if (root == &cgrp_dfl_root && !cgrp_dfl_visible) if (root == &cgrp_dfl_root && !READ_ONCE(cgrp_dfl_visible))
continue; continue;
seq_printf(m, "%d:", root->hierarchy_id); seq_printf(m, "%d:", root->hierarchy_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment