====================================================== WARNING: possible circular locking dependency detected 5.12.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/25302 is trying to acquire lock: ffff800015f88fc0 (console_owner){-...}-{0:0}, at: console_unlock+0x274/0xc1c kernel/printk/printk.c:2551 but task is already holding lock: ffff800017fbfd98 (&port->lock){....}-{2:2}, at: tty_port_close_start.part.0+0x30/0x44c 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}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa8/0x160 kernel/locking/spinlock.c:159 tty_port_tty_get+0x24/0xe0 drivers/tty/tty_port.c:288 tty_port_default_wakeup+0x10/0x40 drivers/tty/tty_port.c:47 tty_port_tty_wakeup+0x54/0x74 drivers/tty/tty_port.c:388 uart_write_wakeup+0x38/0x54 drivers/tty/serial/serial_core.c:106 pl011_tx_chars+0x498/0xcec drivers/tty/serial/amba-pl011.c:1417 pl011_start_tx_pio drivers/tty/serial/amba-pl011.c:1302 [inline] pl011_start_tx+0x31c/0x860 drivers/tty/serial/amba-pl011.c:1314 __uart_start.isra.0+0x10c/0x154 drivers/tty/serial/serial_core.c:127 uart_write+0x21c/0xa7c drivers/tty/serial/serial_core.c:614 process_output_block drivers/tty/n_tty.c:591 [inline] n_tty_write+0x278/0xc20 drivers/tty/n_tty.c:2353 do_tty_write drivers/tty/tty_io.c:1043 [inline] file_tty_write.constprop.0+0x2e4/0x630 drivers/tty/tty_io.c:1133 redirected_tty_write+0xc4/0xf0 drivers/tty/tty_io.c:1140 call_write_iter include/linux/fs.h:1977 [inline] new_sync_write+0x2f0/0x500 fs/read_write.c:518 vfs_write+0x40c/0x570 fs/read_write.c:605 ksys_write+0xec/0x1d0 fs/read_write.c:658 __do_sys_write fs/read_write.c:670 [inline] __se_sys_write fs/read_write.c:667 [inline] __arm64_sys_write+0x6c/0xa0 fs/read_write.c:667 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall arch/arm64/kernel/syscall.c:49 [inline] el0_svc_common.constprop.0+0xf0/0x2c0 arch/arm64/kernel/syscall.c:129 do_el0_svc+0xa4/0xd0 arch/arm64/kernel/syscall.c:168 el0_svc+0x24/0x3c arch/arm64/kernel/entry-common.c:416 el0_sync_handler+0x1a4/0x1b0 arch/arm64/kernel/entry-common.c:432 el0_sync+0x174/0x180 arch/arm64/kernel/entry.S:701 -> #1 (&port_lock_key){-...}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x8c/0x120 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:354 [inline] pl011_console_write+0x338/0x580 drivers/tty/serial/amba-pl011.c:2215 call_console_drivers kernel/printk/printk.c:1862 [inline] console_unlock+0x430/0xc1c kernel/printk/printk.c:2576 register_console+0x324/0x6d4 kernel/printk/printk.c:2917 uart_configure_port drivers/tty/serial/serial_core.c:2393 [inline] uart_add_one_port+0x11c0/0x11f0 drivers/tty/serial/serial_core.c:2906 pl011_register_port+0x110/0x274 drivers/tty/serial/amba-pl011.c:2638 pl011_probe+0x498/0x5f4 drivers/tty/serial/amba-pl011.c:2679 amba_probe+0x140/0x310 drivers/amba/bus.c:207 really_probe+0x3e4/0xc60 drivers/base/dd.c:563 driver_probe_device+0x1c8/0x310 drivers/base/dd.c:745 __device_attach_driver+0x158/0x200 drivers/base/dd.c:851 bus_for_each_drv+0x118/0x1b4 drivers/base/bus.c:431 __device_attach+0x1b4/0x360 drivers/base/dd.c:919 device_initial_probe+0x14/0x20 drivers/base/dd.c:966 bus_probe_device+0x15c/0x1dc drivers/base/bus.c:491 device_add+0x814/0x15f0 drivers/base/core.c:3242 amba_device_try_add+0x30c/0x6cc drivers/amba/bus.c:468 amba_device_add+0x1c/0x50 drivers/amba/bus.c:558 of_amba_device_create drivers/of/platform.c:268 [inline] of_platform_bus_create+0x5e0/0x88c drivers/of/platform.c:388 of_platform_populate+0x60/0x150 drivers/of/platform.c:485 of_platform_default_populate drivers/of/platform.c:504 [inline] of_platform_default_populate_init+0xd8/0xf8 drivers/of/platform.c:542 do_one_initcall+0x138/0x9a0 init/main.c:1226 do_initcall_level init/main.c:1299 [inline] do_initcalls init/main.c:1315 [inline] do_basic_setup init/main.c:1335 [inline] kernel_init_freeable+0x6c4/0x72c init/main.c:1537 kernel_init+0x14/0x124 init/main.c:1424 ret_from_fork+0x10/0x3c arch/arm64/kernel/entry.S:960 -> #0 (console_owner){-...}-{0:0}: check_prev_add kernel/locking/lockdep.c:2937 [inline] check_prevs_add kernel/locking/lockdep.c:3060 [inline] validate_chain kernel/locking/lockdep.c:3675 [inline] __lock_acquire+0x26e0/0x47b0 kernel/locking/lockdep.c:4901 lock_acquire kernel/locking/lockdep.c:5511 [inline] lock_acquire+0x5b0/0xbbc kernel/locking/lockdep.c:5476 console_lock_spinning_enable kernel/printk/printk.c:1714 [inline] console_unlock+0x2e0/0xc1c kernel/printk/printk.c:2573 vprintk_emit+0x140/0x350 kernel/printk/printk.c:2098 vprintk_default+0x3c/0x50 kernel/printk/printk.c:2115 vprintk_func+0x2f8/0x5dc kernel/printk/printk_safe.c:401 printk+0xa8/0xe0 kernel/printk/printk.c:2146 tty_port_close_start.part.0+0x3e4/0x44c drivers/tty/tty_port.c:569 tty_port_close_start drivers/tty/tty_port.c:641 [inline] tty_port_close+0x4c/0x150 drivers/tty/tty_port.c:634 tpk_close+0x80/0x114 drivers/char/ttyprintk.c:110 tty_release+0x32c/0xe74 drivers/tty/tty_io.c:1779 __fput+0x1a0/0x6b0 fs/file_table.c:280 ____fput+0x10/0x20 fs/file_table.c:313 task_work_run+0xd4/0x20c kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x12e4/0x25fc arch/arm64/kernel/signal.c:939 work_pending+0xc/0x35c 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 *** 3 locks held by syz-executor.1/25302: #0: ffff0000100541c0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_lock+0x88/0xf4 drivers/tty/tty_mutex.c:19 #1: ffff800017fbfd98 (&port->lock){....}-{2:2}, at: tty_port_close_start.part.0+0x30/0x44c drivers/tty/tty_port.c:567 #2: ffff800015f88a40 (console_lock){+.+.}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1776 [inline] #2: ffff800015f88a40 (console_lock){+.+.}-{0:0}, at: vprintk_emit+0x138/0x350 kernel/printk/printk.c:2097 stack backtrace: CPU: 1 PID: 25302 Comm: syz-executor.1 Not tainted 5.12.0-syzkaller #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x0/0x3e0 arch/arm64/include/asm/pointer_auth.h:76 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:191 __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x120/0x1a8 lib/dump_stack.c:120 print_circular_bug+0x2d4/0x2f0 kernel/locking/lockdep.c:2006 check_noncircular+0x268/0x2e0 kernel/locking/lockdep.c:2128 check_prev_add kernel/locking/lockdep.c:2937 [inline] check_prevs_add kernel/locking/lockdep.c:3060 [inline] validate_chain kernel/locking/lockdep.c:3675 [inline] __lock_acquire+0x26e0/0x47b0 kernel/locking/lockdep.c:4901 lock_acquire kernel/locking/lockdep.c:5511 [inline] lock_acquire+0x5b0/0xbbc kernel/locking/lockdep.c:5476 console_lock_spinning_enable kernel/printk/printk.c:1714 [inline] console_unlock+0x2e0/0xc1c kernel/printk/printk.c:2573 vprintk_emit+0x140/0x350 kernel/printk/printk.c:2098 vprintk_default+0x3c/0x50 kernel/printk/printk.c:2115 vprintk_func+0x2f8/0x5dc kernel/printk/printk_safe.c:401 printk+0xa8/0xe0 kernel/printk/printk.c:2146 tty_port_close_start.part.0+0x3e4/0x44c drivers/tty/tty_port.c:569 tty_port_close_start drivers/tty/tty_port.c:641 [inline] tty_port_close+0x4c/0x150 drivers/tty/tty_port.c:634 tpk_close+0x80/0x114 drivers/char/ttyprintk.c:110 tty_release+0x32c/0xe74 drivers/tty/tty_io.c:1779 __fput+0x1a0/0x6b0 fs/file_table.c:280 ____fput+0x10/0x20 fs/file_table.c:313 task_work_run+0xd4/0x20c kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x12e4/0x25fc arch/arm64/kernel/signal.c:939 work_pending+0xc/0x35c