====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:3/989 is trying to acquire lock: ffff88813ff730a8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 but task is already holding lock: ffffffff8d5a25c0 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:737 [inline] ffffffff8d5a25c0 (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}: console_lock+0x76/0x90 kernel/printk/printk.c:2843 class_console_lock_constructor include/linux/console.h:737 [inline] con_flush_chars+0x9d/0x2c0 drivers/tty/vt/vt.c:3634 n_tty_write+0xf78/0x12a0 drivers/tty/n_tty.c:2382 iterate_tty_write drivers/tty/tty_io.c:1006 [inline] file_tty_write+0x562/0xa30 drivers/tty/tty_io.c:1081 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5d5/0xb40 fs/read_write.c:686 ksys_write+0x14b/0x260 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&tty->termios_rwsem){++++}-{4:4}: down_write+0x3a/0x50 kernel/locking/rwsem.c:1590 class_rwsem_write_constructor include/linux/rwsem.h:257 [inline] n_tty_flush_buffer+0x2f/0x280 drivers/tty/n_tty.c:349 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+0x369/0x570 drivers/tty/tty_port.c:627 tty_port_close+0x28/0x160 drivers/tty/tty_port.c:682 tty_release+0x38c/0x1720 drivers/tty/tty_io.c:1745 __fput+0x45b/0xa80 fs/file_table.c:468 task_work_run+0x1d4/0x260 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x6c5/0x2310 kernel/exit.c:971 do_group_exit+0x21c/0x2d0 kernel/exit.c:1112 __do_sys_exit_group kernel/exit.c:1123 [inline] __se_sys_exit_group kernel/exit.c:1121 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1121 __pfx_syscall_get_nr+0x0/0x10 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 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 kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xe3/0x6d0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 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/0:3/989: #0: ffff88813ff55138 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3232 [inline] #0: ffff88813ff55138 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x9b4/0x1770 kernel/workqueue.c:3340 #1: ffffc900047c7b80 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3233 [inline] #1: ffffc900047c7b80 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_scheduled_works+0x9ef/0x1770 kernel/workqueue.c:3340 #2: ffffffff8d5a25c0 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:737 [inline] #2: ffffffff8d5a25c0 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:985 #3: ffff88803941e0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff88803941e0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x20/0xc0 drivers/tty/tty_ldisc.c:386 stack backtrace: CPU: 0 UID: 0 PID: 989 Comm: kworker/0:3 Not tainted syzkaller #0 PREEMPT_{RT,(full)} Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Workqueue: events vc_SAK Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 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 kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 __mutex_lock_common kernel/locking/rtmutex_api.c:533 [inline] mutex_lock_nested+0x5a/0x1d0 kernel/locking/rtmutex_api.c:552 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:229 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0xe3/0x6d0 drivers/tty/tty_io.c:3025 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:994 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246