Re: [PATCH v2] signal: respect the blocked mask in dequeue_synchronous_signal()
From: Oleg Nesterov
Date: Thu Oct 22 2026 - 08:05:06 EST
On 10/22, Avi Weiss wrote:
>
> Changes in v2:
> - Restore the original queue-scan comment following Eric's feedback.
> - Clarify that ordinarily queued signals can match the
> synchronous-signal heuristic.
> - Rebase onto current mainline.
>
> kernel/signal.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index cb6ec7054eee..7e690f4fb5bc 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -689,7 +689,8 @@ static int dequeue_synchronous_signal(kernel_siginfo_t *info)
> 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)) {
Still:
CC: stable@xxxxxxxxxxxxxxx
Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>
I was going to send another cleanup on top of this fix. Can't do this today,
but let me explain... It is a bit ugly to check si_signo twice. And afaics we
have another problem. sys_rt_sigqueueinfo() allows to send a SI_FROMKERNEL RT
signal to itself. In this case sigmask(q->info.si_signo) leads to UB on 32-bit.
I'll recheck, write the changelog, and send something like below tomorrow.
perhaps rt_sigmask() makes more sense than sigset_t...
Oleg.