syzbot


possible deadlock in send_sigio (2)

Status: auto-closed as invalid on 2021/02/09 04:22
Reported-by: syzbot+924f910f21ecb06dd030@syzkaller.appspotmail.com
First crash: 1501d, last: 1501d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in send_sigio fs C done 7 1683d 1692d 15/28 fixed on 2020/05/10 10:41
upstream possible deadlock in send_sigio (2) fs C done done 40 1421d 1534d 19/28 fixed on 2021/03/10 01:48
linux-4.14 possible deadlock in send_sigio 1 1666d 1666d 0/1 auto-closed as invalid on 2020/08/27 14:07

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.198-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:3/1017 is trying to acquire lock:
 (tasklist_lock){.?.+}, at: [<ffffffff81912501>] send_sigio+0xa1/0x1d0 fs/fcntl.c:790

but task is already holding lock:
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync_rcu fs/fcntl.c:990 [inline]
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync fs/fcntl.c:1011 [inline]
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync+0x11e/0x3c0 fs/fcntl.c:1004

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&(&new->fa_lock)->rlock){-.-.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160
       kill_fasync_rcu fs/fcntl.c:990 [inline]
       kill_fasync fs/fcntl.c:1011 [inline]
       kill_fasync+0x11e/0x3c0 fs/fcntl.c:1004
       tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533
       tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49
       serial8250_tx_chars+0x3fe/0xbf0 drivers/tty/serial/8250/8250_port.c:1810
       serial8250_handle_irq.part.0+0x1f8/0x240 drivers/tty/serial/8250/8250_port.c:1883
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1869 [inline]
       serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1899
       serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
       __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147
       handle_irq_event_percpu kernel/irq/handle.c:187 [inline]
       handle_irq_event+0xf0/0x246 kernel/irq/handle.c:204
       handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770
       generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
       handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87
       do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230
       ret_from_intr+0x0/0x1e
       arch_local_irq_enable arch/x86/include/asm/paravirt.h:789 [inline]
       __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline]
       _raw_spin_unlock_irq+0x50/0x80 kernel/locking/spinlock.c:200
       spin_unlock_irq include/linux/spinlock.h:367 [inline]
       process_one_work+0x6c4/0x14a0 kernel/workqueue.c:2089
       worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
       kthread+0x30d/0x420 kernel/kthread.c:232
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #3 (&port_lock_key){-.-.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160
       serial8250_console_write+0x7a7/0x9d0 drivers/tty/serial/8250/8250_port.c:3239
       call_console_drivers kernel/printk/printk.c:1725 [inline]
       console_unlock+0x99d/0xf20 kernel/printk/printk.c:2397
       vprintk_emit+0x224/0x620 kernel/printk/printk.c:1923
       vprintk_func+0x58/0x152 kernel/printk/printk_safe.c:401
       printk+0x9e/0xbc kernel/printk/printk.c:1996
       register_console+0x6f4/0xad0 kernel/printk/printk.c:2716
       univ8250_console_init+0x2f/0x3a drivers/tty/serial/8250/8250_core.c:691
       console_init+0x46/0x53 kernel/printk/printk.c:2797
       start_kernel+0x52e/0x770 init/main.c:634
       secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

-> #2 (console_owner){-.-.}:
       console_lock_spinning_enable kernel/printk/printk.c:1588 [inline]
       console_unlock+0x36f/0xf20 kernel/printk/printk.c:2394
       vprintk_emit+0x224/0x620 kernel/printk/printk.c:1923
       vprintk_func+0x58/0x152 kernel/printk/printk_safe.c:401
       printk+0x9e/0xbc kernel/printk/printk.c:1996
       fail_dump lib/fault-inject.c:44 [inline]
       should_fail.cold+0xdf/0x154 lib/fault-inject.c:149
       should_failslab+0xd6/0x130 mm/failslab.c:32
       slab_pre_alloc_hook mm/slab.h:421 [inline]
       slab_alloc mm/slab.c:3376 [inline]
       kmem_cache_alloc+0x40/0x3c0 mm/slab.c:3550
       __sigqueue_alloc+0x1b8/0x3e0 kernel/signal.c:400
       __send_signal+0x1a4/0x1260 kernel/signal.c:1097
       specific_send_sig_info kernel/signal.c:1208 [inline]
       force_sig_info+0x263/0x410 kernel/signal.c:1260
       force_sig_info_fault.constprop.0+0x185/0x260 arch/x86/mm/fault.c:225
       __bad_area_nosemaphore+0x1d6/0x2c0 arch/x86/mm/fault.c:940
       __do_page_fault+0x842/0xb50 arch/x86/mm/fault.c:1412
       page_fault+0x45/0x50 arch/x86/entry/entry_64.S:1123

