Repository navigation
Commit 3bc0bb3
cgroup: Prevent double killing of css when enabling threaded cgroup
The test_cgcore_no_internal_process_constraint_on_threads selftest when
running with subsystem controlling noise triggers two warnings:
> [ 597.443115] WARNING: CPU: 1 PID: 28167 at kernel/cgroup/cgroup.c:3131 cgroup_apply_control_enable+0xe0/0x3f0
> [ 597.443413] WARNING: CPU: 1 PID: 28167 at kernel/cgroup/cgroup.c:3177 cgroup_apply_control_disable+0xa6/0x160
Both stem from a call to cgroup_type_write. The first warning was also
triggered by syzkaller.
When we're switching cgroup to threaded mode shortly after a subsystem
was disabled on it, we can see the respective subsystem css dying there.
The warning in cgroup_apply_control_enable is harmless in this case
since we're not adding new subsys anyway.
The warning in cgroup_apply_control_disable indicates an attempt to kill
css of recently disabled subsystem repeatedly.
The commit prevents these situations by making cgroup_type_write wait
for all dying csses to go away before re-applying subtree controls.
When at it, the locations of WARN_ON_ONCE calls are moved so that
warning is triggered only when we are about to misuse the dying css.
Reported-by: syzbot+5493b2a54d31d6aea629@syzkaller.appspotmail.com
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>1 parent 75ea91c commit 3bc0bb3
1 file changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3055 | 3055 | | |
3056 | 3056 | | |
3057 | 3057 | | |
3058 | | - | |
3059 | | - | |
3060 | 3058 | | |
3061 | 3059 | | |
3062 | 3060 | | |
| |||
3066 | 3064 | | |
3067 | 3065 | | |
3068 | 3066 | | |
| 3067 | + | |
| 3068 | + | |
3069 | 3069 | | |
3070 | 3070 | | |
3071 | 3071 | | |
| |||
3101 | 3101 | | |
3102 | 3102 | | |
3103 | 3103 | | |
3104 | | - | |
3105 | | - | |
3106 | 3104 | | |
3107 | 3105 | | |
3108 | 3106 | | |
| 3107 | + | |
| 3108 | + | |
3109 | 3109 | | |
3110 | 3110 | | |
3111 | 3111 | | |
| |||
3392 | 3392 | | |
3393 | 3393 | | |
3394 | 3394 | | |
3395 | | - | |
| 3395 | + | |
| 3396 | + | |
3396 | 3397 | | |
3397 | 3398 | | |
3398 | 3399 | | |
| |||
0 commit comments