====================================================== WARNING: possible circular locking dependency detected 5.12.0-rc3-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/6679 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 0x7e8ee410 -> #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.1/6679: #0: 86db54f0 (&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: 1 PID: 6679 Comm: syz-executor.1 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:86a9b768 r6:830dbcd4 r5:830e2584 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:84a2fb10 r5:86a9b768 r4:86a9b7a8 [<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:86a9b768 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:84a2fb90 [<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:84a2fc94 r9:83278a28 r8:81fb9520 r7:82a410e0 r6:83278f58 r5:00000000 r4:00000001 [<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:84a2fddc 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:86db5400 r4:833b8bf4 [<81805f74>] (printk) from [<80948250>] (tty_port_close_start.part.0+0x19c/0x1a4 drivers/tty/tty_port.c:569) r3:81b18070 r2:86db568c 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:8356e140 r5:86db5400 r4:833b8bf4 [<8094882c>] (tty_port_close) from [<8098cf6c>] (tpk_close+0x58/0x80 drivers/char/ttyprintk.c:110) r7:a0000013 r6:8356e140 r5:833b8bf0 r4:86db5400 [<8098cf14>] (tpk_close) from [<8093eaf4>] (tty_release+0x120/0x610 drivers/tty/tty_io.c:1779) r10:00000000 r9:86a9b6b4 r8:8356e140 r7:85b1b850 r6:00000000 r5:86db5400 r4:86db5400 r3:8098cf14 [<8093e9d4>] (tty_release) from [<804dc2e0>] (__fput+0x9c/0x264 fs/file_table.c:280) r10:5ac3c35a r9:86a9b6b4 r8:84204b40 r7:85b1b850 r6:000a0001 r5:844aaa08 r4:8356e140 [<804dc244>] (__fput) from [<804dc524>] (____fput+0x10/0x14 fs/file_table.c:313) r9:86a9b6b4 r8:81f4a770 r7:82c6ba40 r6:86a9b0c0 r5:86a9b664 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:84a2e000 r6:80200224 r5:84a2ffb0 r4:ffffe000 [<8020c91c>] (do_work_pending) from [<80200098>] (slow_work_pending+0xc/0x20) Exception stack(0x84a2ffb0 to 0x84a2fff8) ffa0: 00000000 00000002 00000000 00000003 ffc0: 00000004 01cfa4c0 00000008 00000006 001200ac 00000000 000d0a56 000f4240 ffe0: 00530000 7ea65350 00028e6c 00029328 80000010 00000003 r10:00000006 r9:84a2e000 r8:80200224 r7:00000006 r6:00000008 r5:01cfa4c0 r4:00000004