============================================ WARNING: possible recursive locking detected 5.16.0-rc3-syzkaller #0 Not tainted -------------------------------------------- kworker/u4:1/10 is trying to acquire lock: ffffffff9078c3f0 (&port_lock_key){-.-.}-{2:2}, at: uart_write+0x12c/0x570 drivers/tty/serial/serial_core.c:577 but task is already holding lock: ffffffff9078c3f0 (&port_lock_key){-.-.}-{2:2}, at: serial8250_handle_irq.part.0+0x21/0x3d0 drivers/tty/serial/8250/8250_port.c:1908 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&port_lock_key); lock(&port_lock_key); *** DEADLOCK *** May be due to missing lock nesting notation 9 locks held by kworker/u4:1/10: #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: arch_atomic_long_set include/linux/atomic/atomic-long.h:41 [inline] #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: atomic_long_set include/linux/atomic/atomic-instrumented.h:1198 [inline] #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:635 [inline] #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:662 [inline] #0: ffff888010c69138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x896/0x1690 kernel/workqueue.c:2269 #1: ffffc90000cf7db0 ((work_completion)(&buf->work)){+.+.}-{0:0}, at: process_one_work+0x8ca/0x1690 kernel/workqueue.c:2273 #2: ffff888150f568b8 (&port->buf.lock/1){+.+.}-{3:3}, at: flush_to_ldisc+0x42/0x3f0 drivers/tty/tty_buffer.c:515 #3: ffff88801d34c098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref+0x1d/0x80 drivers/tty/tty_ldisc.c:273 #4: ffff88801d34c2e8 (&o_tty->termios_rwsem/1){++++}-{3:3}, at: isig+0x37d/0x430 drivers/tty/n_tty.c:1149 #5: ffffc9000df03378 (&ldata->output_lock){+.+.}-{3:3}, at: process_echoes+0xaf/0x1c0 drivers/tty/n_tty.c:806 #6: ffff8880224cc030 (&i->lock){-.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:349 [inline] #6: ffff8880224cc030 (&i->lock){-.-.}-{2:2}, at: serial8250_interrupt+0x3a/0x200 drivers/tty/serial/8250/8250_core.c:116 #7: ffffffff9078c3f0 (&port_lock_key){-.-.}-{2:2}, at: serial8250_handle_irq.part.0+0x21/0x3d0 drivers/tty/serial/8250/8250_port.c:1908 #8: ffff888024431098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref+0x1d/0x80 drivers/tty/tty_ldisc.c:273 stack backtrace: CPU: 0 PID: 10 Comm: kworker/u4:1 Not tainted 5.16.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events_unbound flush_to_ldisc Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_deadlock_bug kernel/locking/lockdep.c:2956 [inline] check_deadlock kernel/locking/lockdep.c:2999 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire.cold+0x149/0x3ab kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162 uart_write+0x12c/0x570 drivers/tty/serial/serial_core.c:577 n_hdlc_send_frames+0x24b/0x490 drivers/tty/n_hdlc.c:290 tty_wakeup+0xe1/0x120 drivers/tty/tty_io.c:534 tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:51 serial8250_tx_chars+0x4f3/0xad0 drivers/tty/serial/8250/8250_port.c:1845 serial8250_handle_irq.part.0+0x328/0x3d0 drivers/tty/serial/8250/8250_port.c:1932 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1905 [inline] serial8250_default_handle_irq+0xb2/0x220 drivers/tty/serial/8250/8250_port.c:1949 serial8250_interrupt+0xfd/0x200 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x303/0x8f0 kernel/irq/handle.c:158 handle_irq_event_percpu kernel/irq/handle.c:198 [inline] handle_irq_event+0x102/0x280 kernel/irq/handle.c:215 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:822 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9d/0x210 arch/x86/kernel/irq.c:250 common_interrupt+0xa4/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0010:finish_task_switch.isra.0+0x323/0xb80 kernel/sched/core.c:4852 Code: f3 85 f3 07 85 c0 75 02 0f 0b 48 85 db 0f 85 25 01 00 00 4c 89 f7 e8 fc f7 ff ff e8 c7 46 2d 00 fb 65 48 8b 1c 25 40 70 02 00 <48> 8d bb 80 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc90000cf7738 EFLAGS: 00000206 RAX: 0000000005c0b365 RBX: ffff888011939d00 RCX: 1ffffffff1ff6056 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc90000cf7780 R08: 0000000000000001 R09: ffffffff8ff72aa7 R10: 0000000000000001 R11: 0000000000000001 R12: ffff8880b9c3a7d8 R13: ffff8880118dd700 R14: ffff8880b9c39a80 R15: ffff8880b9c3a4b8 context_switch kernel/sched/core.c:4975 [inline] __schedule+0xaa2/0x4940 kernel/sched/core.c:6253 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:6419 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] _raw_spin_unlock_irqrestore+0x57/0x70 kernel/locking/spinlock.c:194 spin_unlock_irqrestore include/linux/spinlock.h:404 [inline] pty_write+0x150/0x1e0 drivers/tty/pty.c:123 tty_put_char+0x122/0x150 drivers/tty/tty_io.c:3174 do_output_char+0x155/0x850 drivers/tty/n_tty.c:485 __process_echoes+0x38e/0x9f0 drivers/tty/n_tty.c:736 process_echoes+0xf9/0x1c0 drivers/tty/n_tty.c:808 n_tty_receive_char_special drivers/tty/n_tty.c:1270 [inline] n_tty_receive_buf_standard drivers/tty/n_tty.c:1558 [inline] __receive_buf drivers/tty/n_tty.c:1577 [inline] n_tty_receive_buf_common+0x3054/0x4780 drivers/tty/n_tty.c:1674 tty_ldisc_receive_buf+0xa3/0x190 drivers/tty/tty_buffer.c:471 tty_port_default_receive_buf+0x6e/0xa0 drivers/tty/tty_port.c:39 receive_buf drivers/tty/tty_buffer.c:491 [inline] flush_to_ldisc+0x20d/0x3f0 drivers/tty/tty_buffer.c:543 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 ---------------- Code disassembly (best guess), 2 bytes skipped: 0: f3 07 repz (bad) 2: 85 c0 test %eax,%eax 4: 75 02 jne 0x8 6: 0f 0b ud2 8: 48 85 db test %rbx,%rbx b: 0f 85 25 01 00 00 jne 0x136 11: 4c 89 f7 mov %r14,%rdi 14: e8 fc f7 ff ff callq 0xfffff815 19: e8 c7 46 2d 00 callq 0x2d46e5 1e: fb sti 1f: 65 48 8b 1c 25 40 70 mov %gs:0x27040,%rbx 26: 02 00 * 28: 48 8d bb 80 15 00 00 lea 0x1580(%rbx),%rdi <-- trapping instruction 2f: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 36: fc ff df 39: 48 89 fa mov %rdi,%rdx 3c: 48 rex.W 3d: c1 .byte 0xc1