summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAvi Weiss <thnkslprpt@gmail.com>2026-10-20 21:11:01 +0300
committerChristian Brauner <brauner@kernel.org>2026-10-22 18:50:20 +0200
commit4bd3a0e8e53decd614853fbb487a268f139f679e (patch)
treed8dddf1c2017d1d9b99c1a5ac0f878662358c534 /kernel
parent716d2968c8fdf786c4fb4e1820820a6f54b89b6d (diff)
downloadlinux-4bd3a0e8e53decd614853fbb487a268f139f679e.tar.gz
linux-4bd3a0e8e53decd614853fbb487a268f139f679e.zip
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 <thnkslprpt@gmail.com> Link: https://patch.msgid.link/20261020181101.1605736-1-thnkslprpt@gmail.com Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/signal.c5
1 files 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;
}