syzbot


possible deadlock in send_sigio

Status: auto-closed as invalid on 2020/08/27 14:07
Reported-by: syzbot+2bbbe6fb0f290cd2876d@syzkaller.appspotmail.com
First crash: 799d, last: 799d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in send_sigio (2) 1 633d 633d 0/1 auto-closed as invalid on 2021/02/09 04:22
upstream possible deadlock in send_sigio C done 7 815d 824d 17/22 fixed on 2020/05/10 10:41
upstream possible deadlock in send_sigio (2) C done done 40 554d 666d 21/22 fixed on 2021/03/10 01:48

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

but task is already holding lock:
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] kill_fasync_rcu fs/fcntl.c:990 [inline]
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] kill_fasync fs/fcntl.c:1011 [inline]
 (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] 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/0xbf 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+0x400/0x9e0 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+0x96/0x110 drivers/tty/serial/8250/8250_port.c:1899
       serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
       __handle_irq_event_percpu+0x125/0x7e0 kernel/irq/handle.c:147
       handle_irq_event_percpu+0x66/0x120 kernel/irq/handle.c:187
       handle_irq_event+0xa2/0x12d kernel/irq/handle.c:204
       handle_edge_irq+0x215/0x810 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_restore arch/x86/include/asm/paravirt.h:779 [inline]
       del_timer_sync+0x116/0x250 kernel/time/timer.c:1237
       schedule_timeout+0x444/0xe40 kernel/time/timer.c:1747
       rcu_gp_kthread+0xb8e/0x1ce0 kernel/rcu/tree.c:2255
       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/0xbf kernel/locking/spinlock.c:160
       serial8250_console_write+0x6c1/0x8e0 drivers/tty/serial/8250/8250_port.c:3236
       call_console_drivers kernel/printk/printk.c:1725 [inline]
       console_unlock+0x9b2/0xec0 kernel/printk/printk.c:2397
       vprintk_emit kernel/printk/printk.c:1923 [inline]
       vprintk_emit+0x1f8/0x600 kernel/printk/printk.c:1888
       vprintk_func+0x58/0x152 kernel/printk/printk_safe.c:401
       printk+0x9e/0xbc kernel/printk/printk.c:1996
       register_console+0x5ec/0x9a0 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+0x437/0x676 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+0x3d4/0xec0 kernel/printk/printk.c:2394
       vprintk_emit kernel/printk/printk.c:1923 [inline]
       vprintk_emit+0x1f8/0x600 kernel/printk/printk.c:1888
       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/0x14b 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+0x44/0x770 mm/slab.c:3550
       __sigqueue_alloc+0x1b8/0x3e0 kernel/signal.c:400
       __send_signal+0x194/0x1280 kernel/signal.c:1097
       specific_send_sig_info kernel/signal.c:1208 [inline]
       force_sig_info+0x240/0x340 kernel/signal.c:1260
       force_sig_info_fault.constprop.0+0x185/0x260 arch/x86/mm/fault.c:225
       __bad_area_nosemaphore+0x1d9/0x2a0 arch/x86/mm/fault.c:940
       __do_page_fault+0x859/0xb40 arch/x86/mm/fault.c:1412
       page_fault+0x45/0x50 arch/x86/entry/entry_64.S:1122

-> #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+0x2e5c/0x6a50 kernel/fork.c:1876
       copy_process kernel/fork.c:1586 [inline]
       _do_fork+0x180/0xc80 kernel/fork.c:2070
       kernel_thread+0x2f/0x40 kernel/fork.c:2132
       create_kthread kernel/kthread.c:255 [inline]
       kthreadd+0x4f8/0x6f0 kernel/kthread.c:567
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404
FAULT_INJECTION: forcing a failure.
name failslab, interval 1, probability 0, space 0, times 0

