====================================================== WARNING: possible circular locking dependency detected 6.16.0-rc3-syzkaller #0 Not tainted ------------------------------------------------------ kworker/1:6/14488 is trying to acquire lock: ffff88801a8a10b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 but task is already holding lock: ffffffff8e3330e0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:999 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (console_lock){+.+.}-{0:0}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871 console_lock+0x164/0x1b0 kernel/printk/printk.c:2849 con_flush_chars+0x70/0x280 drivers/tty/vt/vt.c:3585 n_tty_write+0xee1/0x11d0 drivers/tty/n_tty.c:2393 iterate_tty_write drivers/tty/tty_io.c:1006 [inline] file_tty_write+0x503/0x990 drivers/tty/tty_io.c:1081 aio_write+0x535/0x7a0 fs/aio.c:1634 __io_submit_one fs/aio.c:-1 [inline] io_submit_one+0x78b/0x1310 fs/aio.c:2053 __do_sys_io_submit fs/aio.c:2112 [inline] __se_sys_io_submit+0x185/0x2f0 fs/aio.c:2082 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&tty->termios_rwsem){++++}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577 n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:352 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:241 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 tty_port_close_start+0x2da/0x550 drivers/tty/tty_port.c:643 tty_port_close+0x2a/0x150 drivers/tty/tty_port.c:698 tty_release+0x389/0x1640 drivers/tty/tty_io.c:1745 __fput+0x44c/0xa70 fs/file_table.c:465 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&buf->lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871 __mutex_lock_common kernel/locking/mutex.c:602 [inline] __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x138/0x6d0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:1009 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: &buf->lock --> &tty->termios_rwsem --> console_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(console_lock); lock(&tty->termios_rwsem); lock(console_lock); lock(&buf->lock); *** DEADLOCK *** 4 locks held by kworker/1:6/14488: #0: ffff88801a880d48 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3213 [inline] #0: ffff88801a880d48 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0 kernel/workqueue.c:3321 #1: ffffc90004237bc0 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3214 [inline] #1: ffffc90004237bc0 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0 kernel/workqueue.c:3321 #2: ffffffff8e3330e0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:999 #3: ffff888025f2e0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff888025f2e0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x20/0xc0 drivers/tty/tty_ldisc.c:386 stack backtrace: CPU: 1 UID: 0 PID: 14488 Comm: kworker/1:6 Not tainted 6.16.0-rc3-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Workqueue: events vc_SAK Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2046 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3168 [inline] check_prevs_add kernel/locking/lockdep.c:3287 [inline] validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3911 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5240 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5871 __mutex_lock_common kernel/locking/mutex.c:602 [inline] __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:747 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x138/0x6d0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:1009 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245