WSL2-Linux-Kernel/kernel/cgroup
Waiman Long f386359d1b cgroup: Protect css->cgroup write under css_set_lock
[ Upstream commit 57b56d16800e8961278ecff0dc755d46c4575092 ]

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 <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:07:48 +02:00
..
Makefile cgroup: Add misc cgroup controller 2021-04-04 13:34:46 -04:00
cgroup-internal.h memcg: fix possible use-after-free in memcg_write_event_control() 2022-12-14 11:37:19 +01:00
cgroup-v1.c cgroup: Remove duplicates in cgroup v1 tasks file 2023-10-19 23:05:37 +02:00
cgroup.c cgroup: Protect css->cgroup write under css_set_lock 2024-09-12 11:07:48 +02:00
cpuset.c cgroup/cpuset: Prevent UAF in proc_cpuset_show() 2024-09-04 13:23:38 +02:00
debug.c
freezer.c
legacy_freezer.c
misc.c svm/sev: Register SEV and SEV-ES ASIDs to the misc controller 2021-04-04 13:34:46 -04:00
namespace.c cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-09-19 12:22:47 +02:00
pids.c
rdma.c cgroup: fix spelling mistakes 2021-05-24 12:45:26 -04:00
rstat.c cgroup: Fix rootcg cpu.stat guest double counting 2021-11-18 19:16:45 +01:00