Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 ====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc3-next-20220422 #1 Not tainted ------------------------------------------------------ syz-executor.1/5874 is trying to acquire lock: ffffffff851166a0 (console_owner){-.-.}-{0:0}, at: vprintk_emit+0x316/0x550 but task is already holding lock: ffff888042d72158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xea/0x1e0 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+0x39/0x50 tty_port_tty_get+0x1f/0x100 tty_port_default_wakeup+0x11/0x40 serial8250_tx_chars+0x50b/0xa70 serial8250_handle_irq.part.0+0x3f1/0x4c0 serial8250_default_handle_irq+0xb8/0x230 serial8250_interrupt+0xf4/0x1a0 __handle_irq_event_percpu+0x20f/0x820 handle_irq_event+0xa7/0x1e0 handle_edge_irq+0x262/0xd10 __common_interrupt+0x92/0x1d0 common_interrupt+0x9f/0xc0 asm_common_interrupt+0x1e/0x40 _raw_spin_unlock_irqrestore+0x2e/0x50 uart_write+0x304/0x580 do_output_char+0x5e4/0x860 n_tty_write+0x4c9/0xfd0 file_tty_write.constprop.0+0x523/0x900 redirected_tty_write+0xa1/0xc0 do_iter_readv_writev+0x3d8/0x650 do_iter_write+0x187/0x6f0 vfs_writev+0x1aa/0x630 do_writev+0x133/0x2f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #1 (&port_lock_key){-.-.}-{2:2}: _raw_spin_lock_irqsave+0x39/0x50 serial8250_console_write+0x90e/0xb20 console_unlock+0x8c7/0xd40 register_console+0x378/0x7d0 univ8250_console_init+0x3a/0x46 console_init+0x3c1/0x58d start_kernel+0x301/0x4ee secondary_startup_64_no_verify+0xe0/0xeb -> #0 (console_owner){-.-.}-{0:0}: __lock_acquire+0x2c2f/0x6120 lock_acquire+0x1a2/0x530 vprintk_emit+0x353/0x550 vprintk+0x80/0x90 _printk+0xba/0xed should_fail+0x472/0x5a0 should_failslab+0x5/0x10 __kmalloc+0x72/0x440 tty_buffer_alloc+0x23f/0x2a0 __tty_buffer_request_room+0x156/0x2a0 tty_insert_flip_string_fixed_flag+0x91/0x240 pty_write+0x11c/0x1e0 n_tty_write+0x416/0xfd0 file_tty_write.constprop.0+0x523/0x900 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 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 *** 5 locks held by syz-executor.1/5874: #0: ffff8880438f0098 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x22/0x80 #1: ffff8880438f0130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write.constprop.0+0x299/0x900 #2: ffff8880438f02e8 (&o_tty->termios_rwsem/1){++++}-{3:3}, at: n_tty_write+0x1bf/0xfd0 #3: ffffc90013f09378 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0x542/0xfd0 #4: ffff888042d72158 (&port->lock){-.-.}-{2:2}, at: pty_write+0xea/0x1e0 stack backtrace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc+0x5b/0x480 create_object.isra.0+0x3a/0xa20 kmem_cache_alloc+0x239/0x480 security_file_alloc+0x34/0x170 __alloc_file+0xb6/0x230 alloc_empty_file+0x6d/0x170 path_openat+0xe1/0x2870 do_filp_open+0x1aa/0x400 do_sys_openat2+0x16d/0x4c0 __x64_sys_openat+0x13f/0x1f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8b19397b19 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:00007f8b1690d188 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f8b194aaf60 RCX: 00007f8b19397b19 RDX: 0000000000000000 RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f8b1690d1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffe019d0cf R14: 00007f8b1690d300 R15: 0000000000022000 CPU: 1 PID: 5874 Comm: syz-executor.1 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 check_noncircular+0x25f/0x2e0 __lock_acquire+0x2c2f/0x6120 lock_acquire+0x1a2/0x530 vprintk_emit+0x353/0x550 vprintk+0x80/0x90 _printk+0xba/0xed should_fail+0x472/0x5a0 should_failslab+0x5/0x10 __kmalloc+0x72/0x440 tty_buffer_alloc+0x23f/0x2a0 __tty_buffer_request_room+0x156/0x2a0 tty_insert_flip_string_fixed_flag+0x91/0x240 pty_write+0x11c/0x1e0 n_tty_write+0x416/0xfd0 file_tty_write.constprop.0+0x523/0x900 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ffbbf344b19 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:00007ffbbc8ba188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffbbf457f60 RCX: 00007ffbbf344b19 RDX: 00000000fffffecb RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007ffbbc8ba1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffe582e2edf R14: 00007ffbbc8ba300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 5874 Comm: syz-executor.1 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 __kmalloc+0x72/0x440 tty_buffer_alloc+0x23f/0x2a0 __tty_buffer_request_room+0x156/0x2a0 tty_insert_flip_string_fixed_flag+0x91/0x240 pty_write+0x11c/0x1e0 n_tty_write+0x416/0xfd0 file_tty_write.constprop.0+0x523/0x900 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ffbbf344b19 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:00007ffbbc8ba188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffbbf457f60 RCX: 00007ffbbf344b19 RDX: 00000000fffffecb RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007ffbbc8ba1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffe582e2edf R14: 00007ffbbc8ba300 R15: 0000000000022000 CPU: 0 PID: 5878 Comm: syz-executor.4 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc+0x5b/0x480 skb_clone+0x170/0x3c0 ip6_err_gen_icmpv6_unreach+0x130/0x7b0 ipip6_err+0x3a8/0x930 tunnel64_err+0x83/0x1d0 icmp_socket_deliver+0x1c2/0x360 icmp_unreach+0x338/0xad0 icmp_rcv+0x6bc/0x17b0 ip_protocol_deliver_rcu+0x960/0xb70 ip_local_deliver_finish+0x2ee/0x4c0 ip_local_deliver+0x1b3/0x200 ip_rcv+0x1b2/0x490 __netif_receive_skb_one_core+0x197/0x1e0 __netif_receive_skb+0x24/0x1b0 netif_receive_skb+0x12b/0x870 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 tun_rx_batched.isra.0+0x462/0x710 tun_get_user+0x2551/0x3a10 tun_chr_write_iter+0xdb/0x1e0 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f90606385ff 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:00007f905dbfb150 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f9060798f60 RCX: 00007f90606385ff RDX: 000000000000007e RSI: 0000000020000000 RDI: 00000000000000f0 RBP: 00007f905dbfb1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001 R13: 00007fffd228977f R14: 00007f905dbfb300 R15: 0000000000022000 CPU: 1 PID: 5884 Comm: syz-executor.5 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc_trace+0x55/0x3c0 tty_alloc_file+0x3d/0xa0 ptmx_open+0x5d/0x360 chrdev_open+0x268/0x6d0 do_dentry_open+0x49f/0x10b0 path_openat+0x1a11/0x2870 do_filp_open+0x1aa/0x400 do_sys_openat2+0x16d/0x4c0 __x64_sys_openat+0x13f/0x1f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8b19397b19 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:00007f8b1690d188 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f8b194aaf60 RCX: 00007f8b19397b19 RDX: 0000000000000000 RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f8b1690d1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffe019d0cf R14: 00007f8b1690d300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 5892 Comm: syz-executor.5 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc+0x5b/0x480 create_object.isra.0+0x3a/0xa20 kmem_cache_alloc_trace+0x22e/0x3c0 tty_alloc_file+0x3d/0xa0 ptmx_open+0x5d/0x360 chrdev_open+0x268/0x6d0 do_dentry_open+0x49f/0x10b0 path_openat+0x1a11/0x2870 do_filp_open+0x1aa/0x400 do_sys_openat2+0x16d/0x4c0 __x64_sys_openat+0x13f/0x1f0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f8b19397b19 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:00007f8b1690d188 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f8b194aaf60 RCX: 00007f8b19397b19 RDX: 0000000000000000 RSI: 0000000020000080 RDI: ffffffffffffff9c RBP: 00007f8b1690d1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007fffe019d0cf R14: 00007f8b1690d300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 5894 Comm: syz-executor.1 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc+0x5b/0x480 create_object.isra.0+0x3a/0xa20 __kmalloc+0x25b/0x440 tty_buffer_alloc+0x23f/0x2a0 __tty_buffer_request_room+0x156/0x2a0 tty_insert_flip_string_fixed_flag+0x91/0x240 pty_write+0x11c/0x1e0 n_tty_write+0x416/0xfd0 file_tty_write.constprop.0+0x523/0x900 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7ffbbf344b19 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:00007ffbbc8ba188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ffbbf457f60 RCX: 00007ffbbf344b19 RDX: 00000000fffffecb RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007ffbbc8ba1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffe582e2edf R14: 00007ffbbc8ba300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 0 PID: 5899 Comm: syz-executor.4 Not tainted 5.18.0-rc3-next-20220422 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x8b/0xb3 should_fail.cold+0x5/0xa should_failslab+0x5/0x10 kmem_cache_alloc+0x5b/0x480 create_object.isra.0+0x3a/0xa20 kmem_cache_alloc+0x239/0x480 skb_clone+0x170/0x3c0 ip6_err_gen_icmpv6_unreach+0x130/0x7b0 ipip6_err+0x3a8/0x930 tunnel64_err+0x83/0x1d0 icmp_socket_deliver+0x1c2/0x360 icmp_unreach+0x338/0xad0 icmp_rcv+0x6bc/0x17b0 ip_protocol_deliver_rcu+0x960/0xb70 ip_local_deliver_finish+0x2ee/0x4c0 ip_local_deliver+0x1b3/0x200 ip_rcv+0x1b2/0x490 __netif_receive_skb_one_core+0x197/0x1e0 __netif_receive_skb+0x24/0x1b0 netif_receive_skb+0x12b/0x870 tun_rx_batched.isra.0+0x462/0x710 tun_get_user+0x2551/0x3a10 tun_chr_write_iter+0xdb/0x1e0 new_sync_write+0x390/0x560 vfs_write+0x7b9/0xac0 ksys_write+0x127/0x250 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f90606385ff 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:00007f905dbfb150 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f9060798f60 RCX: 00007f90606385ff RDX: 000000000000007e RSI: 0000000020000000 RDI: 00000000000000f0 RBP: 00007f905dbfb1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000001 R13: 00007fffd228977f R14: 00007f905dbfb300 R15: 0000000000022000