====================================================== WARNING: possible circular locking dependency detected 5.14.0-rc3-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/572 is trying to acquire lock: ffffffff8c70c060 (console_owner){-...}-{0:0}, at: console_lock_spinning_enable+0x2d/0x60 kernel/printk/printk.c:1787 but task is already holding lock: ffff888018817158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xc5/0x170 drivers/tty/pty.c:120 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&port->lock){-.-.}-{2:2}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:159 tty_port_tty_get+0x21/0xe0 drivers/tty/tty_port.c:289 tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:48 serial8250_tx_chars+0x68e/0x8a0 drivers/tty/serial/8250/8250_port.c:1838 serial8250_handle_irq+0x301/0x3e0 drivers/tty/serial/8250/8250_port.c:1924 serial8250_default_handle_irq+0xaf/0x190 drivers/tty/serial/8250/8250_port.c:1941 serial8250_interrupt+0xa3/0x1e0 drivers/tty/serial/8250/8250_core.c:126 __handle_irq_event_percpu+0x20a/0x6d0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0x10a/0x300 kernel/irq/handle.c:213 handle_edge_irq+0x245/0xbe0 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0xce/0x1e0 arch/x86/kernel/irq.c:250 common_interrupt+0x9c/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline] _raw_spin_unlock_irqrestore+0xbc/0x120 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:409 [inline] uart_write+0x69d/0x910 drivers/tty/serial/serial_core.c:591 do_output_char+0x638/0x940 drivers/tty/n_tty.c:444 process_output drivers/tty/n_tty.c:511 [inline] n_tty_write+0xe33/0x1310 drivers/tty/n_tty.c:2300 do_tty_write drivers/tty/tty_io.c:1038 [inline] file_tty_write+0x5c5/0x9a0 drivers/tty/tty_io.c:1110 do_iter_readv_writev+0x566/0x770 include/linux/fs.h:2108 do_iter_write+0x16c/0x5f0 fs/read_write.c:866 vfs_writev fs/read_write.c:939 [inline] do_writev+0x240/0x440 fs/read_write.c:982 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&port_lock_key){-.-.}-{2:2}: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:159 serial8250_console_write+0x17a/0xee0 drivers/tty/serial/8250/8250_port.c:3337 call_console_drivers kernel/printk/printk.c:1938 [inline] console_unlock+0x9aa/0xec0 kernel/printk/printk.c:2643 vprintk_emit+0x21a/0x2f0 kernel/printk/printk.c:2174 vprintk+0x30d/0x370 kernel/printk/printk_safe.c:392 printk+0xc0/0x108 kernel/printk/printk.c:2216 register_console+0x6c0/0x9a0 kernel/printk/printk.c:2991 univ8250_console_init+0x41/0x43 drivers/tty/serial/8250/8250_core.c:680 console_init+0x52/0x97 kernel/printk/printk.c:3091 start_kernel+0x311/0x549 init/main.c:1049 secondary_startup_64_no_verify+0xb0/0xbb -> #0 (console_owner){-...}-{0:0}: check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174 validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 console_lock_spinning_enable+0x52/0x60 kernel/printk/printk.c:1790 console_unlock+0x6f5/0xec0 kernel/printk/printk.c:2640 vprintk_emit+0x21a/0x2f0 kernel/printk/printk.c:2174 vprintk+0x30d/0x370 kernel/printk/printk_safe.c:392 printk+0xc0/0x108 kernel/printk/printk.c:2216 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x366/0x4b0 lib/fault-inject.c:146 should_failslab+0x5/0x20 mm/slab_common.c:1326 slab_pre_alloc_hook mm/slab.h:494 [inline] slab_alloc_node mm/slub.c:2877 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x89/0x390 mm/slub.c:4100 kmalloc include/linux/slab.h:596 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:177 [inline] __tty_buffer_request_room+0x1f0/0x540 drivers/tty/tty_buffer.c:275 tty_insert_flip_string_fixed_flag+0x92/0x2c0 drivers/tty/tty_buffer.c:321 tty_insert_flip_string include/linux/tty_flip.h:39 [inline] pty_write+0xe9/0x170 drivers/tty/pty.c:122 tty_put_char+0x115/0x180 drivers/tty/tty_io.c:3174 do_output_char+0x583/0x940 drivers/tty/n_tty.c:485 process_output drivers/tty/n_tty.c:511 [inline] n_tty_write+0xe33/0x1310 drivers/tty/n_tty.c:2300 do_tty_write drivers/tty/tty_io.c:1038 [inline] file_tty_write+0x5c5/0x9a0 drivers/tty/tty_io.c:1110 call_write_iter include/linux/fs.h:2114 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xa39/0xc90 fs/read_write.c:605 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae 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 *** 6 locks held by syz-executor.5/572: #0: ffff8880934b3098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x21/0x70 drivers/tty/tty_ldisc.c:252 #1: ffff8880934b3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock drivers/tty/tty_io.c:961 [inline] #1: ffff8880934b3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: do_tty_write drivers/tty/tty_io.c:984 [inline] #1: ffff8880934b3130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write+0x271/0x9a0 drivers/tty/tty_io.c:1110 #2: ffff8880934b32e8 (&o_tty->termios_rwsem/1){++++}-{3:3}, at: n_tty_write+0x22c/0x1310 drivers/tty/n_tty.c:2271 #3: ffffc90001978378 (&ldata->output_lock){+.+.}-{3:3}, at: process_output drivers/tty/n_tty.c:508 [inline] #3: ffffc90001978378 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0xe1d/0x1310 drivers/tty/n_tty.c:2300 #4: ffff888018817158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xc5/0x170 drivers/tty/pty.c:120 #5: ffffffff8c5f3d40 (console_lock){+.+.}-{0:0}, at: vprintk_emit+0x201/0x2f0 kernel/printk/printk.c:2173 stack backtrace: CPU: 1 PID: 572 Comm: syz-executor.5 Not tainted 5.14.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105 print_circular_bug+0xb17/0xdc0 kernel/locking/lockdep.c:2009 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174 validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 console_lock_spinning_enable+0x52/0x60 kernel/printk/printk.c:1790 console_unlock+0x6f5/0xec0 kernel/printk/printk.c:2640 vprintk_emit+0x21a/0x2f0 kernel/printk/printk.c:2174 vprintk+0x30d/0x370 kernel/printk/printk_safe.c:392 printk+0xc0/0x108 kernel/printk/printk.c:2216 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x366/0x4b0 lib/fault-inject.c:146 should_failslab+0x5/0x20 mm/slab_common.c:1326 slab_pre_alloc_hook mm/slab.h:494 [inline] slab_alloc_node mm/slub.c:2877 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x89/0x390 mm/slub.c:4100 kmalloc include/linux/slab.h:596 [inline] tty_buffer_alloc drivers/tty/tty_buffer.c:177 [inline] __tty_buffer_request_room+0x1f0/0x540 drivers/tty/tty_buffer.c:275 tty_insert_flip_string_fixed_flag+0x92/0x2c0 drivers/tty/tty_buffer.c:321 tty_insert_flip_string include/linux/tty_flip.h:39 [inline] pty_write+0xe9/0x170 drivers/tty/pty.c:122 tty_put_char+0x115/0x180 drivers/tty/tty_io.c:3174 do_output_char+0x583/0x940 drivers/tty/n_tty.c:485 process_output drivers/tty/n_tty.c:511 [inline] n_tty_write+0xe33/0x1310 drivers/tty/n_tty.c:2300 do_tty_write drivers/tty/tty_io.c:1038 [inline] file_tty_write+0x5c5/0x9a0 drivers/tty/tty_io.c:1110 call_write_iter include/linux/fs.h:2114 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xa39/0xc90 fs/read_write.c:605 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665e9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f85e8459188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 00000000fffffedf RSI: 0000000020000000 RDI: 0000000000000004 RBP: 00007f85e84591d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffadf3b4cf R14: 00007f85e8459300 R15: 0000000000022000