Re: [PATCH] signal: skip blocked signals in dequeue_synchronous_signal()
From: Oleg Nesterov
Date: Wed Oct 21 2026 - 03:48:37 EST
On 10/20, Avi Weiss wrote:
>
> dequeue_synchronous_signal() checks whether an unblocked
> synchronous signal is pending, but its queue scan can select a
> different blocked entry with a positive si_code. This can deliver
> a signal while it is still blocked.
Heh ;) I can't understand how no one noticed this before.
> /*
> - * Return the first synchronous signal in the queue.
> + * Return the first unblocked synchronous signal in the queue.
> */
> list_for_each_entry(q, &pending->list, list) {
> /* Synchronous signals have a positive si_code */
> if ((q->info.si_code > SI_USER) &&
> - (sigmask(q->info.si_signo) & SYNCHRONOUS_MASK)) {
> + (sigmask(q->info.si_signo) & SYNCHRONOUS_MASK) &&
> + !sigismember(&tsk->blocked, q->info.si_signo)) {
> sync = q;
> goto next;
> }
Thanks! I'll send a minor cleanup on top of this patch later.
CC: stable@xxxxxxxxxxxxxxx
Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>