====================================================== WARNING: possible circular locking dependency detected 4.14.292-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/9936 is trying to acquire lock: (&(&gsm->tx_lock)->rlock){-...}, at: [] gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490 but task is already holding lock: (&port_lock_key){-.-.}, at: [] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&port_lock_key){-.-.}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160 uart_write_room+0xd5/0x340 drivers/tty/serial/serial_core.c:643 tty_write_room+0x61/0x80 drivers/tty/tty_ioctl.c:78 gsmld_write+0x69/0x120 drivers/tty/n_gsm.c:2546 do_tty_write drivers/tty/tty_io.c:959 [inline] tty_write+0x410/0x740 drivers/tty/tty_io.c:1043 __vfs_write+0xe4/0x630 fs/read_write.c:480 __kernel_write+0xf5/0x330 fs/read_write.c:501 write_pipe_buf+0x143/0x1c0 fs/splice.c:797 splice_from_pipe_feed fs/splice.c:502 [inline] __splice_from_pipe+0x326/0x7a0 fs/splice.c:626 splice_from_pipe fs/splice.c:661 [inline] default_file_splice_write+0xc5/0x150 fs/splice.c:809 do_splice_from fs/splice.c:851 [inline] direct_splice_actor+0x115/0x160 fs/splice.c:1016 splice_direct_to_actor+0x25a/0x700 fs/splice.c:971 do_splice_direct+0x164/0x210 fs/splice.c:1059 do_sendfile+0x47f/0xb30 fs/read_write.c:1441 SYSC_sendfile64 fs/read_write.c:1502 [inline] SyS_sendfile64+0xff/0x110 fs/read_write.c:1488 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #0 (&(&gsm->tx_lock)->rlock){-...}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160 gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490 tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533 tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49 serial8250_tx_chars+0x3fe/0xc70 drivers/tty/serial/8250/8250_port.c:1828 serial8250_handle_irq.part.0+0x28d/0x330 drivers/tty/serial/8250/8250_port.c:1915 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1888 [inline] serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1931 serial8250_interrupt+0xf3/0x210 drivers/tty/serial/8250/8250_core.c:129 __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147 handle_irq_event_percpu kernel/irq/handle.c:187 [inline] handle_irq_event+0xed/0x240 kernel/irq/handle.c:204 handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230 ret_from_intr+0x0/0x1e kasan_alloc_pages+0x0/0x70 mm/kasan/kasan.c:305 post_alloc_hook mm/page_alloc.c:1774 [inline] prep_new_page mm/page_alloc.c:1784 [inline] get_page_from_freelist+0x16e9/0x25a0 mm/page_alloc.c:3176 __alloc_pages_nodemask+0x365/0x2720 mm/page_alloc.c:4185 alloc_pages_current+0x155/0x260 mm/mempolicy.c:2107 alloc_pages include/linux/gfp.h:520 [inline] __page_cache_alloc mm/filemap.c:871 [inline] pagecache_get_page+0x3f5/0xab0 mm/filemap.c:1501 grab_cache_page_write_begin+0x63/0x90 mm/filemap.c:3005 fuse_write_begin+0xea/0x5e0 fs/fuse/file.c:1974 generic_perform_write+0x1c9/0x420 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 fuse_file_write_iter+0x4ff/0x8d0 fs/fuse/file.c:1202 call_write_iter include/linux/fs.h:1780 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x44c/0x630 fs/read_write.c:482 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&port_lock_key); lock(&(&gsm->tx_lock)->rlock); lock(&port_lock_key); lock(&(&gsm->tx_lock)->rlock); *** DEADLOCK *** 6 locks held by syz-executor.1/9936: #0: (&f->f_pos_lock){+.+.}, at: [] __fdget_pos+0x1fb/0x2b0 fs/file.c:819 #1: (sb_writers#14){.+.+}, at: [] file_start_write include/linux/fs.h:2714 [inline] #1: (sb_writers#14){.+.+}, at: [] vfs_write+0x3d8/0x4d0 fs/read_write.c:543 #2: (&sb->s_type->i_mutex_key#22){+.+.}, at: [] inode_lock include/linux/fs.h:719 [inline] #2: (&sb->s_type->i_mutex_key#22){+.+.}, at: [] generic_file_write_iter+0x99/0x650 mm/filemap.c:3205 #3: (&(&i->lock)->rlock){-.-.}, at: [] spin_lock include/linux/spinlock.h:317 [inline] #3: (&(&i->lock)->rlock){-.-.}, at: [] serial8250_interrupt+0x3a/0x210 drivers/tty/serial/8250/8250_core.c:119 #4: (&port_lock_key){-.-.}, at: [] serial8250_handle_irq.part.0+0x20/0x330 drivers/tty/serial/8250/8250_port.c:1891 #5: (&tty->ldisc_sem){++++}, at: [] tty_ldisc_ref+0x1b/0x80 drivers/tty/tty_ldisc.c:305 stack backtrace: CPU: 1 PID: 9936 Comm: syz-executor.1 Not tainted 4.14.292-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:160 gsmld_write_wakeup+0x4e/0xd0 drivers/tty/n_gsm.c:2490 tty_wakeup+0xc3/0xf0 drivers/tty/tty_io.c:533 tty_port_default_wakeup+0x26/0x40 drivers/tty/tty_port.c:49 serial8250_tx_chars+0x3fe/0xc70 drivers/tty/serial/8250/8250_port.c:1828 serial8250_handle_irq.part.0+0x28d/0x330 drivers/tty/serial/8250/8250_port.c:1915 serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1888 [inline] serial8250_default_handle_irq+0x8a/0x1f0 drivers/tty/serial/8250/8250_port.c:1931 serial8250_interrupt+0xf3/0x210 drivers/tty/serial/8250/8250_core.c:129 __handle_irq_event_percpu+0xee/0x7f0 kernel/irq/handle.c:147 handle_irq_event_percpu kernel/irq/handle.c:187 [inline] handle_irq_event+0xed/0x240 kernel/irq/handle.c:204 handle_edge_irq+0x224/0xc40 kernel/irq/chip.c:770 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230 common_interrupt+0x93/0x93 arch/x86/entry/entry_64.S:576 RIP: 0010:lowmem_page_address include/linux/mm.h:1097 [inline] RIP: 0010:kasan_alloc_pages+0x0/0x70 mm/kasan/kasan.c:311 RSP: 0018:ffff88806cf676f8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffc8 RAX: 0000000000000000 RBX: 00fff00000000000 RCX: 00000000000ff000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffea0001b86400 RBP: 0000000000000000 R08: 0000000000001000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffea0001b86400 R13: dffffc0000000000 R14: ffff88813fffb6c0 R15: ffffea0001b86400 post_alloc_hook mm/page_alloc.c:1774 [inline] prep_new_page mm/page_alloc.c:1784 [inline] get_page_from_freelist+0x16e9/0x25a0 mm/page_alloc.c:3176 __alloc_pages_nodemask+0x365/0x2720 mm/page_alloc.c:4185 alloc_pages_current+0x155/0x260 mm/mempolicy.c:2107 alloc_pages include/linux/gfp.h:520 [inline] __page_cache_alloc mm/filemap.c:871 [inline] pagecache_get_page+0x3f5/0xab0 mm/filemap.c:1501 grab_cache_page_write_begin+0x63/0x90 mm/filemap.c:3005 fuse_write_begin+0xea/0x5e0 fs/fuse/file.c:1974 generic_perform_write+0x1c9/0x420 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 fuse_file_write_iter+0x4ff/0x8d0 fs/fuse/file.c:1202 call_write_iter include/linux/fs.h:1780 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x44c/0x630 fs/read_write.c:482 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x7f8276243279 RSP: 002b:00007f8274bb8168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f8276355f80 RCX: 00007f8276243279 RDX: 00000000fffffdef RSI: 00000000200000c0 RDI: 0000000000000006 RBP: 00007f827629d2e9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff1334ceef R14: 00007f8274bb8300 R15: 0000000000022000 Process accounting resumed Process accounting resumed 9pnet: p9_fd_create_tcp (10171): problem connecting socket to 127.0.0.1 Process accounting resumed 9pnet: p9_fd_create_tcp (10331): problem connecting socket to 127.0.0.1 Process accounting resumed 9pnet: p9_fd_create_tcp (10407): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (10646): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (10652): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (10656): problem connecting socket to 127.0.0.1 audit: type=1800 audit(1662463517.362:2): pid=10676 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14003 res=0 audit: type=1804 audit(1662463517.362:3): pid=10676 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2103891825/syzkaller.w1sshk/29/file0" dev="sda1" ino=14003 res=1 Process accounting resumed audit: type=1800 audit(1662463518.202:4): pid=10782 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14003 res=0 audit: type=1804 audit(1662463518.202:5): pid=10782 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2103891825/syzkaller.w1sshk/30/file0" dev="sda1" ino=14003 res=1 Process accounting resumed Process accounting resumed Process accounting resumed 9pnet: p9_fd_create_tcp (10865): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (10868): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (10870): problem connecting socket to 127.0.0.1 audit: type=1800 audit(1662463519.112:6): pid=10932 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14008 res=0 audit: type=1804 audit(1662463519.112:7): pid=10932 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2103891825/syzkaller.w1sshk/31/file0" dev="sda1" ino=14008 res=1 Process accounting resumed Process accounting resumed Process accounting resumed Process accounting resumed Process accounting resumed 9pnet: p9_fd_create_tcp (11044): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (11048): problem connecting socket to 127.0.0.1 9pnet: p9_fd_create_tcp (11046): problem connecting socket to 127.0.0.1 audit: type=1800 audit(1662463519.992:8): pid=11053 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14008 res=0 audit: type=1804 audit(1662463520.002:9): pid=11053 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2103891825/syzkaller.w1sshk/32/file0" dev="sda1" ino=14008 res=1 audit: type=1800 audit(1662463520.612:10): pid=11143 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="file0" dev="sda1" ino=14011 res=0 audit: type=1804 audit(1662463520.622:11): pid=11143 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir285867724/syzkaller.QHz99i/19/file0" dev="sda1" ino=14011 res=1 Process accounting resumed Process accounting resumed Process accounting resumed Process accounting resumed Process accounting resumed