Re: [PATCH] signal: Use list_del_init_careful() in flush_sigqueue()

From: Thomas Gleixner

Date: Thu Aug 27 2026 - 05:35:23 EST


On Wed, Aug 26 2026 at 22:29, Eric W. Biederman wrote:
> Could the posix timers cleanup be moved from __exit_signal in
> release_task (which is really for cleanup for zombies but has
> been historically abused because it was the only place that
> knew when the whole group was dead), into somewhere in do_exit?
>
> Say near where hrtimers_cancel and exit_itimers are called.

That's only for the group_dead case in do_exit().

But a single task existing from a process needs to clean up
task::pending, i.e. signals which are targeted at the exiting task.

The safe and obvious place is to do that is _after_ setting
task::sighand to NULL because that ensures that no new signal can be
queued and nothing can touch task::pending anymore.

> Then perhaps move the posix timer disabling before de_thread?

That does not work because between that and de_thread() any thread of
the thread group can create a new posix timer unless we prevent that
somehow in timer_create().

So in any case we need some mechanism in posixtimer related code to
handle this situation gracefully.

Thanks,

tglx