====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:1/11 is trying to acquire lock: ffff888033ebf2c8 (&tty->termios_rwsem){++++}-{4:4}, at: class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] ffff888033ebf2c8 (&tty->termios_rwsem){++++}-{4:4}, at: n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:349 but task is already holding lock: ffff888032c2d0b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&buf->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x25e/0x680 drivers/tty/tty_io.c:3014 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:998 process_one_work kernel/workqueue.c:3513 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3596 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3677 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (console_lock){+.+.}-{0:0}: console_lock+0x71/0x90 kernel/printk/printk.c:2898 uart_configure_port drivers/tty/serial/serial_core.c:2601 [inline] serial_core_add_one_port drivers/tty/serial/serial_core.c:3185 [inline] serial_core_register_port+0xe23/0x2b80 drivers/tty/serial/serial_core.c:3371 __serial8250_register_8250_port drivers/tty/serial/8250/8250_core.c:862 [inline] serial8250_register_8250_port+0x1a2c/0x2400 drivers/tty/serial/8250/8250_core.c:929 serial_pnp_probe+0x576/0x7d0 drivers/tty/serial/8250/8250_pnp.c:480 pnp_device_probe+0x313/0x4d0 drivers/pnp/driver.c:111 call_driver_probe drivers/base/dd.c:-1 [inline] really_probe+0x254/0xae0 drivers/base/dd.c:707 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:869 driver_probe_device+0x4f/0x240 drivers/base/dd.c:899 __driver_attach+0x34e/0x630 drivers/base/dd.c:1300 bus_for_each_dev+0x23b/0x2c0 drivers/base/bus.c:383 bus_add_driver+0x38f/0x6e0 drivers/base/bus.c:782 driver_register+0x23a/0x320 drivers/base/driver.c:174 serial8250_init+0x8f/0x160 drivers/tty/serial/8250/8250_platform.c:316 do_one_initcall+0x1e5/0x720 init/main.c:1432 do_initcall_level+0x10a/0x1a0 init/main.c:1494 do_initcalls+0x70/0xe0 init/main.c:1510 kernel_init_freeable+0x29d/0x3e0 init/main.c:1748 kernel_init+0x22/0x1d0 init/main.c:1638 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 (&port->mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 class_mutex_constructor include/linux/mutex.h:253 [inline] uart_set_termios+0x83/0x1330 drivers/tty/serial/serial_core.c:1672 tty_set_termios+0xcaf/0x1800 drivers/tty/tty_ioctl.c:341 set_termios+0x538/0x6c0 drivers/tty/tty_ioctl.c:516 tty_mode_ioctl+0x49c/0x7c0 drivers/tty/tty_ioctl.c:-1 tty_ioctl+0x9bd/0xde0 drivers/tty/tty_io.c:2791 vfs_ioctl fs/ioctl.c:52 [inline] __do_sys_ioctl fs/ioctl.c:604 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:590 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&tty->termios_rwsem){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_write+0x91/0x200 kernel/locking/rwsem.c:1631 class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:349 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:248 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x25e/0x680 drivers/tty/tty_io.c:3014 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:998 process_one_work kernel/workqueue.c:3513 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3596 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3677 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 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: &tty->termios_rwsem --> console_lock --> &buf->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&buf->lock); lock(console_lock); lock(&buf->lock); lock(&tty->termios_rwsem); *** DEADLOCK *** locks held by kworker/0:1/11: 5, on CPU#0: #0: ffff88801cc6a148 ((wq_completion)events){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline] #0: ffff88801cc6a148 ((wq_completion)events){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #0: ffff88801cc6a148 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3478 [inline] #0: ffff88801cc6a148 ((wq_completion)events){+.+.}-{0:0}, at: process_scheduled_works+0x99a/0x1650 kernel/workqueue.c:3596 #1: ffffc90000107c40 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline] #1: ffffc90000107c40 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #1: ffffc90000107c40 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3478 [inline] #1: ffffc90000107c40 ((work_completion)(&vc_cons[currcons].SAK_work)){+.+.}-{0:0}, at: process_scheduled_works+0x99a/0x1650 kernel/workqueue.c:3596 #2: ffffffff9054d100 (console_lock){+.+.}-{0:0}, at: class_console_lock_constructor include/linux/console.h:753 [inline] #2: ffffffff9054d100 (console_lock){+.+.}-{0:0}, at: vc_SAK+0x28/0x220 drivers/tty/vt/vt_ioctl.c:989 #3: ffff888033ebf0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref drivers/tty/tty_ldisc.c:263 [inline] #3: ffff888033ebf0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_flush+0x20/0xc0 drivers/tty/tty_ldisc.c:386 #4: ffff888032c2d0b8 (&buf->lock){+.+.}-{4:4}, at: tty_buffer_flush+0x74/0x2b0 drivers/tty/tty_buffer.c:236 stack backtrace: CPU: 0 UID: 0 PID: 11 Comm: kworker/0:1 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 Workqueue: events vc_SAK Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_write+0x91/0x200 kernel/locking/rwsem.c:1631 class_rwsem_write_constructor include/linux/rwsem.h:270 [inline] n_tty_flush_buffer+0x30/0x230 drivers/tty/n_tty.c:349 tty_buffer_flush+0x1ec/0x2b0 drivers/tty/tty_buffer.c:248 tty_ldisc_flush+0x6b/0xc0 drivers/tty/tty_ldisc.c:388 __do_SAK+0x25e/0x680 drivers/tty/tty_io.c:3014 vc_SAK+0x78/0x220 drivers/tty/vt/vt_ioctl.c:998 process_one_work kernel/workqueue.c:3513 [inline] process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3596 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3677 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 tty tty20: SAK: killed process 6631 (syz.0.40): by fd#3 tty tty20: SAK: killed process 6638 (syz.0.46): by fd#3 tty tty20: SAK: killed process 6641 (syz.0.46): by fd#3 tty tty20: SAK: killed process 6648 (syz.0.49): by fd#3 tty tty20: SAK: killed process 6649 (syz.0.49): by fd#3 tty tty20: SAK: killed process 6656 (syz.0.53): by fd#3 tty tty20: SAK: killed process 6659 (syz.0.53): by fd#3 tty tty20: SAK: killed process 6656 (syz.0.53): by fd#3 tty tty20: SAK: killed process 6669 (syz.0.56): by fd#3 tty tty20: SAK: killed process 6673 (syz.0.56): by fd#3 tty tty20: SAK: killed process 6674 (syz.0.62): by fd#3 tty tty20: SAK: killed process 6675 (syz.0.62): by fd#3 tty tty20: SAK: killed process 6679 (syz.0.65): by fd#3 tty tty20: SAK: killed process 6683 (syz.0.65): by fd#3 tty tty20: SAK: killed process 6697 (syz.0.71): by fd#3 tty tty20: SAK: killed process 6700 (syz.0.71): by fd#3 tty tty20: SAK: killed process 6704 (syz.0.74): by fd#3 tty tty20: SAK: killed process 6706 (syz.0.74): by fd#3 tty tty20: SAK: killed process 6717 (syz.0.78): by fd#3 tty tty20: SAK: killed process 6718 (syz.0.78): by fd#3 tty tty20: SAK: killed process 6717 (syz.0.78): by fd#3 tty tty20: SAK: killed process 6726 (syz.0.81): by fd#3 tty tty20: SAK: killed process 6730 (syz.0.81): by fd#3 tty tty20: SAK: killed process 6738 (syz.0.85): by fd#3 tty tty20: SAK: killed process 6741 (syz.0.85): by fd#3 tty tty20: SAK: killed process 6747 (syz.0.90): by fd#3 tty tty20: SAK: killed process 6750 (syz.0.90): by fd#3 tty tty20: SAK: killed process 6757 (syz.0.93): by fd#3 tty tty20: SAK: killed process 6758 (syz.0.93): by fd#3 tty tty20: SAK: killed process 6768 (syz.0.98): by fd#3 tty tty20: SAK: killed process 6772 (syz.0.98): by fd#3 tty tty20: SAK: killed process 6786 (syz.0.105): by fd#3 tty tty20: SAK: killed process 6788 (syz.0.105): by fd#3 tty tty20: SAK: killed process 6798 (syz.0.110): by fd#3 tty tty20: SAK: killed process 6803 (syz.0.110): by fd#3 tty tty20: SAK: killed process 6807 (syz.0.112): by fd#3 tty tty20: SAK: killed process 6809 (syz.0.112): by fd#3 tty tty20: SAK: killed process 6818 (syz.0.117): by fd#3 tty tty20: SAK: killed process 6819 (syz.0.117): by fd#3 tty tty20: SAK: killed process 6836 (syz.0.124): by fd#3 tty tty20: SAK: killed process 6837 (syz.0.124): by fd#3 tty tty20: SAK: killed process 6841 (syz.0.127): by fd#3 tty tty20: SAK: killed process 6842 (syz.0.127): by fd#3 tty tty20: SAK: killed process 6949 (syz.0.169): by fd#3 tty tty20: SAK: killed process 6950 (syz.0.169): by fd#3 tty tty20: SAK: killed process 6970 (syz.0.177): by fd#3 tty tty20: SAK: killed process 6971 (syz.0.177): by fd#3 tty tty20: SAK: killed process 7032 (syz.0.200): by fd#3 tty tty20: SAK: killed process 7033 (syz.0.200): by fd#3 tty tty20: SAK: killed process 7042 (syz.0.204): by fd#3 tty tty20: SAK: killed process 7043 (syz.0.204): by fd#3 tty tty20: SAK: killed process 7170 (syz.0.256): by fd#3 tty tty20: SAK: killed process 7172 (syz.0.256): by fd#3 tty tty20: SAK: killed process 7197 (syz.0.267): by fd#3 tty tty20: SAK: killed process 7199 (syz.0.267): by fd#3