Re: [PATCH] cgroup: Avoid iteration of dying tasks with zero refcount

From: Noah Feldt

Date: Mon Sep 07 2026 - 11:55:59 EST


On Wed, Sep 02, 2026 at 08:59:39AM -1000, Tejun Heo wrote:
> How about something like the following? It's more in line with other skips
> and the resulting behavior should remain the same as before:
>
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -5228,6 +5229,21 @@
> + if (it->task_pos && it->cur_tasks_head == &it->cur_cset->dying_tasks) {
> + task = list_entry(it->task_pos, struct task_struct, cg_list);
> + if (!atomic_read(&task->signal->live))
> + css_task_iter_advance(it);
> + }

I tested this change and the crash did not happen anymore with the second
PoC I sent.

Thanks,
Noah

Attachment: publickey - noah@feldt.systems - 0x9B02BBB4.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature