WARNING in posixtimer_send_sigqueue
syzbot
syzbotHello,
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:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 5854 at kernel/signal.c:2008 posixtimer_send_sigqueue+0x9da/0xbc0 kernel/signal.c:2008 Modules linked in: CPU: 0 UID: 0 PID: 5854 Comm: syz-executor139 Not tainted 6.12.0-rc6-next-20241108-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 RIP: 0010:posixtimer_send_sigqueue+0x9da/0xbc0 kernel/signal.c:2008 Code: df 80 3c 08 00 74 08 48 89 df e8 c1 ad a5 00 4c 89 2b eb 51 e8 a7 32 3b 00 41 be 02 00 00 00 e9 e9 fd ff ff e8 97 32 3b 00 90 <0f> 0b 90 e9 f2 fa ff ff 4c 89 ef e8 86 33 5a 03 84 c0 0f 84 aa 01 RSP: 0018:ffffc90000007bc0 EFLAGS: 00010006 RAX: ffffffff81644979 RBX: 0000000000000000 RCX: ffff888027dd8000 RDX: 0000000000010000 RSI: 000000000000001e RDI: 0000000000000009 RBP: ffffc90000007cc0 R08: ffffffff816450cc R09: 1ffffffff2857112 R10: dffffc0000000000 R11: fffffbfff2857113 R12: ffff8880203f6264 R13: 1ffff1100407ec4c R14: ffff8880203f61e0 R15: ffff8880203f62a0 FS: 0000555573d1f480(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f61ecbdf388 CR3: 0000000036944000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> alarm_handle_timer+0x2f/0x60 kernel/time/alarmtimer.c:537 alarmtimer_fired+0x173/0x410 kernel/time/alarmtimer.c:205 __run_hrtimer kernel/time/hrtimer.c:1739 [inline] __hrtimer_run_queues+0x59b/0xd50 kernel/time/hrtimer.c:1803 hrtimer_interrupt+0x403/0xa40 kernel/time/hrtimer.c:1865 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1038 [inline] __sysvec_apic_timer_interrupt+0x110/0x420 arch/x86/kernel/apic/apic.c:1055 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa1/0xc0 arch/x86/kernel/apic/apic.c:1049 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:lock_acquire+0x264/0x550 kernel/locking/lockdep.c:5853 Code: 2b 00 74 08 4c 89 f7 e8 7a 52 8f 00 f6 44 24 61 02 0f 85 85 01 00 00 41 f7 c7 00 02 00 00 74 01 fb 48 c7 44 24 40 0e 36 e0 45 <4b> c7 44 25 00 00 00 00 00 43 c7 44 25 09 00 00 00 00 43 c7 44 25 RSP: 0018:ffffc90003bf6ea0 EFLAGS: 00000206 RAX: 0000000000000001 RBX: 1ffff9200077ede0 RCX: ffff888027dd8ad8 RDX: dffffc0000000000 RSI: ffffffff8c0aea60 RDI: ffffffff8c605b60 RBP: ffffc90003bf6fe8 R08: ffffffff942b88b7 R09: 1ffffffff2857116 R10: dffffc0000000000 R11: fffffbfff2857117 R12: 1ffff9200077eddc R13: dffffc0000000000 R14: ffffc90003bf6f00 R15: 0000000000000246 down_read_killable+0xca/0xd30 kernel/locking/rwsem.c:1547 mmap_read_lock_killable include/linux/mmap_lock.h:198 [inline] __get_user_pages_locked mm/gup.c:1726 [inline] get_dump_page+0xe2/0x2f0 mm/gup.c:2269 dump_user_range+0x14d/0x970 fs/coredump.c:943 elf_core_dump+0x3e9f/0x4790 fs/binfmt_elf.c:2127 do_coredump+0x214b/0x2e60 fs/coredump.c:758 get_signal+0x140b/0x1750 kernel/signal.c:2995 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] irqentry_exit_to_user_mode+0x7e/0x250 kernel/entry/common.c:231 exc_page_fault+0x590/0x8c0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0033:0x7f61ecb6431e Code: fd d7 c9 0f bc d1 c5 fe 7f 27 c5 fe 7f 6f 20 c5 fe 7f 77 40 c5 fe 7f 7f 60 49 83 c0 1f 49 29 d0 48 8d 7c 17 61 e9 d2 04 00 00 <c5> fe 6f 1e c5 fe 6f 56 20 c5 fd 74 cb c5 fd d7 d1 49 83 f8 21 0f RSP: 002b:00007ffd91b57128 EFLAGS: 00010287 RAX: 00007ffd91b57130 RBX: 00007ffd91b57130 RCX: 0000000000000000 RDX: 00000000000000e0 RSI: 0000000000000000 RDI: 00007ffd91b57130 RBP: 00007ffd91b57280 R08: 00000000000000e0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 R13: 00000000000f4240 R14: 00000000000140b7 R15: 00007ffd91b57264 </TASK> ---------------- Code disassembly (best guess): 0: 2b 00 sub (%rax),%eax 2: 74 08 je 0xc 4: 4c 89 f7 mov %r14,%rdi 7: e8 7a 52 8f 00 call 0x8f5286 c: f6 44 24 61 02 testb $0x2,0x61(%rsp) 11: 0f 85 85 01 00 00 jne 0x19c 17: 41 f7 c7 00 02 00 00 test $0x200,%r15d 1e: 74 01 je 0x21 20: fb sti 21: 48 c7 44 24 40 0e 36 movq $0x45e0360e,0x40(%rsp) 28: e0 45 * 2a: 4b c7 44 25 00 00 00 movq $0x0,0x0(%r13,%r12,1) <-- trapping instruction 31: 00 00 33: 43 c7 44 25 09 00 00 movl $0x0,0x9(%r13,%r12,1) 3a: 00 00 3c: 43 rex.XB 3d: c7 .byte 0xc7 3e: 44 rex.R 3f: 25 .byte 0x25
---
This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at [email protected].
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
Quoted 18 lines · syzbot
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=1657b0c0580000Downloadable 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
Quoted 6 lines
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by [email protected]------------[ 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:
kernel/signal.c +8 -2
@@ -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) {
On Thu, 14 Nov 2024 17:49:23 +0100 Frederic Weisbecker <[email protected]> Le Wed, Nov 13, 2024 at 04:52:22PM -0800
Quoted 43 lines
Quoted 16 lines
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=1657b0c0580000Downloadable 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.xzQuoted 6 lines
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by [email protected]------------[ cut here ]------------ WARNING: CPU: 0 PID: 5854 at kernel/signal.c:2008 posixtimer_send_sigqueue+0x9da/0xbc0 kernel/signal.c:2008That'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 indo_exit()with pending signal and then the timer is reset and a new signal is queued before the sighand dies.This should fix it:
kernel/signal.c +2
-2@@ -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)) { +/*
kernel/signal.c void posixtimer_send_sigqueue(struct k_itimer *tmr) · line 2017
Quoted 10 lines
kernel/signal.c +6
-0+* 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) {
Test Frederic's patch on top of the next tree.
#syz test
kernel/signal.c +8 -2
@@ -2004,9 +2004,15 @@ void posixtimer_send_sigqueue(struct k_iif (!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) {
--
syzbot
syzbotsyzbot tried to test the proposed patch but the build/boot failed:
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
security/apparmor/domain.c:695:3: error: expected expression security/apparmor/domain.c:697:3: error: use of undeclared identifier 'new_profile' security/apparmor/domain.c:699:8: error: use of undeclared identifier 'new_profile' security/apparmor/domain.c:704:11: error: use of undeclared identifier 'new_profile'
Tested on:
commit: 744cf71b Add linux-next specific files for 20241115 git tree: linux-next 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 patch: https://syzkaller.appspot.com/x/patch.diff?x=17c582e8580000
Quoted 9 lines · syzbot
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
security/apparmor/domain.c:695:3: error: expected expressionsecurity/apparmor/domain.c:697:3: error: use of undeclared identifier 'new_profile'security/apparmor/domain.c:699:8: error: use of undeclared identifier 'new_profile'security/apparmor/domain.c:704:11: error: use of undeclared identifier 'new_profile'
Quoted 9 lines
Tested on:
commit: 744cf71b Add linux-next specific files for 20241115 git tree: linux-next 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 patch: https://syzkaller.appspot.com/x/patch.diff?x=17c582e8580000
Can you test on git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
timers/core instead?
On Fri, 15 Nov 2024 21:55:02 +0100 Frederic Weisbecker <[email protected]>
Quoted 3 lines
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
kernel/signal.c +8 -2
@@ -2003,9 +2003,15 @@ void posixtimer_send_sigqueue(struct k_iif (!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) {
--
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: 228ad72e Merge tag 'timers-v6.13-rc1' of https://git.l.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core console output: https://syzkaller.appspot.com/x/log.txt?x=102f3cc0580000 kernel config: https://syzkaller.appspot.com/x/.config?x=a3e11aa0fc34acd5 dashboard link: https://syzkaller.appspot.com/bug?extid=852e935b899bde73626e compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 patch: https://syzkaller.appspot.com/x/patch.diff?x=16b471a7980000
Note: testing is done by a robot and is best-effort only.