[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZzYqE-L-9Ga3Fe7n@localhost.localdomain>
Date: Thu, 14 Nov 2024 17:49:23 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: syzbot <syzbot+852e935b899bde73626e@...kaller.appspotmail.com>
Cc: jstultz@...gle.com, linux-kernel@...r.kernel.org, sboyd@...nel.org,
syzkaller-bugs@...glegroups.com, tglx@...utronix.de
Subject: Re: [syzbot] [kernel?] WARNING in posixtimer_send_sigqueue
Le Wed, Nov 13, 2024 at 04:52:22PM -0800, syzbot a écrit :
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 929beafbe7ac Add linux-next specific files for 20241108
> git tree: linux-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=10f714e8580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=75175323f2078363
> dashboard link: https://syzkaller.appspot.com/bug?extid=852e935b899bde73626e
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14f714e8580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1657b0c0580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/9705ecb6a595/disk-929beafb.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/dbdd1f64b9b8/vmlinux-929beafb.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/3f70d07a929b/bzImage-929beafb.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+852e935b899bde73626e@...kaller.appspotmail.com
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 5854 at kernel/signal.c:2008
> posixtimer_send_sigqueue+0x9da/0xbc0 kernel/signal.c:2008
That's because prepare_signal() does not only return false when the signal is
ignored but also when the task group is exiting. It's possible that the task
enters in do_exit() with pending signal and then the timer is reset and a new
signal is queued before the sighand dies.
This should fix it:
diff --git a/kernel/signal.c b/kernel/signal.c
index cbf70c808969..10b464b9d91f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2003,9 +2003,15 @@ void posixtimer_send_sigqueue(struct k_itimer *tmr)
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) {
Powered by blists - more mailing lists