Re: [syzbot] [kernel?] WARNING in posixtimer_send_sigqueue
From: Hillf Danton
Date: Fri Nov 15 2024 - 18:27:12 EST
On Fri, 15 Nov 2024 21:55:02 +0100 Frederic Weisbecker <frederic@xxxxxxxxxx>
>
> Can you test on git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> timers/core instead?
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
--- x/kernel/signal.c
+++ y/kernel/signal.c
@@ -2003,9 +2003,15 @@ void posixtimer_send_sigqueue(struct k_i
if (!prepare_signal(sig, t, false)) {
result = TRACE_SIGNAL_IGNORED;
- /* Paranoia check. Try to survive. */
- if (WARN_ON_ONCE(!list_empty(&q->list)))
+ if (!list_empty(&q->list)) {
+ /*
+ * If task group is exiting with the signal already pending,
+ * wait for __exit_signal() to do its job. Otherwise if
+ * ignored, it's not supposed to be queued. Try to survive.
+ */
+ WARN_ON_ONCE(!(t->signal->flags & SIGNAL_GROUP_EXIT));
goto out;
+ }
/* Periodic timers with SIG_IGN are queued on the ignored list */
if (tmr->it_sig_periodic) {
--