CVE-2026-98163
Publication date:
26/09/2026
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
cgroup: Avoid iteration of dying tasks with zero refcount<br />
<br />
The commit 260fbcb92bbea ("cgroup: Move dying_tasks cleanup from<br />
cgroup_task_release() to cgroup_task_free()") extended the lifetime of<br />
tasks on the dying_tasks list.<br />
The iterators have provision to go through dying_tasks because of<br />
dying threadgroup leaders or explicit CSS_TASK_ITER_WITH_DEAD, however,<br />
it was expected that such tasks can obtain a new reference (that is<br />
possible before cgroup_task_release()/put_task_struct_rcu_user()).<br />
The tasks after cgroup_task_release() and before cgroup_task_free()<br />
are subject to race when they may or may not have ->usage count > 0.<br />
<br />
The race window is between css_task_iter_next() invocations<br />
when css_set_lock is released and we may arrive at a new ->task_pos.<br />
The iterator should not attempt to resurrect tasks whose ->usage count<br />
dropped to zero. (When that happens, __put_task_struct_rcu_cb() is<br />
already imminent and the returned task_struct would could be used<br />
after free.)<br />
<br />
As for the fix, we cannot simply check the signal->live count of a task<br />
on the dying list because that won&#39;t distinguish regular zombies waiting<br />
to be reaped from RCU remnant tasks that are going to be free&#39;d.<br />
Therefore add an extra check to rule out ->usage==0 tasks from any<br />
iteration.<br />
<br />
The repeat: loop in css_task_iter_advance() doesn&#39;t consider ->usage<br />
count, so add a new loop to css_task_iter_next() to skip de-used tasks<br />
on the dying_list.<br />
<br />
Rough illustration of the possible race<br />
<br />
R (reader of cgroup.procs) T (thread) L (group leader)<br />
--------------------------------- -------------------------------- --------------------------------<br />
L exits, signal->live > 0<br />
cgroup_task_dead(L)<br />
css_set_skip_task_iters() // skips only cset->tasks<br />
list_add_tail(&L->cg_list, &cset->dying_tasks)<br />
css_task_iter_next()<br />
take css_set_lock<br />
css_task_iter_advance()<br />
leader && signal->live != 0<br />
=> it->task_pos = &L->cg_list<br />
release css_set_lock<br />
T exits<br />
--signal->live == 0<br />
cgroup_task_dead(T) // css_set_lock<br />
release_task(T)<br />
cgroup_task_release(T)<br />
release_task(L) // zap_leader<br />
cgroup_task_release(L)<br />
put_task_struct_rcu_user(L)<br />
...RCU...<br />
put_task_struct(L)<br />
L->usage = 0<br />
/* L still on dying_tasks */<br />
...RCU...<br />
__put_task_struct(L)<br />
css_task_iter_next() // another iteration<br />
take css_set_lock<br />
it->task_pos = &L->cg_list<br />
get_task_struct(L)<br />
=> addition on 0<br />
drop css_set_lock<br />
cgroup_task_free(L)<br />
css_set_skip_task_iters() // dying skip comes too late<br />
free_task(L)<br />
cgroup_procs_show()<br />
task_pid_vnr(L)
Severity CVSS v4.0: Pending analysis
Last modification:
19/10/2026