Re: [PATCH V2] signal: Prevent exec() race
From: Oleg Nesterov
Date: Wed Sep 02 2026 - 07:33:21 EST
On 09/01, Thomas Gleixner wrote:
>
> @@ -3130,8 +3148,12 @@ void exit_signals(struct task_struct *ts
> cgroup_threadgroup_change_begin(tsk);
>
> if (thread_group_empty(tsk) || (tsk->signal->flags & SIGNAL_GROUP_EXIT)) {
> - tsk->flags |= PF_EXITING;
> + scoped_guard(spinlock_irq, &tsk->sighand->siglock) {
> + tsk->flags |= PF_EXITING;
> + sigqueue_dequeue_pending(&tsk->pending, &sigq_list);
> + }
> cgroup_threadgroup_change_end(tsk);
> + flush_sigqueue_list(&sigq_list);
> return;
OK... lets suppose the exiting task T passes exit_signals().
Suppose we have an "ignored" timer tmr. Another sub-thread calls
do_sigaction() -> posixtimer_sig_unignore() and finds that tmr
in ->ignored_posix_timers list.
But posixtimer_queue_sigqueue() doesn't check PF_EXITING, I guess
it should check it too?
Or perhaps it makes more sense to check PF_EXITING in
posixtimer_get_target() ?
Oleg.