-> #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+0x400/0x9e0 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+0x96/0x110 drivers/tty/serial/8250/8250_port.c:1899
       serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
       __handle_irq_event_percpu+0x125/0x7e0 kernel/irq/handle.c:147
       handle_irq_event_percpu+0x66/0x120 kernel/irq/handle.c:187
       handle_irq_event+0xa2/0x12d kernel/irq/handle.c:204
       handle_edge_irq+0x215/0x810 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_restore arch/x86/include/asm/paravirt.h:779 [inline]
       del_timer_sync+0x116/0x250 kernel/time/timer.c:1237
       schedule_timeout+0x444/0xe40 kernel/time/timer.c:1747
       rcu_gp_kthread+0xb8e/0x1ce0 kernel/rcu/tree.c:2255
       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 rcu_preempt/8:
 #0:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff8341007b>] spin_lock include/linux/spinlock.h:317 [inline]
 #0:  (&(&i->lock)->rlock){-.-.}, at: [<ffffffff8341007b>] serial8250_interrupt+0x2b/0x1a0 drivers/tty/serial/8250/8250_core.c:119
 #1:  (&port_lock_key){-.-.}, at: [<ffffffff83420870>] serial8250_handle_irq.part.0+0x20/0x240 drivers/tty/serial/8250/8250_port.c:1872
 #2:  (&tty->ldisc_sem){++++}, at: [<ffffffff833b058b>] tty_ldisc_ref+0x1b/0x80 drivers/tty/tty_ldisc.c:305
 #3:  (rcu_read_lock){....}, at: [<ffffffff818f268d>] kill_fasync+0x3d/0x3c0 fs/fcntl.c:1009
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] kill_fasync_rcu fs/fcntl.c:990 [inline]
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] kill_fasync fs/fcntl.c:1011 [inline]
 #4:  (&(&new->fa_lock)->rlock){-.-.}, at: [<ffffffff818f276e>] kill_fasync+0x11e/0x3c0 fs/fcntl.c:1004
 #5:  (&f->f_owner.lock){.?.?}, at: [<ffffffff818f24a4>] send_sigio+0x24/0x1d0 fs/fcntl.c:778

stack backtrace:
CPU: 0 PID: 8 Comm: rcu_preempt Not tainted 4.14.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x13e/0x194 lib/dump_stack.c:58
 print_circular_bug.isra.0.cold+0x1c4/0x282 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+0x2cb3/0x4620 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+0x400/0x9e0 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+0x96/0x110 drivers/tty/serial/8250/8250_port.c:1899
 serial8250_interrupt+0xe4/0x1a0 drivers/tty/serial/8250/8250_core.c:129
 __handle_irq_event_percpu+0x125/0x7e0 kernel/irq/handle.c:147
 handle_irq_event_percpu+0x66/0x120 kernel/irq/handle.c:187
 handle_irq_event+0xa2/0x12d kernel/irq/handle.c:204
 handle_edge_irq+0x215/0x810 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+0x8f/0x8f arch/x86/entry/entry_64.S:576
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:del_timer_sync+0x116/0x250 kernel/time/timer.c:1237
RSP: 0018:ffff8880a9867c28 EFLAGS: 00000297 ORIG_RAX: ffffffffffffffc8
RAX: ffff8880a9854200 RBX: ffff8880a9867cd0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000297
RBP: 0000000000000297 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880a9867d00
R13: ffff8880aea239c0 R14: ffff8880aea239c0 R15: ffff8880a9867cd0
 schedule_timeout+0x444/0xe40 kernel/time/timer.c:1747
 rcu_gp_kthread+0xb8e/0x1ce0 kernel/rcu/tree.c:2255
 kthread+0x30d/0x420 kernel/kthread.c:232
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404
CPU: 1 PID: 16082 Comm: syz-executor.3 Not tainted 4.14.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x13e/0x194 lib/dump_stack.c:58
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold+0x10a/0x14b lib/fault-inject.c:149
 should_failslab+0xd6/0x130 mm/failslab.c:32
 slab_pre_alloc_hook mm/slab.h:421 [inline]
 slab_alloc_node mm/slab.c:3297 [inline]
 kmem_cache_alloc_node_trace+0x292/0x7b0 mm/slab.c:3659
 __do_kmalloc_node mm/slab.c:3681 [inline]
 __kmalloc_node_track_caller+0x38/0x70 mm/slab.c:3696
 __kmalloc_reserve.isra.0+0x35/0xd0 net/core/skbuff.c:137
 __alloc_skb+0xca/0x4c0 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:980 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1159 [inline]
 netlink_sendmsg+0x7de/0xbe0 net/netlink/af_netlink.c:1853
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xc5/0x100 net/socket.c:656
 ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c829
RSP: 002b:00007f0a158a6c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004fdcc0 RCX: 000000000045c829
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000009
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000000b
R13: 0000000000000948 R14: 00000000004d59c0 R15: 00007f0a158a76d4
netlink: 2 bytes leftover after parsing attributes in process `syz-executor.3'.
hfs: unable to parse mount options
hfs: unable to parse mount options
cifs_vfs_err: 27 callbacks suppressed
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
overlayfs: fs on '.' does not support file handles, falling back to index=off.
CIFS VFS: Malformed UNC in devname.
overlayfs: fs on '.' does not support file handles, falling back to index=off.
CIFS VFS: Malformed UNC in devname.
cifs_vfs_err: 4 callbacks suppressed
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
Unknown ioctl -1068978587
CIFS VFS: Malformed UNC in devname.
Unknown ioctl -1068978587
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.
CIFS VFS: Malformed UNC in devname.

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/04/29 14:07 linux-4.14.y 050272a0423e ba2806db .config log report