====================================================== WARNING: possible circular locking dependency detected 5.6.0-rc2-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor613/8845 is trying to acquire lock: ffffffff892d7e58 (console_owner){..-.}, at: console_lock_spinning_enable+0x31/0x60 kernel/printk/printk.c:1651 but task is already holding lock: ffffffff8af38b38 (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start+0x5c/0x570 drivers/tty/tty_port.c:566 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&(&port->lock)->rlock){-.-.}: lock_acquire+0x154/0x250 kernel/locking/lockdep.c:4484 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa1/0xc0 kernel/locking/spinlock.c:159 tty_port_tty_get+0x25/0xf0 drivers/tty/tty_port.c:287 tty_port_default_wakeup+0x15/0x40 drivers/tty/tty_port.c:47 tty_port_tty_wakeup+0x5a/0x70 drivers/tty/tty_port.c:387 uart_write_wakeup+0x48/0x60 drivers/tty/serial/serial_core.c:104 serial8250_tx_chars+0x61e/0x830 drivers/tty/serial/8250/8250_port.c:1760 serial8250_handle_irq+0x27f/0x330 drivers/tty/serial/8250/8250_port.c:1833 serial8250_default_handle_irq+0xc5/0x1d0 drivers/tty/serial/8250/8250_port.c:1849 serial8250_interrupt+0xa4/0x190 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x10e/0x580 kernel/irq/handle.c:149 handle_irq_event_percpu kernel/irq/handle.c:189 [inline] handle_irq_event+0xbe/0x280 kernel/irq/handle.c:206 handle_edge_irq+0x28a/0xc90 kernel/irq/chip.c:830 generic_handle_irq_desc include/linux/irqdesc.h:156 [inline] do_IRQ+0xfb/0x1e0 arch/x86/kernel/irq.c:250 ret_from_intr+0x0/0x36 arch_local_irq_restore arch/x86/include/asm/paravirt.h:752 [inline] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0xa8/0xe0 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:393 [inline] uart_write+0x7b4/0x990 drivers/tty/serial/serial_core.c:613 process_output_block drivers/tty/n_tty.c:595 [inline] n_tty_write+0xd0c/0x1200 drivers/tty/n_tty.c:2333 do_tty_write drivers/tty/tty_io.c:962 [inline] tty_write+0x5a1/0x950 drivers/tty/tty_io.c:1046 redirected_tty_write+0x9e/0xb0 drivers/tty/tty_io.c:1067 __vfs_write+0xb8/0x740 fs/read_write.c:494 vfs_write+0x270/0x580 fs/read_write.c:558 ksys_write+0x117/0x220 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:620 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #1 (&port_lock_key){-.-.}: lock_acquire+0x154/0x250 kernel/locking/lockdep.c:4484 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa1/0xc0 kernel/locking/spinlock.c:159 serial8250_console_write+0x186/0xca0 drivers/tty/serial/8250/8250_port.c:3142 univ8250_console_write+0x50/0x70 drivers/tty/serial/8250/8250_core.c:587 call_console_drivers kernel/printk/printk.c:1789 [inline] console_unlock+0x90c/0xec0 kernel/printk/printk.c:2473 vprintk_emit+0x239/0x3a0 kernel/printk/printk.c:1996 vprintk_default+0x28/0x30 kernel/printk/printk.c:2023 vprintk_func+0x158/0x170 kernel/printk/printk_safe.c:386 printk+0x62/0x8d kernel/printk/printk.c:2056 register_console+0xb93/0xf20 kernel/printk/printk.c:2798 univ8250_console_init+0x4b/0x4d drivers/tty/serial/8250/8250_core.c:682 console_init+0x56/0x9c kernel/printk/printk.c:2884 start_kernel+0x428/0x777 init/main.c:920 x86_64_start_reservations+0x18/0x2e arch/x86/kernel/head64.c:490 x86_64_start_kernel+0x7a/0x7d arch/x86/kernel/head64.c:471 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:242 -> #0 (console_owner){..-.}: check_prev_add kernel/locking/lockdep.c:2475 [inline] check_prevs_add kernel/locking/lockdep.c:2580 [inline] validate_chain+0x1507/0x7be0 kernel/locking/lockdep.c:2970 __lock_acquire+0xc5a/0x1bc0 kernel/locking/lockdep.c:3954 lock_acquire+0x154/0x250 kernel/locking/lockdep.c:4484 console_lock_spinning_enable+0x56/0x60 kernel/printk/printk.c:1654 console_unlock+0x73f/0xec0 kernel/printk/printk.c:2470 vprintk_emit+0x239/0x3a0 kernel/printk/printk.c:1996 vprintk_default+0x28/0x30 kernel/printk/printk.c:2023 vprintk_func+0x158/0x170 kernel/printk/printk_safe.c:386 printk+0x62/0x8d kernel/printk/printk.c:2056 tty_port_close_start+0x3d9/0x570 drivers/tty/tty_port.c:568 tty_port_close+0x29/0x140 drivers/tty/tty_port.c:633 tpk_close+0x9a/0x110 drivers/char/ttyprintk.c:110 tty_release+0x391/0xfb0 drivers/tty/tty_io.c:1683 __fput+0x2e4/0x740 fs/file_table.c:280 ____fput+0x15/0x20 fs/file_table.c:313 task_work_run+0x176/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:164 [inline] prepare_exit_to_usermode+0x480/0x5b0 arch/x86/entry/common.c:195 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:278 do_syscall_64+0x11f/0x1c0 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: console_owner --> &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(console_owner); *** DEADLOCK *** 3 locks held by syz-executor613/8845: #0: ffff888096c68198 (&tty->legacy_mutex){+.+.}, at: tty_lock+0xa6/0x110 drivers/tty/tty_mutex.c:19 #1: ffffffff8af38b38 (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start+0x5c/0x570 drivers/tty/tty_port.c:566 #2: ffffffff892d7d58 (console_lock){+.+.}, at: vprintk_emit+0x21c/0x3a0 kernel/printk/printk.c:1995 stack backtrace: CPU: 0 PID: 8845 Comm: syz-executor613 Not tainted 5.6.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fb/0x318 lib/dump_stack.c:118 print_circular_bug+0xc3f/0xe70 kernel/locking/lockdep.c:1684 check_noncircular+0x206/0x3a0 kernel/locking/lockdep.c:1808 check_prev_add kernel/locking/lockdep.c:2475 [inline] check_prevs_add kernel/locking/lockdep.c:2580 [inline] validate_chain+0x1507/0x7be0 kernel/locking/lockdep.c:2970 __lock_acquire+0xc5a/0x1bc0 kernel/locking/lockdep.c:3954 lock_acquire+0x154/0x250 kernel/locking/lockdep.c:4484 console_lock_spinning_enable+0x56/0x60 kernel/printk/printk.c:1654 console_unlock+0x73f/0xec0 kernel/printk/printk.c:2470 vprintk_emit+0x239/0x3a0 kernel/printk/printk.c:1996 vprintk_default+0x28/0x30 kernel/printk/printk.c:2023 vprintk_func+0x158/0x170 kernel/printk/printk_safe.c:386 printk+0x62/0x8d kernel/printk/printk.c:2056 tty_port_close_start+0x3d9/0x570 drivers/tty/tty_port.c:568 tty_port_close+0x29/0x140 drivers/tty/tty_port.c:633 tpk_close+0x9a/0x110 drivers/char/ttyprintk.c:110 tty_release+0x391/0xfb0 drivers/tty/tty_io.c:1683 __fput+0x2e4/0x740 fs/file_table.c:280 ____fput+0x15/0x20 fs/file_table.c:313 task_work_run+0x176/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:164 [inline] prepare_exit_to_usermode+0x480/0x5b0 arch/x86/entry/common.c:195 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:278 do_syscall_64+0x11f/0x1c0 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4055e1 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 19 00 00 c3 48 83 ec 08 e8 6a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 b3 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007fff74569090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000000004055e1 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 000000000000002d R08: 0000228d20080522 R09: 0000228d20080522 R10: 00007fff745690b0 R11: 0000000000000293 R12: 00000000006dbc3c R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000000