Re: [patch V2 1/8] signal: Prevent exec() race
From: Eric W. Biederman
Date: Sun Sep 06 2026 - 18:40:06 EST
Thomas Gleixner <tglx@xxxxxxxxxx> writes:
> @@ -1019,6 +1029,21 @@ static inline bool legacy_queue(struct s
> return (sig < SIGRTMIN) && sigismember(&signals->signal, sig);
> }
>
> +/*
> + * When PF_EXITING is set the task is on the way out and has t::pending
> + * flushed already. Prevent queueing of PIDTYPE_PID signals as they would
> + * be leaked.
> + */
> +static inline bool task_can_queue_signal(struct task_struct *t, enum pid_type type)
> +{
> + lockdep_assert_held(&t->sighand->siglock);
> +
> + if (!(t->flags & PF_EXITING))
> + return true;
> +
I don't know if we care but I just noticed that this disallows
using tkill(..., SIGKILL) or tgkill(..., SIGKILL) to stop coredumps.
> + return type != PIDTYPE_PID;
> +}
> +
> static int __send_signal_locked(int sig, struct kernel_siginfo *info,
> struct task_struct *t, enum pid_type type, bool force)
> {
Eric