Commit 57b56d1
cgroup: Protect css->cgroup write under css_set_lock
The writing of css->cgroup associated with the cgroup root in
rebind_subsystems() is currently protected only by cgroup_mutex.
However, the reading of css->cgroup in both proc_cpuset_show() and
proc_cgroup_show() is protected just by css_set_lock. That makes the
readers susceptible to racing problems like data tearing or caching.
It is also a problem that can be reported by KCSAN.
This can be fixed by using READ_ONCE() and WRITE_ONCE() to access
css->cgroup. Alternatively, the writing of css->cgroup can be moved
under css_set_lock as well which is done by this patch.
Signed-off-by: Waiman Long <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>1 parent 1be59c9 commit 57b56d1
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1839 | 1839 | | |
1840 | 1840 | | |
1841 | 1841 | | |
1842 | | - | |
1843 | 1842 | | |
1844 | 1843 | | |
| 1844 | + | |
1845 | 1845 | | |
1846 | 1846 | | |
1847 | 1847 | | |
| |||
0 commit comments