-> #1 (&(&sighand->siglock)->rlock){-.-.}:
       __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152
       spin_lock include/linux/spinlock.h:317 [inline]
       copy_process.part.0+0x2f02/0x6f00 kernel/fork.c:1876
       copy_process kernel/fork.c:1586 [inline]
       _do_fork+0x184/0xc80 kernel/fork.c:2070
       kernel_thread+0x2f/0x40 kernel/fork.c:2132
       create_kthread kernel/kthread.c:255 [inline]
       kthreadd+0x51a/0x770 kernel/kthread.c:567
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #0 (tasklist_lock){.?.+}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline]
       _raw_read_lock+0x2d/0x40 kernel/locking/spinlock.c:224
       send_sigio+0xa1/0x1d0 fs/fcntl.c:790
       kill_fasync_rcu fs/fcntl.c:997 [inline]
       kill_fasync fs/fcntl.c:1011 [inline]
       kill_fasync+0x1be/0x3c0 fs/fcntl.c:1004
       tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533
       tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49
       serial8250_tx_chars+0x3fe/0xbf0 drivers/tty/serial/8250/8250_port.c:1810
       serial8250_handle_irq.part.0+0x1f8/0x240 drivers/tty/serial/8250/8250_port.c:1883
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1869 [inline]
       serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1899
       serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
       __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147
       handle_irq_event_percpu kernel/irq/handle.c:187 [inline]
       handle_irq_event+0xf0/0x246 kernel/irq/handle.c:204
       handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770
       generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
       handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87
       do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230
       ret_from_intr+0x0/0x1e
       arch_local_irq_enable arch/x86/include/asm/paravirt.h:789 [inline]
       __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline]
       _raw_spin_unlock_irq+0x50/0x80 kernel/locking/spinlock.c:200
       spin_unlock_irq include/linux/spinlock.h:367 [inline]
       process_one_work+0x6c4/0x14a0 kernel/workqueue.c:2089
       worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
       kthread+0x30d/0x420 kernel/kthread.c:232
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

other info that might help us debug this:

Chain exists of:
  tasklist_lock --> &port_lock_key --> &(&new->fa_lock)->rlock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&(&new->fa_lock)->rlock);
                               lock(&port_lock_key);
                               lock(&(&new->fa_lock)->rlock);
  lock(tasklist_lock);

 *** DEADLOCK ***

6 locks held by kworker/u4:3/1017:
 #0:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff8349e05b>] spin_lock include/linux/spinlock.h:317 [inline]
 #0:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff8349e05b>] serial8250_interrupt+0x2b/0x1a0 drivers/tty/serial/8250/8250_core.c:119
 #1:  (&port_lock_key){-.-.}, at: [<ffffffff834b0a40>] serial8250_handle_irq.part.0+0x20/0x240 drivers/tty/serial/8250/8250_port.c:1872
 #2:  (&tty->ldisc_sem){++++}, at: [<ffffffff8343eb0b>] tty_ldisc_ref+0x1b/0x80 drivers/tty/tty_ldisc.c:305
 #3:  (rcu_read_lock){....}, at: [<ffffffff8191266d>] kill_fasync+0x3d/0x3c0 fs/fcntl.c:1009
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync_rcu fs/fcntl.c:990 [inline]
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync fs/fcntl.c:1011 [inline]
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff8191274e>] kill_fasync+0x11e/0x3c0 fs/fcntl.c:1004
 #5:  (&f->f_owner.lock){.?.?}, at: [<ffffffff81912484>] send_sigio+0x24/0x1d0 fs/fcntl.c:778

stack backtrace:
CPU: 0 PID: 1017 Comm: kworker/u4:3 Not tainted 4.14.198-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: phy5 ieee80211_iface_work
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline]
 _raw_read_lock+0x2d/0x40 kernel/locking/spinlock.c:224
 send_sigio+0xa1/0x1d0 fs/fcntl.c:790
 kill_fasync_rcu fs/fcntl.c:997 [inline]
 kill_fasync fs/fcntl.c:1011 [inline]
 kill_fasync+0x1be/0x3c0 fs/fcntl.c:1004
 tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533
 tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49
 serial8250_tx_chars+0x3fe/0xbf0 drivers/tty/serial/8250/8250_port.c:1810
 serial8250_handle_irq.part.0+0x1f8/0x240 drivers/tty/serial/8250/8250_port.c:1883
 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1869 [inline]
 serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1899
 serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
 __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147
 handle_irq_event_percpu kernel/irq/handle.c:187 [inline]
 handle_irq_event+0xf0/0x246 kernel/irq/handle.c:204
 handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770
 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
 handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87
 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230
 common_interrupt+0x93/0x93 arch/x86/entry/entry_64.S:576
 </IRQ>
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x50/0x80 kernel/locking/spinlock.c:200
RSP: 0018:ffff8880a7d07d58 EFLAGS: 00000282 ORIG_RAX: ffffffffffffffc8
RAX: 1ffffffff0fa2d23 RBX: ffff88809fcf6100 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880a7ceeb04
RBP: ffff88812fe0a8c0 R08: ffffffff8a07fd38 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888095c49db8
R13: ffff8880a9a88100 R14: ffff88812fe0a8c0 R15: ffff888087903400
 spin_unlock_irq include/linux/spinlock.h:367 [inline]
 process_one_work+0x6c4/0x14a0 kernel/workqueue.c:2089
 worker_thread+0x5cc/0xff0 kernel/workqueue.c:2250
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.1'.
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=65535 sclass=netlink_route_socket pid=22866 comm=syz-executor.5
SELinux: unrecognized netlink message: protocol=0 nlmsg_type=65535 sclass=netlink_route_socket pid=22867 comm=syz-executor.5

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/12 04:22 linux-4.14.y cbfa1702aaf6 4a77ae0b .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.