====================================================== WARNING: possible circular locking dependency detected 5.12.0-rc3-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/22234 is trying to acquire lock: 82a41234 (console_owner){-.-.}-{0:0}, at: console_unlock+0x19c/0x7c8 kernel/printk/printk.c:2551 but task is already holding lock: 833b8cb4 (&port->lock){....}-{2:2}, at: tty_port_close_start.part.0+0x24/0x1a4 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+0x6c/0x74 kernel/locking/lockdep.c:5483 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x54/0x70 kernel/locking/spinlock.c:159 tty_port_tty_get+0x1c/0x88 drivers/tty/tty_port.c:288 tty_port_default_wakeup+0x10/0x28 drivers/tty/tty_port.c:47 tty_port_tty_wakeup+0x18/0x1c drivers/tty/tty_port.c:388 uart_write_wakeup+0x1c/0x24 drivers/tty/serial/serial_core.c:106 pl011_tx_chars+0x278/0x2d0 drivers/tty/serial/amba-pl011.c:1417 pl011_start_tx_pio drivers/tty/serial/amba-pl011.c:1302 [inline] pl011_start_tx+0xc8/0x1a0 drivers/tty/serial/amba-pl011.c:1314 __uart_start+0x50/0x54 drivers/tty/serial/serial_core.c:127 uart_write+0xf0/0x204 drivers/tty/serial/serial_core.c:614 process_output_block drivers/tty/n_tty.c:591 [inline] n_tty_write+0x218/0x508 drivers/tty/n_tty.c:2353 do_tty_write drivers/tty/tty_io.c:1043 [inline] file_tty_write.constprop.0+0x178/0x2ec drivers/tty/tty_io.c:1133 tty_write drivers/tty/tty_io.c:1140 [inline] redirected_tty_write drivers/tty/tty_io.c:1162 [inline] redirected_tty_write+0x98/0xa4 drivers/tty/tty_io.c:1143 call_write_iter include/linux/fs.h:1977 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0x260/0x350 fs/read_write.c:605 ksys_write+0x68/0xec fs/read_write.c:658 __do_sys_write fs/read_write.c:670 [inline] sys_write+0x10/0x14 fs/read_write.c:667 ret_fast_syscall+0x0/0x2c arch/arm/mm/proc-v7.S:64 0x7eff4410 -> #1 (&port_lock_key){-.-.}-{2:2}: lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5483 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x44/0x54 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:354 [inline] pl011_console_write+0x16c/0x1bc drivers/tty/serial/amba-pl011.c:2215 call_console_drivers kernel/printk/printk.c:1862 [inline] console_unlock+0x31c/0x7c8 kernel/printk/printk.c:2576 register_console kernel/printk/printk.c:2917 [inline] register_console+0x204/0x350 kernel/printk/printk.c:2807 uart_configure_port drivers/tty/serial/serial_core.c:2393 [inline] uart_add_one_port+0x4d4/0x4fc drivers/tty/serial/serial_core.c:2906 pl011_register_port+0x64/0xdc drivers/tty/serial/amba-pl011.c:2638 pl011_probe+0x138/0x154 drivers/tty/serial/amba-pl011.c:2679 amba_probe+0xa4/0x128 drivers/amba/bus.c:207 really_probe+0x100/0x50c drivers/base/dd.c:554 driver_probe_device+0xf8/0x1c8 drivers/base/dd.c:740 __device_attach_driver+0x8c/0xf0 drivers/base/dd.c:846 bus_for_each_drv+0x88/0xd8 drivers/base/bus.c:431 __device_attach+0xdc/0x1d0 drivers/base/dd.c:914 device_initial_probe+0x14/0x18 drivers/base/dd.c:961 bus_probe_device+0x90/0x98 drivers/base/bus.c:491 device_add+0x324/0x828 drivers/base/core.c:3242 amba_device_try_add+0x58/0x304 drivers/amba/bus.c:468 amba_deferred_retry+0x48/0xac drivers/amba/bus.c:523 amba_deferred_retry_func+0x10/0x48 drivers/amba/bus.c:540 process_one_work+0x2d4/0x998 kernel/workqueue.c:2275 worker_thread+0x64/0x54c kernel/workqueue.c:2421 kthread+0x184/0x1a4 kernel/kthread.c:292 ret_from_fork+0x14/0x20 arch/arm/kernel/entry-common.S:158 0x0 -> #0 (console_owner){-.-.}-{0:0}: check_prev_add kernel/locking/lockdep.c:2936 [inline] check_prevs_add kernel/locking/lockdep.c:3059 [inline] validate_chain kernel/locking/lockdep.c:3674 [inline] __lock_acquire+0x182c/0x3318 kernel/locking/lockdep.c:4900 lock_acquire.part.0+0xf0/0x41c kernel/locking/lockdep.c:5510 lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5483 console_lock_spinning_enable kernel/printk/printk.c:1714 [inline] console_unlock+0x218/0x7c8 kernel/printk/printk.c:2573 vprintk_emit+0x104/0x364 kernel/printk/printk.c:2098 vprintk_default+0x28/0x30 kernel/printk/printk.c:2115 vprintk_func+0xfc/0x1c4 kernel/printk/printk_safe.c:401 printk+0x34/0x5c kernel/printk/printk.c:2146 tty_port_close_start.part.0+0x19c/0x1a4 drivers/tty/tty_port.c:569 tty_port_close_start drivers/tty/tty_port.c:564 [inline] tty_port_close+0x30/0x9c drivers/tty/tty_port.c:634 tpk_close+0x58/0x80 drivers/char/ttyprintk.c:110 tty_release+0x120/0x610 drivers/tty/tty_io.c:1779 __fput+0x9c/0x264 fs/file_table.c:280 ____fput+0x10/0x14 fs/file_table.c:313 task_work_run+0xa0/0xdc kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_work_pending+0x520/0x648 arch/arm/kernel/signal.c:672 slow_work_pending+0xc/0x20 0x29328 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.0/22234: #0: 86b5f8f0 (&tty->legacy_mutex){+.+.}-{3:3}, at: tty_lock+0x68/0xb0 drivers/tty/tty_mutex.c:19 #1: 833b8cb4 (&port->lock){....}-{2:2}, at: tty_port_close_start.part.0+0x24/0x1a4 drivers/tty/tty_port.c:567 #2: 82a41150 (console_lock){+.+.}-{0:0}, at: vprintk_default+0x28/0x30 kernel/printk/printk.c:2115 stack backtrace: CPU: 0 PID: 22234 Comm: syz-executor.0 Not tainted 5.12.0-rc3-syzkaller #0 Hardware name: ARM-Versatile Express Backtrace: [<81802550>] (dump_backtrace) from [<818027c4>] (show_stack+0x18/0x1c arch/arm/kernel/traps.c:252) r7:00000080 r6:60000093 r5:00000000 r4:82b58344 [<818027ac>] (show_stack) from [<81809e98>] (__dump_stack lib/dump_stack.c:79 [inline]) [<818027ac>] (show_stack) from [<81809e98>] (dump_stack+0xb8/0xe8 lib/dump_stack.c:120) [<81809de0>] (dump_stack) from [<802b97b4>] (print_circular_bug+0x308/0x35c kernel/locking/lockdep.c:2005) r7:86d196e8 r6:830db180 r5:830e24bc r4:830cba3c [<802b94ac>] (print_circular_bug) from [<802b990c>] (check_noncircular+0x104/0x170 kernel/locking/lockdep.c:2127) r10:00000003 r9:830cb7e4 r8:81f47d20 r7:00000000 r6:86d73b10 r5:86d196e8 r4:86d19728 [<802b9808>] (check_noncircular) from [<802bd4b4>] (check_prev_add kernel/locking/lockdep.c:2936 [inline]) [<802b9808>] (check_noncircular) from [<802bd4b4>] (check_prevs_add kernel/locking/lockdep.c:3059 [inline]) [<802b9808>] (check_noncircular) from [<802bd4b4>] (validate_chain kernel/locking/lockdep.c:3674 [inline]) [<802b9808>] (check_noncircular) from [<802bd4b4>] (__lock_acquire+0x182c/0x3318 kernel/locking/lockdep.c:4900) r7:83278fe8 r6:81f4cd38 r5:86d196e8 r4:830cba3c [<802bbc88>] (__lock_acquire) from [<802bfb90>] (lock_acquire.part.0+0xf0/0x41c kernel/locking/lockdep.c:5510) r10:00000080 r9:60000093 r8:00000000 r7:00000000 r6:828a2680 r5:828a2680 r4:86d73b90 [<802bfaa0>] (lock_acquire.part.0) from [<802bff28>] (lock_acquire+0x6c/0x74 kernel/locking/lockdep.c:5483) r10:802d3f7c r9:00000000 r8:00000001 r7:00000000 r6:00000000 r5:00000000 r4:82a41234 [<802bfebc>] (lock_acquire) from [<802d3ff8>] (console_lock_spinning_enable kernel/printk/printk.c:1714 [inline]) [<802bfebc>] (lock_acquire) from [<802d3ff8>] (console_unlock+0x218/0x7c8 kernel/printk/printk.c:2573) r10:86d73c94 r9:83278a28 r8:81fb9520 r7:82a410e0 r6:83278f58 r5:00000000 r4:00000000 [<802d3de0>] (console_unlock) from [<802d5448>] (vprintk_emit+0x104/0x364 kernel/printk/printk.c:2098) r10:60000093 r9:ffffffff r8:81fb9520 r7:00000048 r6:83278a28 r5:00000000 r4:82a224f8 [<802d5344>] (vprintk_emit) from [<802d56d0>] (vprintk_default+0x28/0x30 kernel/printk/printk.c:2115) r10:00000000 r9:833b8de4 r8:81fbe8e0 r7:00000000 r6:81fb9520 r5:86d73ddc r4:00000000 [<802d56a8>] (vprintk_default) from [<802d6758>] (vprintk_func+0xfc/0x1c4 kernel/printk/printk_safe.c:401) [<802d665c>] (vprintk_func) from [<81805fa8>] (printk+0x34/0x5c kernel/printk/printk.c:2146) r7:833b8ca4 r6:60000013 r5:86b5f800 r4:833b8bf4 [<81805f74>] (printk) from [<80948250>] (tty_port_close_start.part.0+0x19c/0x1a4 drivers/tty/tty_port.c:569) r3:81b18070 r2:86b5fa8c r1:81fbe8e0 r0:81fb9520 [<809480b4>] (tty_port_close_start.part.0) from [<8094885c>] (tty_port_close_start drivers/tty/tty_port.c:564 [inline]) [<809480b4>] (tty_port_close_start.part.0) from [<8094885c>] (tty_port_close+0x30/0x9c drivers/tty/tty_port.c:634) r8:833b8bf4 r7:a0000013 r6:870cc140 r5:86b5f800 r4:833b8bf4 [<8094882c>] (tty_port_close) from [<8098cf6c>] (tpk_close+0x58/0x80 drivers/char/ttyprintk.c:110) r7:a0000013 r6:870cc140 r5:833b8bf0 r4:86b5f800 [<8098cf14>] (tpk_close) from [<8093eaf4>] (tty_release+0x120/0x610 drivers/tty/tty_io.c:1779) r10:00000000 r9:86d19634 r8:870cc140 r7:84471850 r6:00000000 r5:86b5f800 r4:86b5f800 r3:8098cf14 [<8093e9d4>] (tty_release) from [<804dc2e0>] (__fput+0x9c/0x264 fs/file_table.c:280) r10:5ac3c35a r9:86d19634 r8:83825d80 r7:84471850 r6:000a0001 r5:844b6d00 r4:870cc140 [<804dc244>] (__fput) from [<804dc524>] (____fput+0x10/0x14 fs/file_table.c:313) r9:86d19634 r8:81f4a770 r7:82c6ba40 r6:86d19040 r5:86d195e4 r4:00000000 [<804dc514>] (____fput) from [<80270030>] (task_work_run+0xa0/0xdc kernel/task_work.c:140) [<8026ff90>] (task_work_run) from [<8020ce3c>] (tracehook_notify_resume include/linux/tracehook.h:189 [inline]) [<8026ff90>] (task_work_run) from [<8020ce3c>] (do_work_pending+0x520/0x648 arch/arm/kernel/signal.c:672) r9:81f42a14 r8:fffffe30 r7:86d72000 r6:80200224 r5:86d73fb0 r4:ffffe000 [<8020c91c>] (do_work_pending) from [<80200098>] (slow_work_pending+0xc/0x20) Exception stack(0x86d73fb0 to 0x86d73ff8) 3fa0: 00000000 00000002 00000000 00000003 3fc0: 00000004 029654c0 00000010 00000006 001200ac 00000000 008ee566 000f4240 3fe0: 00530000 7ec94350 00028e6c 00029328 80000010 00000003 r10:00000006 r9:86d72000 r8:80200224 r7:00000006 r6:00000010 r5:029654c0 r4:00000004