RBP: 00007f0e8c4e01d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffe6ecafef R14: 00007f0e8c4e0300 R15: 0000000000022000 ====================================================== WARNING: possible circular locking dependency detected 4.19.204-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/30320 is trying to acquire lock: 0000000046f053d4 (console_owner){....}, at: console_trylock_spinning kernel/printk/printk.c:1697 [inline] 0000000046f053d4 (console_owner){....}, at: vprintk_emit+0x3fe/0x740 kernel/printk/printk.c:1964 but task is already holding lock: 0000000056674708 (&(&port->lock)->rlock){-.-.}, at: pty_write+0xf4/0x1f0 drivers/tty/pty.c:120 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&(&port->lock)->rlock){-.-.}: tty_port_tty_get+0x1d/0x80 drivers/tty/tty_port.c:289 tty_port_default_wakeup+0x11/0x40 drivers/tty/tty_port.c:47 serial8250_tx_chars+0x490/0xaf0 drivers/tty/serial/8250/8250_port.c:1812 serial8250_handle_irq.part.0+0x31f/0x3d0 drivers/tty/serial/8250/8250_port.c:1899 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1872 [inline] serial8250_default_handle_irq+0xae/0x220 drivers/tty/serial/8250/8250_port.c:1915 serial8250_interrupt+0x101/0x240 drivers/tty/serial/8250/8250_core.c:125 __handle_irq_event_percpu+0x27e/0x8e0 kernel/irq/handle.c:149 handle_irq_event_percpu kernel/irq/handle.c:189 [inline] handle_irq_event+0x102/0x290 kernel/irq/handle.c:206 handle_edge_irq+0x260/0xcf0 kernel/irq/chip.c:797 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1c0 arch/x86/kernel/irq.c:246 ret_from_intr+0x0/0x1e native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:60 arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x49/0x310 arch/x86/kernel/process.c:557 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x2ec/0x4b0 kernel/sched/idle.c:263 cpu_startup_entry+0xc5/0xe0 kernel/sched/idle.c:369 start_secondary+0x435/0x5c0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #1 (&port_lock_key){-.-.}: serial8250_console_write+0x90e/0xb70 drivers/tty/serial/8250/8250_port.c:3289 call_console_drivers kernel/printk/printk.c:1764 [inline] console_unlock+0xbb6/0x1110 kernel/printk/printk.c:2460 vprintk_emit+0x2d1/0x740 kernel/printk/printk.c:1965 vprintk_func+0x79/0x180 kernel/printk/printk_safe.c:405 printk+0xba/0xed kernel/printk/printk.c:2040 register_console+0x87f/0xc90 kernel/printk/printk.c:2776 univ8250_console_init+0x3a/0x46 drivers/tty/serial/8250/8250_core.c:684 console_init+0x4cb/0x718 kernel/printk/printk.c:2862 start_kernel+0x686/0x911 init/main.c:659 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 -> #0 (console_owner){....}: console_trylock_spinning kernel/printk/printk.c:1718 [inline] vprintk_emit+0x43b/0x740 kernel/printk/printk.c:1964 vprintk_func+0x79/0x180 kernel/printk/printk_safe.c:405 printk+0xba/0xed kernel/printk/printk.c:2040 fail_dump lib/fault-inject.c:44 [inline] should_fail+0x66b/0x7b0 lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x6d/0x3c0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] tty_buffer_alloc+0x23f/0x2a0 drivers/tty/tty_buffer.c:170 __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:268 tty_insert_flip_string_fixed_flag+0x93/0x250 drivers/tty/tty_buffer.c:313 tty_insert_flip_string include/linux/tty_flip.h:37 [inline] pty_write+0x126/0x1f0 drivers/tty/pty.c:122 tty_send_xchar+0x28d/0x3b0 drivers/tty/tty_io.c:1093 n_tty_ioctl_helper+0x18d/0x3a0 drivers/tty/tty_ioctl.c:927 n_tty_ioctl+0x56/0x360 drivers/tty/n_tty.c:2464 tty_ioctl+0x65d/0x15c0 drivers/tty/tty_io.c:2678 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: console_owner --> &port_lock_key --> &(&port->lock)->rlock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&(&port->lock)->rlock); lock(&port_lock_key); lock(&(&port->lock)->rlock); lock(console_owner); *** DEADLOCK *** 4 locks held by syz-executor.1/30320: #0: 00000000fa89bf8e (&tty->ldisc_sem){++++}, at: tty_ldisc_ref_wait+0x22/0x80 drivers/tty/tty_ldisc.c:272 #1: 000000007f55b834 (&tty->atomic_write_lock){+.+.}, at: tty_write_lock drivers/tty/tty_io.c:886 [inline] #1: 000000007f55b834 (&tty->atomic_write_lock){+.+.}, at: tty_send_xchar+0x1d9/0x3b0 drivers/tty/tty_io.c:1087 #2: 00000000c677effd (&tty->termios_rwsem){++++}, at: tty_send_xchar+0x226/0x3b0 drivers/tty/tty_io.c:1090 #3: 0000000056674708 (&(&port->lock)->rlock){-.-.}, at: pty_write+0xf4/0x1f0 drivers/tty/pty.c:120 stack backtrace: CPU: 0 PID: 30320 Comm: syz-executor.1 Not tainted 4.19.204-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 console_trylock_spinning kernel/printk/printk.c:1718 [inline] vprintk_emit+0x43b/0x740 kernel/printk/printk.c:1964 vprintk_func+0x79/0x180 kernel/printk/printk_safe.c:405 printk+0xba/0xed kernel/printk/printk.c:2040 fail_dump lib/fault-inject.c:44 [inline] should_fail+0x66b/0x7b0 lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x6d/0x3c0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] tty_buffer_alloc+0x23f/0x2a0 drivers/tty/tty_buffer.c:170 __tty_buffer_request_room+0x156/0x2a0 drivers/tty/tty_buffer.c:268 tty_insert_flip_string_fixed_flag+0x93/0x250 drivers/tty/tty_buffer.c:313 tty_insert_flip_string include/linux/tty_flip.h:37 [inline] pty_write+0x126/0x1f0 drivers/tty/pty.c:122 tty_send_xchar+0x28d/0x3b0 drivers/tty/tty_io.c:1093 n_tty_ioctl_helper+0x18d/0x3a0 drivers/tty/tty_ioctl.c:927 n_tty_ioctl+0x56/0x360 drivers/tty/n_tty.c:2464 tty_ioctl+0x65d/0x15c0 drivers/tty/tty_io.c:2678 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe 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:00007f0e8c4e0188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 0000000000000002 RSI: 000000000000540a RDI: 0000000000000003 RBP: 00007f0e8c4e01d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffe6ecafef R14: 00007f0e8c4e0300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 30344 Comm: syz-executor.3 Not tainted 4.19.204-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold+0xa/0xf lib/fault-inject.c:149 __should_failslab+0x115/0x180 mm/failslab.c:32 should_failslab+0x5/0x10 mm/slab_common.c:1590 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] kmem_cache_alloc+0x277/0x370 mm/slab.c:3557 ptlock_alloc+0x1d/0x70 mm/memory.c:4969 ptlock_init include/linux/mm.h:1900 [inline] pgtable_page_ctor include/linux/mm.h:1934 [inline] pte_alloc_one+0x68/0x190 arch/x86/mm/pgtable.c:38 do_huge_pmd_anonymous_page+0x649/0x1e60 mm/huge_memory.c:701 create_huge_pmd mm/memory.c:4066 [inline] __handle_mm_fault+0x289c/0x41c0 mm/memory.c:4270 handle_mm_fault+0x436/0xb10 mm/memory.c:4336 __do_page_fault+0x68e/0xd60 arch/x86/mm/fault.c:1412 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1205 RIP: 0010:copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:66 Code: 4c 8b 5e 38 4c 89 47 20 4c 89 4f 28 4c 89 57 30 4c 89 5f 38 48 8d 76 40 48 8d 7f 40 ff c9 75 b6 89 d1 83 e2 07 c1 e9 03 74 12 <4c> 8b 06 4c 89 07 48 8d 76 08 48 8d 7f 08 ff c9 75 ee 21 d2 74 10 RSP: 0018:ffff8880923efba0 EFLAGS: 00010202 RAX: ffffed101247df8a RBX: 0000000000000008 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000c04a01 RDI: ffff8880923efc48 RBP: 0000000000c04a01 R08: 0000000000000001 R09: ffffed101247df89 R10: ffff8880923efc4f R11: 0000000000000000 R12: 0000000000c04a09 R13: ffff8880923efc48 R14: 00007ffffffff000 R15: 0000000000000000 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_from_user arch/x86/include/asm/uaccess_64.h:71 [inline] _copy_from_user+0xfc/0x130 lib/usercopy.c:13 copy_from_user include/linux/uaccess.h:147 [inline] tiocswinsz drivers/tty/tty_io.c:2271 [inline] tty_ioctl+0x1091/0x15c0 drivers/tty/tty_io.c:2584 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe 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:00007fa26c585188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 0000000000c04a01 RSI: 0000000000005414 RDI: 0000000000000003 RBP: 00007fa26c5851d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffd328ccb0f R14: 00007fa26c585300 R15: 0000000000022000 [U] ^@ ---------------- Code disassembly (best guess): 0: 4c 8b 5e 38 mov 0x38(%rsi),%r11 4: 4c 89 47 20 mov %r8,0x20(%rdi) 8: 4c 89 4f 28 mov %r9,0x28(%rdi) c: 4c 89 57 30 mov %r10,0x30(%rdi) 10: 4c 89 5f 38 mov %r11,0x38(%rdi) 14: 48 8d 76 40 lea 0x40(%rsi),%rsi 18: 48 8d 7f 40 lea 0x40(%rdi),%rdi 1c: ff c9 dec %ecx 1e: 75 b6 jne 0xffffffd6 20: 89 d1 mov %edx,%ecx 22: 83 e2 07 and $0x7,%edx 25: c1 e9 03 shr $0x3,%ecx 28: 74 12 je 0x3c * 2a: 4c 8b 06 mov (%rsi),%r8 <-- trapping instruction 2d: 4c 89 07 mov %r8,(%rdi) 30: 48 8d 76 08 lea 0x8(%rsi),%rsi 34: 48 8d 7f 08 lea 0x8(%rdi),%rdi 38: ff c9 dec %ecx 3a: 75 ee jne 0x2a 3c: 21 d2 and %edx,%edx 3e: 74 10 je 0x50