====================================================== WARNING: possible circular locking dependency detected 5.8.0-rc7-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor594/6806 is trying to acquire lock: ffffffff894e7950 (console_owner){-.-.}-{0:0}, at: console_lock_spinning_enable+0x2d/0x60 kernel/printk/printk.c:1679 but task is already holding lock: ffffffff8c2e11f0 (&port->lock#2){-.-.}-{2:2}, at: tty_port_close_start+0x58/0x550 drivers/tty/tty_port.c:567 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&port->lock#2){-.-.}-{2:2}: lock_acquire+0x160/0x720 kernel/locking/lockdep.c:4959 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x9e/0xc0 kernel/locking/spinlock.c:159 tty_port_tty_get+0x21/0xe0 drivers/tty/tty_port.c:288 tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:47 serial8250_tx_chars+0x5ea/0x800 drivers/tty/serial/8250/8250_port.c:1831 serial8250_handle_irq+0x2fd/0x3e0 drivers/tty/serial/8250/8250_port.c:1918 serial8250_default_handle_irq+0xac/0x190 drivers/tty/serial/8250/8250_port.c:1934 serial8250_interrupt+0x93/0x180 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x1b7/0x610 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0xbd/0x280 kernel/irq/handle.c:213 handle_edge_irq+0x245/0xbf0 kernel/irq/chip.c:830 asm_call_on_stack+0xf/0x20 arch/x86/entry/entry_64.S:711 __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline] handle_irq arch/x86/kernel/irq.c:230 [inline] __common_interrupt arch/x86/kernel/irq.c:249 [inline] common_interrupt+0x155/0x260 arch/x86/kernel/irq.c:239 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:576 arch_local_irq_restore arch/x86/include/asm/paravirt.h:770 [inline] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0xa5/0xd0 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:408 [inline] uart_write+0x767/0x8f0 drivers/tty/serial/serial_core.c:614 do_output_char+0x63b/0x940 drivers/tty/n_tty.c:447 process_output drivers/tty/n_tty.c:514 [inline] n_tty_write+0xd5c/0x1170 drivers/tty/n_tty.c:2345 do_tty_write drivers/tty/tty_io.c:962 [inline] tty_write+0x593/0x940 drivers/tty/tty_io.c:1046 do_loop_readv_writev fs/read_write.c:737 [inline] do_iter_write+0x402/0x540 fs/read_write.c:1020 vfs_writev fs/read_write.c:1091 [inline] do_writev+0x23f/0x4a0 fs/read_write.c:1134 do_syscall_64+0x73/0xe0 arch/x86/entry/common.c:384 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> #1 (&port->lock){-.-.}-{2:2}: lock_acquire+0x160/0x720 kernel/locking/lockdep.c:4959 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x9e/0xc0 kernel/locking/spinlock.c:159 serial8250_console_write+0x13e/0xd60 drivers/tty/serial/8250/8250_port.c:3245 call_console_drivers kernel/printk/printk.c:1814 [inline] console_unlock+0x90c/0xec0 kernel/printk/printk.c:2493 vprintk_emit+0x1f8/0x3c0 kernel/printk/printk.c:2021 printk+0x62/0x83 kernel/printk/printk.c:2070 register_console+0x7ca/0xad0 kernel/printk/printk.c:2846 univ8250_console_init+0x41/0x43 drivers/tty/serial/8250/8250_core.c:690 console_init+0x52/0x97 kernel/printk/printk.c:2946 start_kernel+0x426/0x777 init/main.c:970 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #0 (console_owner){-.-.}-{0:0}: check_prev_add kernel/locking/lockdep.c:2496 [inline] check_prevs_add kernel/locking/lockdep.c:2601 [inline] validate_chain+0x1b0c/0x8920 kernel/locking/lockdep.c:3218 __lock_acquire+0x116c/0x2c30 kernel/locking/lockdep.c:4380 lock_acquire+0x160/0x720 kernel/locking/lockdep.c:4959 console_lock_spinning_enable+0x52/0x60 kernel/printk/printk.c:1682 console_unlock+0x73f/0xec0 kernel/printk/printk.c:2490 vprintk_emit+0x1f8/0x3c0 kernel/printk/printk.c:2021 printk+0x62/0x83 kernel/printk/printk.c:2070 tty_port_close_start+0x3c8/0x550 drivers/tty/tty_port.c:569 tty_port_close+0x25/0x140 drivers/tty/tty_port.c:634 tty_release+0x378/0xf90 drivers/tty/tty_io.c:1679 __fput+0x2f0/0x750 fs/file_table.c:281 task_work_run+0x137/0x1c0 kernel/task_work.c:135 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:239 [inline] __prepare_exit_to_usermode+0x14c/0x1e0 arch/x86/entry/common.c:269 do_syscall_64+0x7f/0xe0 arch/x86/entry/common.c:393 entry_SYSCALL_64_after_hwframe+0x44/0xa9 other info that might help us debug this: Chain exists of: console_owner --> &port->lock --> &port->lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port->lock#2); lock(&port->lock); lock(&port->lock#2); lock(console_owner); *** DEADLOCK *** 3 locks held by syz-executor594/6806: #0: ffff8880a1df01c0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_release+0xa5/0xf90 drivers/tty/tty_io.c:1661 #1: ffffffff8c2e11f0 (&port->lock#2){-.-.}-{2:2}, at: tty_port_close_start+0x58/0x550 drivers/tty/tty_port.c:567 #2: ffffffff894e7830 (console_lock){+.+.}-{0:0}, at: vprintk_emit+0x1db/0x3c0 kernel/printk/printk.c:2020 stack backtrace: CPU: 1 PID: 6806 Comm: syz-executor594 Not tainted 5.8.0-rc7-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+0x1f0/0x31e lib/dump_stack.c:118 print_circular_bug+0xc72/0xea0 kernel/locking/lockdep.c:1703 check_noncircular+0x1fb/0x3a0 kernel/locking/lockdep.c:1827 check_prev_add kernel/locking/lockdep.c:2496 [inline] check_prevs_add kernel/locking/lockdep.c:2601 [inline] validate_chain+0x1b0c/0x8920 kernel/locking/lockdep.c:3218 __lock_acquire+0x116c/0x2c30 kernel/locking/lockdep.c:4380 lock_acquire+0x160/0x720 kernel/locking/lockdep.c:4959 console_lock_spinning_enable+0x52/0x60 kernel/printk/printk.c:1682 console_unlock+0x73f/0xec0 kernel/printk/printk.c:2490 vprintk_emit+0x1f8/0x3c0 kernel/printk/printk.c:2021 printk+0x62/0x83 kernel/printk/printk.c:2070 tty_port_close_start+0x3c8/0x550 drivers/tty/tty_port.c:569 tty_port_close+0x25/0x140 drivers/tty/tty_port.c:634 tty_release+0x378/0xf90 drivers/tty/tty_io.c:1679 __fput+0x2f0/0x750 fs/file_table.c:281 task_work_run+0x137/0x1c0 kernel/task_work.c:135 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:239 [inline] __prepare_exit_to_usermode+0x14c/0x1e0 arch/x86/entry/common.c:269 do_syscall_64+0x7f/0xe0 arch/x86/entry/common.c:393 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x405701 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:00007ffef5148d30 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 00007ffef5148d60 RCX: 0000000000405701 RDX: 0000