====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:1/10 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: ffffffff8e530860 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:669 [inline] ffffffff8e530860 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:985 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:5868 console_lock+0x76/0x90 kernel/printk/printk.c:2822 class_console_lock_constructor include/linux/console.h:669 [inline] con_flush_chars+0x70/0x280 drivers/tty/vt/vt.c:3634 __receive_buf drivers/tty/n_tty.c:1628 [inline] n_tty_receive_buf_common+0xc8b/0x12f0 drivers/tty/n_tty.c:1723 tty_port_default_receive_buf+0x6e/0xa0 drivers/tty/tty_port.c:37 receive_buf drivers/tty/tty_buffer.c:445 [inline] flush_to_ldisc+0x24a/0x6e0 drivers/tty/tty_buffer.c:495 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 (&tty->termios_rwsem){++++}-{4:4}: lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 down_write+0x96/0x1f0 kernel/locking/rwsem.c:1590 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+0x388/0x580 drivers/tty/tty_port.c:627 tty_port_close+0x2a/0x170 drivers/tty/tty_port.c:682 tty_release+0x389/0x1640 drivers/tty/tty_io.c:1745 __fput+0x44c/0xa70 fs/file_table.c:468 task_work_run+0x1d4/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x130 kernel/entry/common.c:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x2bd/0xfa0 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:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 __do_SAK+0xf2/0x6e0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158 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 *** 3 locks held by kworker/0:1/10: #0: ffff88801a871548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3238 [inline] #0: ffff88801a871548 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x17b0 kernel/workqueue.c:3346 #1: ffffc900000f7ba0 ((work_completion)(&vc_cons[currcons].SAK_work)#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3239 [inline] #1: ffffc900000f7ba0 ((work_completion)(&vc_cons[currcons].SAK_work)#2){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x17b0 kernel/workqueue.c:3346 #2: ffffffff8e530860 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:669 [inline] #2: ffffffff8e530860 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:985 stack backtrace: CPU: 0 UID: 0 PID: 10 Comm: kworker/0:1 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/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:2043 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908 __lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:760 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 __do_SAK+0xf2/0x6e0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3263 [inline] process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245