====================================================== WARNING: possible circular locking dependency detected 4.14.181-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/13322 is trying to acquire lock: (&pool->lock/1){..-.}, at: [] spin_lock include/linux/spinlock.h:317 [inline] (&pool->lock/1){..-.}, at: [] __queue_work+0x174/0xf70 kernel/workqueue.c:1421 but task is already holding lock: (&(&port->lock)->rlock){-.-.}, at: [] pty_write+0xdb/0x1c0 drivers/tty/pty.c:120 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&(&port->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 tty_port_tty_get+0x1d/0x80 drivers/tty/tty_port.c:288 tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:46 serial8250_tx_chars+0x400/0x9f0 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+0xee/0x7f0 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] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:192 spin_unlock_irqrestore include/linux/spinlock.h:372 [inline] uart_write+0x28c/0x510 drivers/tty/serial/serial_core.c:625 do_output_char+0x4f5/0x750 drivers/tty/n_tty.c:447 process_output drivers/tty/n_tty.c:514 [inline] n_tty_write+0x409/0xe20 drivers/tty/n_tty.c:2345 do_tty_write drivers/tty/tty_io.c:959 [inline] tty_write+0x3f1/0x6e0 drivers/tty/tty_io.c:1043 redirected_tty_write+0x9c/0xb0 drivers/tty/tty_io.c:1064 do_loop_readv_writev fs/read_write.c:698 [inline] do_loop_readv_writev fs/read_write.c:682 [inline] do_iter_write fs/read_write.c:956 [inline] do_iter_write+0x3d9/0x550 fs/read_write.c:935 vfs_writev+0x133/0x2a0 fs/read_write.c:999 do_writev+0xfc/0x2c0 fs/read_write.c:1034 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #2 (&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+0x6ea/0x8e0 drivers/tty/serial/8250/8250_port.c:3236 call_console_drivers kernel/printk/printk.c:1725 [inline] console_unlock+0x985/0xee0 kernel/printk/printk.c:2397 vprintk_emit+0x3b8/0x600 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+0x6ef/0xac0 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+0x52f/0x771 init/main.c:634 secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240 -> #1 (console_owner){-...}: console_lock_spinning_enable kernel/printk/printk.c:1588 [inline] console_unlock+0x36c/0xee0 kernel/printk/printk.c:2394 vprintk_emit+0x3b8/0x600 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 kmem_cache_zalloc include/linux/slab.h:651 [inline] fill_pool lib/debugobjects.c:110 [inline] __debug_object_init+0x57d/0x7a0 lib/debugobjects.c:341 __init_work kernel/workqueue.c:504 [inline] insert_wq_barrier kernel/workqueue.c:2500 [inline] start_flush_work kernel/workqueue.c:2848 [inline] flush_work+0x1f7/0x780 kernel/workqueue.c:2892 fsnotify_destroy_group+0x111/0x2a0 fs/notify/group.c:85 fanotify_release+0x284/0x370 fs/notify/fanotify/fanotify_user.c:417 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x113/0x190 kernel/task_work.c:113 get_signal+0x1887/0x1c90 kernel/signal.c:2234 do_signal+0x7c/0x15d0 arch/x86/kernel/signal.c:814 exit_to_usermode_loop+0x160/0x200 arch/x86/entry/common.c:160 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #0 (&pool->lock/1){..-.}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __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] __queue_work+0x174/0xf70 kernel/workqueue.c:1421 queue_work_on+0x159/0x1d0 kernel/workqueue.c:1490 pty_write+0x173/0x1c0 drivers/tty/pty.c:125 process_output_block drivers/tty/n_tty.c:595 [inline] n_tty_write+0x375/0xe20 drivers/tty/n_tty.c:2333 do_tty_write drivers/tty/tty_io.c:959 [inline] tty_write+0x3f1/0x6e0 drivers/tty/tty_io.c:1043 __vfs_write+0xe4/0x630 fs/read_write.c:480 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb other info that might help us debug this: Chain exists of: &pool->lock/1 --> &port_lock_key --> &(&port->lock)->rlock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&(&port->lock)->rlock); lock(&port_lock_key); lock(&(&port->lock)->rlock); lock(&pool->lock/1); *** DEADLOCK *** 5 locks held by syz-executor.1/13322: #0: (&tty->ldisc_sem){++++}, at: [] tty_ldisc_ref_wait+0x22/0x80 drivers/tty/tty_ldisc.c:284 #1: (&tty->atomic_write_lock){+.+.}, at: [] tty_write_lock+0x1d/0x60 drivers/tty/tty_io.c:885 #2: (&o_tty->termios_rwsem/1){++++}, at: [] n_tty_write+0x187/0xe20 drivers/tty/n_tty.c:2316 #3: (&ldata->output_lock){+.+.}, at: [] process_output_block drivers/tty/n_tty.c:550 [inline] #3: (&ldata->output_lock){+.+.}, at: [] n_tty_write+0x464/0xe20 drivers/tty/n_tty.c:2333 #4: (&(&port->lock)->rlock){-.-.}, at: [] pty_write+0xdb/0x1c0 drivers/tty/pty.c:120 stack backtrace: CPU: 0 PID: 13322 Comm: syz-executor.1 Not tainted 4.14.181-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+0x1b2/0x283 lib/dump_stack.c:58 print_circular_bug.isra.0.cold+0x2dc/0x425 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+0x3057/0x42a0 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __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] __queue_work+0x174/0xf70 kernel/workqueue.c:1421 queue_work_on+0x159/0x1d0 kernel/workqueue.c:1490 pty_write+0x173/0x1c0 drivers/tty/pty.c:125 process_output_block drivers/tty/n_tty.c:595 [inline] n_tty_write+0x375/0xe20 drivers/tty/n_tty.c:2333 do_tty_write drivers/tty/tty_io.c:959 [inline] tty_write+0x3f1/0x6e0 drivers/tty/tty_io.c:1043 __vfs_write+0xe4/0x630 fs/read_write.c:480 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x45ca29 RSP: 002b:00007f93e9e8bc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000050a4c0 RCX: 000000000045ca29 RDX: 00000000fffffedf RSI: 0000000020000000 RDI: 0000000000000007 RBP: 000000000078bfa0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000000c5a R14: 00000000004ca2fd R15: 00007f93e9e8c6d4 netlink: 12 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 12 bytes leftover after parsing attributes in process `syz-executor.4'. 9pnet: p9_fd_create_unix (13507): problem connecting socket: ./file0: -111 9pnet: p9_fd_create_unix (13500): problem connecting socket: ./file0: -111