RBP: 00007f349ddac1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff0f8c77df R14: 00007f349ddac300 R15: 0000000000022000 ====================================================== WARNING: possible circular locking dependency detected 5.10.197 #1 Not tainted ------------------------------------------------------ syz-executor.1/17583 is trying to acquire lock: ffffffff84f0c800 (console_owner){-.-.}-{0:0}, at: console_unlock+0x2e1/0xb40 kernel/printk/printk.c:2507 but task is already holding lock: ffff88801aedf158 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x2b/0x160 drivers/tty/tty_buffer.c:575 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&port->lock){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x36/0x60 kernel/locking/spinlock.c:159 tty_port_tty_get+0x1f/0x100 drivers/tty/tty_port.c:289 tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:48 serial8250_tx_chars+0x51f/0xb00 drivers/tty/serial/8250/8250_port.c:1832 serial8250_handle_irq+0x4d6/0x650 drivers/tty/serial/8250/8250_port.c:1925 serial8250_default_handle_irq+0x96/0x210 drivers/tty/serial/8250/8250_port.c:1941 serial8250_interrupt+0xf4/0x1b0 drivers/tty/serial/8250/8250_core.c:127 __handle_irq_event_percpu+0x2ef/0x6d0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0xff/0x280 kernel/irq/handle.c:213 handle_edge_irq+0x249/0xd00 kernel/irq/chip.c:822 asm_call_irq_on_stack+0x12/0x20 __run_irq_on_irqstack arch/x86/include/asm/irq_stack.h:48 [inline] run_irq_on_irqstack_cond arch/x86/include/asm/irq_stack.h:101 [inline] handle_irq arch/x86/kernel/irq.c:230 [inline] __common_interrupt arch/x86/kernel/irq.c:249 [inline] common_interrupt+0xdd/0x1a0 arch/x86/kernel/irq.c:239 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:626 native_restore_fl arch/x86/include/asm/irqflags.h:41 [inline] arch_local_irq_restore arch/x86/include/asm/irqflags.h:84 [inline] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0x25/0x40 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:409 [inline] uart_write+0x304/0x580 drivers/tty/serial/serial_core.c:614 do_output_char+0x5e8/0x870 drivers/tty/n_tty.c:443 process_output drivers/tty/n_tty.c:510 [inline] n_tty_write+0x4c9/0xfe0 drivers/tty/n_tty.c:2396 do_tty_write drivers/tty/tty_io.c:1029 [inline] file_tty_write.constprop.0+0x529/0x910 drivers/tty/tty_io.c:1119 redirected_tty_write+0xa5/0xd0 drivers/tty/tty_io.c:1126 call_write_iter include/linux/fs.h:1919 [inline] do_iter_readv_writev+0x476/0x750 fs/read_write.c:740 do_iter_write+0x191/0x670 fs/read_write.c:866 vfs_writev+0x1ae/0x620 fs/read_write.c:939 do_writev+0x139/0x300 fs/read_write.c:982 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x62/0xc7 -> #1 (&port_lock_key){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x36/0x60 kernel/locking/spinlock.c:159 serial8250_console_write+0x9f5/0xc60 drivers/tty/serial/8250/8250_port.c:3328 call_console_drivers kernel/printk/printk.c:1911 [inline] console_unlock+0x82a/0xb40 kernel/printk/printk.c:2532 register_console kernel/printk/printk.c:2873 [inline] register_console+0x53d/0x800 kernel/printk/printk.c:2763 univ8250_console_init+0x3a/0x4a drivers/tty/serial/8250/8250_core.c:700 console_init+0x24c/0x356 kernel/printk/printk.c:2983 start_kernel+0x2e6/0x489 init/main.c:979 secondary_startup_64_no_verify+0xc2/0xcb -> #0 (console_owner){-.-.}-{0:0}: check_prev_add kernel/locking/lockdep.c:2988 [inline] check_prevs_add kernel/locking/lockdep.c:3113 [inline] validate_chain kernel/locking/lockdep.c:3728 [inline] __lock_acquire+0x29e7/0x5b00 kernel/locking/lockdep.c:4954 lock_acquire kernel/locking/lockdep.c:5565 [inline] lock_acquire+0x197/0x470 kernel/locking/lockdep.c:5530 console_lock_spinning_enable kernel/printk/printk.c:1763 [inline] console_unlock+0x360/0xb40 kernel/printk/printk.c:2529 vprintk_emit+0x1de/0x4d0 kernel/printk/printk.c:2054 vprintk_func+0x8b/0x140 kernel/printk/printk_safe.c:401 printk+0xba/0xf1 kernel/printk/printk.c:2102 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x47a/0x5a0 lib/fault-inject.c:146 should_failslab+0x5/0x20 mm/slab_common.c:1193 slab_pre_alloc_hook mm/slab.h:515 [inline] slab_alloc_node mm/slub.c:2821 [inline] slab_alloc mm/slub.c:2904 [inline] __kmalloc+0x72/0x390 mm/slub.c:3967 kmalloc include/linux/slab.h:557 [inline] tty_buffer_alloc+0x243/0x2b0 drivers/tty/tty_buffer.c:175 __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:274 tty_insert_flip_string_fixed_flag+0x91/0x250 drivers/tty/tty_buffer.c:319 tty_insert_flip_string include/linux/tty_flip.h:36 [inline] tty_insert_flip_string_and_push_buffer+0x3e/0x160 drivers/tty/tty_buffer.c:576 pty_write+0xe6/0x110 drivers/tty/pty.c:119 tty_put_char+0x12d/0x160 drivers/tty/tty_io.c:3126 __process_echoes+0x588/0xa00 drivers/tty/n_tty.c:725 process_echoes+0xf9/0x1c0 drivers/tty/n_tty.c:807 n_tty_set_termios+0x720/0x1010 drivers/tty/n_tty.c:1866 tty_set_termios+0x5f1/0x840 drivers/tty/tty_ioctl.c:342 set_termios.part.0+0x4f1/0x8a0 drivers/tty/tty_ioctl.c:431 set_termios drivers/tty/tty_ioctl.c:369 [inline] tty_mode_ioctl+0xd89/0xf10 drivers/tty/tty_ioctl.c:724 n_tty_ioctl_helper+0x55/0x3a0 drivers/tty/tty_ioctl.c:905 n_tty_ioctl+0x56/0x370 drivers/tty/n_tty.c:2517 tty_ioctl+0x912/0x18b0 drivers/tty/tty_io.c:2754 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x19a/0x210 fs/ioctl.c:739 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x62/0xc7 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 *** 7 locks held by syz-executor.1/17583: #0: ffff88805087e098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x22/0x90 drivers/tty/tty_ldisc.c:267 #1: ffff888050878130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock+0x1e/0x90 drivers/tty/tty_io.c:953 #2: ffff8880508782e8 (&o_tty->termios_rwsem/1){++++}-{3:3}, at: tty_set_termios+0xec/0x840 drivers/tty/tty_ioctl.c:329 #3: ffff888050878098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref+0x1d/0x90 drivers/tty/tty_ldisc.c:288 #4: ffffc90007041378 (&ldata->output_lock){+.+.}-{3:3}, at: process_echoes+0xaf/0x1c0 drivers/tty/n_tty.c:805 #5: ffff88801aedf158 (&port->lock){-.-.}-{2:2}, at: tty_insert_flip_string_and_push_buffer+0x2b/0x160 drivers/tty/tty_buffer.c:575 #6: ffffffff84fecb80 (console_lock){+.+.}-{0:0}, at: vprintk_func+0x8b/0x140 kernel/printk/printk_safe.c:401 stack backtrace: CPU: 1 PID: 17583 Comm: syz-executor.1 Not tainted 5.10.197 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x167 lib/dump_stack.c:118 check_noncircular+0x263/0x2e0 kernel/locking/lockdep.c:2123 check_prev_add kernel/locking/lockdep.c:2988 [inline] check_prevs_add kernel/locking/lockdep.c:3113 [inline] validate_chain kernel/locking/lockdep.c:3728 [inline] __lock_acquire+0x29e7/0x5b00 kernel/locking/lockdep.c:4954 lock_acquire kernel/locking/lockdep.c:5565 [inline] lock_acquire+0x197/0x470 kernel/locking/lockdep.c:5530 console_lock_spinning_enable kernel/printk/printk.c:1763 [inline] console_unlock+0x360/0xb40 kernel/printk/printk.c:2529 vprintk_emit+0x1de/0x4d0 kernel/printk/printk.c:2054 vprintk_func+0x8b/0x140 kernel/printk/printk_safe.c:401 printk+0xba/0xf1 kernel/printk/printk.c:2102 fail_dump lib/fault-inject.c:45 [inline] should_fail+0x47a/0x5a0 lib/fault-inject.c:146 should_failslab+0x5/0x20 mm/slab_common.c:1193 slab_pre_alloc_hook mm/slab.h:515 [inline] slab_alloc_node mm/slub.c:2821 [inline] slab_alloc mm/slub.c:2904 [inline] __kmalloc+0x72/0x390 mm/slub.c:3967 kmalloc include/linux/slab.h:557 [inline] tty_buffer_alloc+0x243/0x2b0 drivers/tty/tty_buffer.c:175 __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:274 tty_insert_flip_string_fixed_flag+0x91/0x250 drivers/tty/tty_buffer.c:319 tty_insert_flip_string include/linux/tty_flip.h:36 [inline] tty_insert_flip_string_and_push_buffer+0x3e/0x160 drivers/tty/tty_buffer.c:576 pty_write+0xe6/0x110 drivers/tty/pty.c:119 tty_put_char+0x12d/0x160 drivers/tty/tty_io.c:3126 __process_echoes+0x588/0xa00 drivers/tty/n_tty.c:725 process_echoes+0xf9/0x1c0 drivers/tty/n_tty.c:807 n_tty_set_termios+0x720/0x1010 drivers/tty/n_tty.c:1866 tty_set_termios+0x5f1/0x840 drivers/tty/tty_ioctl.c:342 set_termios.part.0+0x4f1/0x8a0 drivers/tty/tty_ioctl.c:431 set_termios drivers/tty/tty_ioctl.c:369 [inline] tty_mode_ioctl+0xd89/0xf10 drivers/tty/tty_ioctl.c:724 n_tty_ioctl_helper+0x55/0x3a0 drivers/tty/tty_ioctl.c:905 n_tty_ioctl+0x56/0x370 drivers/tty/n_tty.c:2517 tty_ioctl+0x912/0x18b0 drivers/tty/tty_io.c:2754 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x19a/0x210 fs/ioctl.c:739 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x62/0xc7 RIP: 0033:0x7f34a0836b19 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:00007f349ddac188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f34a0949f60 RCX: 00007f34a0836b19 RDX: 0000000020000440 RSI: 0000000000005403 RDI: 0000000000000003 RBP: 00007f349ddac1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fff0f8c77df R14: 00007f349ddac300 R15: 0000000000022000 EXT4-fs (loop6): mounted filesystem without journal. Opts: ,errors=continue ext4 filesystem being mounted at /syzkaller-testdir229989842/syzkaller.gMUcxl/188/file0 supports timestamps until 2038 (0x7fffffff) FAULT_INJECTION: forcing a failure. name fail_usercopy, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 17725 Comm: syz-executor.1 Not tainted 5.10.197 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x167 lib/dump_stack.c:118 fail_dump lib/fault-inject.c:52 [inline] should_fail.cold+0x5/0xa lib/fault-inject.c:146 _copy_from_user+0x2e/0x1b0 lib/usercopy.c:15 copy_from_user include/linux/uaccess.h:192 [inline] kstrtouint_from_user+0xbd/0x220 lib/kstrtox.c:409 proc_fail_nth_write+0x78/0x220 fs/proc/base.c:1398 vfs_write+0x29a/0xa70 fs/read_write.c:603 ksys_write+0x12d/0x260 fs/read_write.c:658 do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x62/0xc7 RIP: 0033:0x7f34a07e95ff Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 99 fd ff ff 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 cc fd ff ff 48 RSP: 002b:00007f349ddac170 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f34a07e95ff RDX: 0000000000000001 RSI: 00007f349ddac1e0 RDI: 0000000000000004 RBP: 00007f349ddac1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001 R13: 00007fff0f8c77df R14: 00007f349ddac300 R15: 0000000000022000