From 4bd3a0e8e53decd614853fbb487a268f139f679e Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Tue, 20 Oct 2026 21:11:01 +0300 Subject: [PATCH] signal: skip blocked signals in dequeue_synchronous_signal() 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. Check the blocked mask for each queued entry. Forced faults are unblocked when necessary by force_sig_info_to_task(), and the existing pending bookkeeping is unchanged. Fixes: 7146db3317c6 ("signal: Better detection of synchronous signals") Signed-off-by: Avi Weiss Link: https://patch.msgid.link/20261020181101.1605736-1-thnkslprpt@gmail.com Acked-by: Oleg Nesterov Signed-off-by: Christian Brauner (Amutable) --- kernel/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index cb6ec7054eee..dd770e68faee 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -684,12 +684,13 @@ static int dequeue_synchronous_signal(kernel_siginfo_t *info) return 0; /* - * 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; }