====================================================== WARNING: possible circular locking dependency detected 5.11.0-rc4-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/9842 is trying to acquire lock: ffffffff8bd05fe0 (console_owner){....}-{0:0}, at: console_trylock_spinning+0x114/0x260 kernel/printk/printk.c:1782 but task is already holding lock: ffffffff900c9498 (&port->lock){-.-.}-{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}: lock_acquire+0x114/0x5e0 kernel/locking/lockdep.c:5437 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x73/0xa0 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:1832 serial8250_handle_irq+0x2fd/0x3e0 drivers/tty/serial/8250/8250_port.c:1919 serial8250_default_handle_irq+0xaf/0x190 drivers/tty/serial/8250/8250_port.c:1935 serial8250_interrupt+0xa3/0x1e0 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x1b7/0x620 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/0xbe0 kernel/irq/chip.c:819 asm_call_irq_on_stack+0xf/0x20 __run_irq_on_irqstack arch/x86/include/asm/irq_stack.h:48 [inline] run_irq_on_irqstack_cond arch/x86/include/asm/irq_stack.h:101 [inline] handle_irq arch/x86/kernel/irq.c:230 [inline] __common_interrupt arch/x86/kernel/irq.c:249 [inline] common_interrupt+0x147/0x230 arch/x86/kernel/irq.c:239 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:619 native_safe_halt arch/x86/include/asm/irqflags.h:60 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:103 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:110 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:516 [inline] acpi_idle_enter+0x3c9/0x700 drivers/acpi/processor_idle.c:647 cpuidle_enter_state+0x486/0xd50 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x59/0x90 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x315/0x530 kernel/sched/idle.c:299 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:396 start_kernel+0x494/0x53a init/main.c:1061 secondary_startup_64_no_verify+0xb0/0xbb -> #1 (&port_lock_key){-.-.}-{2:2}: lock_acquire+0x114/0x5e0 kernel/locking/lockdep.c:5437 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x73/0xa0 kernel/locking/spinlock.c:159 serial8250_console_write+0x108/0xcc0 drivers/tty/serial/8250/8250_port.c:3292 call_console_drivers kernel/printk/printk.c:1852 [inline] console_unlock+0x960/0xcf0 kernel/printk/printk.c:2570 vprintk_emit+0x15e/0x200 kernel/printk/printk.c:2092 printk+0x62/0x83 kernel/printk/printk.c:2140 register_console+0x781/0xa60 kernel/printk/printk.c:2921 univ8250_console_init+0x41/0x43 drivers/tty/serial/8250/8250_core.c:690 console_init+0x52/0x97 kernel/printk/printk.c:3021 start_kernel+0x302/0x53a init/main.c:989 secondary_startup_64_no_verify+0xb0/0xbb -> #0 (console_owner){....}-{0:0}: check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add+0x353/0x5280 kernel/locking/lockdep.c:2993 validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x4227/0x5e90 kernel/locking/lockdep.c:4832 lock_acquire+0x114/0x5e0 kernel/locking/lockdep.c:5437 console_trylock_spinning+0x134/0x260 kernel/printk/printk.c:1799 vprintk_emit+0x145/0x200 kernel/printk/printk.c:2091 printk+0x62/0x83 kernel/printk/printk.c:2140 tty_port_close_start+0x3c8/0x550 drivers/tty/tty_port.c:569 tty_port_close+0x26/0x140 drivers/tty/tty_port.c:634 tty_release+0x30c/0xef0 drivers/tty/tty_io.c:1683 __fput+0x34d/0x7a0 fs/file_table.c:280 task_work_run+0x137/0x1c0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x10b/0x1e0 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x48/0x190 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 other info that might help us debug this: Chain exists of: console_owner --> &port_lock_key --> &port->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port->lock); lock(&port_lock_key); lock(&port->lock); lock(console_owner); *** DEADLOCK *** 2 locks held by syz-executor.1/9842: #0: ffff8880743391c0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_release+0xac/0xef0 drivers/tty/tty_io.c:1665 #1: ffffffff900c9498 (&port->lock){-.-.}-{2:2}, at: tty_port_close_start+0x58/0x550 drivers/tty/tty_port.c:567 stack backtrace: CPU: 0 PID: 9842 Comm: syz-executor.1 Not tainted 5.11.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x137/0x1be lib/dump_stack.c:120 print_circular_bug+0xadf/0xd80 kernel/locking/lockdep.c:1996 check_noncircular+0x221/0x2d0 kernel/locking/lockdep.c:2117 check_prev_add kernel/locking/lockdep.c:2868 [inline] check_prevs_add+0x353/0x5280 kernel/locking/lockdep.c:2993 validate_chain kernel/locking/lockdep.c:3608 [inline] __lock_acquire+0x4227/0x5e90 kernel/locking/lockdep.c:4832 lock_acquire+0x114/0x5e0 kernel/locking/lockdep.c:5437 console_trylock_spinning+0x134/0x260 kernel/printk/printk.c:1799 vprintk_emit+0x145/0x200 kernel/printk/printk.c:2091 printk+0x62/0x83 kernel/printk/printk.c:2140 tty_port_close_start+0x3c8/0x550 drivers/tty/tty_port.c:569 tty_port_close+0x26/0x140 drivers/tty/tty_port.c:634 tty_release+0x30c/0xef0 drivers/tty/tty_io.c:1683 __fput+0x34d/0x7a0 fs/file_table.c:280 task_work_run+0x137/0x1c0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x10b/0x1e0 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x48/0x190 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x417b71 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 a4 1a 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffe684a32b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000417b71 RDX: 00000000000f4240 RSI: 0000000000000081 RDI: 0000000000000003 RBP: 0000000000000000 R08: 00000000011a0120 R09: 0000000000000000 R10: 00007ffe684a3380 R11: 0000000000000293 R12: ffffffffffffffff R13: 0000000000000000 R14: 0000000000000003 R15: 000000000119bf8c