Re: [patch V3 1/8] signal: Prevent exec() race
From: Andrea Parri
Date: Wed Sep 16 2026 - 16:38:08 EST
> @@ -1030,6 +1069,10 @@ static int __send_signal_locked(int sig,
> lockdep_assert_held(&t->sighand->siglock);
>
> result = TRACE_SIGNAL_IGNORED;
> +
> + if (!task_can_queue_signal(t, type))
> + goto ret;
> +
> if (!prepare_signal(sig, t, force))
> goto ret;
Should this check sit after prepare_signal() rather than before it?
The comment on task_can_queue_signal() and the changelog both describe the
new check as preventing a sigqueue from being queued and leaked, but placing
it ahead of prepare_signal() also skips the process wide stop/continue
handling, which prepare_signal() documents as happening even for signals that
are never queued. Moving the check below prepare_signal() looks like it would
keep the stop and continue side effects while still preventing the sigqueue
from being queued, since prepare_signal() only removes entries from
task::pending and never adds any.
Andrea