loop0: partition table beyond EOD, truncated
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
ttyprintk ttyprintk: tty_port_close_start: tty->count = 1 port count = 2
loop_reread_partitions: partition scan of loop0 () failed (rc=-5)
======================================================
WARNING: possible circular locking dependency detected
4.19.179-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/32433 is trying to acquire lock:
0000000041322ed4 (console_owner){-.-.}, at: console_trylock_spinning kernel/printk/printk.c:1697 [inline]
0000000041322ed4 (console_owner){-.-.}, at: vprintk_emit+0x3fe/0x740 kernel/printk/printk.c:1964

but task is already holding lock:
000000001c486ebb (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x28/0x540 drivers/tty/tty_port.c:574

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:1806
       serial8250_handle_irq.part.0+0x31f/0x3d0 drivers/tty/serial/8250/8250_port.c:1893
       serial8250_handle_irq drivers/tty/serial/8250/8250_port.c:1866 [inline]
       serial8250_default_handle_irq+0xae/0x220 drivers/tty/serial/8250/8250_port.c:1909
       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
       arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline]
       __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
       _raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:184
       spin_unlock_irqrestore include/linux/spinlock.h:384 [inline]
       uart_write+0x3bb/0x6f0 drivers/tty/serial/serial_core.c:612
       do_output_char+0x5de/0x850 drivers/tty/n_tty.c:445
       process_output drivers/tty/n_tty.c:512 [inline]
       n_tty_write+0x46e/0xff0 drivers/tty/n_tty.c:2343
       do_tty_write drivers/tty/tty_io.c:960 [inline]
       tty_write+0x496/0x810 drivers/tty/tty_io.c:1044
       redirected_tty_write+0xaa/0xb0 drivers/tty/tty_io.c:1065
       do_loop_readv_writev fs/read_write.c:704 [inline]
       do_loop_readv_writev fs/read_write.c:688 [inline]
       do_iter_write+0x461/0x5d0 fs/read_write.c:962
       vfs_writev+0x153/0x2e0 fs/read_write.c:1005
       do_writev+0x136/0x330 fs/read_write.c:1040
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&port_lock_key){-.-.}:
       serial8250_console_write+0x89b/0xad0 drivers/tty/serial/8250/8250_port.c:3270
       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
       tty_port_close_start.part.0+0x4f3/0x540 drivers/tty/tty_port.c:576
       tty_port_close_start drivers/tty/tty_port.c:648 [inline]
       tty_port_close+0x46/0x160 drivers/tty/tty_port.c:641
       tty_release+0x45e/0x1210 drivers/tty/tty_io.c:1678
       __fput+0x2ce/0x890 fs/file_table.c:278
       task_work_run+0x148/0x1c0 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:193 [inline]
       exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
       prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
       do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
       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 ***

2 locks held by syz-executor.4/32433:
 #0: 000000001fdfbe1d (&tty->legacy_mutex){+.+.}, at: tty_lock+0x6a/0xa0 drivers/tty/tty_mutex.c:19
 #1: 000000001c486ebb (&(&port->lock)->rlock){-.-.}, at: tty_port_close_start.part.0+0x28/0x540 drivers/tty/tty_port.c:574

stack backtrace:
CPU: 0 PID: 32433 Comm: syz-executor.4 Not tainted 4.19.179-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:1221
 check_prev_add kernel/locking/lockdep.c:1865 [inline]
 check_prevs_add kernel/locking/lockdep.c:1978 [inline]
 validate_chain kernel/locking/lockdep.c:2419 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3415
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3907
 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
 tty_port_close_start.part.0+0x4f3/0x540 drivers/tty/tty_port.c:576
 tty_port_close_start drivers/tty/tty_port.c:648 [inline]
 tty_port_close+0x46/0x160 drivers/tty/tty_port.c:641
 tty_release+0x45e/0x1210 drivers/tty/tty_io.c:1678
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x41927b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007fff6cd41ee0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 000000000041927b
RDX: 0000000000570120 RSI: 0000000000000081 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000570120
R13: 00007fff6cd42000 R14: 000000000056bf60 R15: 00000000000893fe
audit: type=1804 audit(1615156986.577:333): pid=32438 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/338/file0/file0" dev="sda1" ino=15878 res=1
audit: type=1804 audit(1615156986.577:334): pid=32438 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/338/file0/file0" dev="sda1" ino=15878 res=1
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
FAT-fs (loop5): bogus number of FAT sectors
Bluetooth: hci5: command 0x0419 tx timeout
FAT-fs (loop5): Can't find a valid FAT filesystem
audit: type=1804 audit(1615156987.377:335): pid=32458 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/339/file0/file0" dev="sda1" ino=15964 res=1
FAT-fs (loop5): bogus number of FAT sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
audit: type=1804 audit(1615156987.377:336): pid=32458 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/339/file0/file0" dev="sda1" ino=15964 res=1
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
audit: type=1804 audit(1615156987.537:337): pid=32485 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/340/file0/file0" dev="sda1" ino=15966 res=1
audit: type=1804 audit(1615156987.567:338): pid=32485 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/340/file0/file0" dev="sda1" ino=15966 res=1
FAT-fs (loop5): bogus number of FAT sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
audit: type=1804 audit(1615156987.786:339): pid=32516 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/341/file0/file0" dev="sda1" ino=15991 res=1
FAT-fs (loop5): bogus number of FAT sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
audit: type=1804 audit(1615156987.816:340): pid=32516 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/341/file0/file0" dev="sda1" ino=15991 res=1
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
FAT-fs (loop5): bogus number of FAT sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
ieee802154 phy0 wpan0: encryption failed: -22
ieee802154 phy1 wpan1: encryption failed: -22
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
Cannot find set identified by id 0 to match
EXT4-fs error (device loop1): ext4_fill_super:4446: inode #2: comm syz-executor.1: iget: root inode unallocated
Cannot find set identified by id 0 to match
EXT4-fs (loop1): get root inode failed
EXT4-fs (loop1): mount failed
Cannot find set identified by id 0 to match
Cannot find set identified by id 0 to match
EXT4-fs error (device loop1): ext4_fill_super:4446: inode #2: comm syz-executor.1: iget: root inode unallocated
EXT4-fs (loop1): get root inode failed
EXT4-fs (loop1): mount failed
EXT4-fs error (device loop1): ext4_fill_super:4446: inode #2: comm syz-executor.1: iget: root inode unallocated
EXT4-fs (loop1): get root inode failed
EXT4-fs (loop1): mount failed
EXT4-fs (loop1): unsupported inode size: 0
EXT4-fs (loop1): blocksize: 4096
FAT-fs (loop5): bogus number of reserved sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
EXT4-fs (loop1): unsupported inode size: 0
EXT4-fs (loop1): blocksize: 4096
EXT4-fs (loop1): unsupported inode size: 0
EXT4-fs (loop1): blocksize: 4096
FAT-fs (loop5): bogus number of reserved sectors
FAT-fs (loop5): Can't find a valid FAT filesystem
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
kauditd_printk_skb: 20 callbacks suppressed
audit: type=1804 audit(1615156991.345:361): pid=438 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/352/file0/file0" dev="loop1" ino=17 res=1
audit: type=1804 audit(1615156991.375:362): pid=438 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/352/file0/file0" dev="loop1" ino=17 res=1
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1615156991.605:363): pid=481 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/353/file0/file0" dev="loop1" ino=17 res=1
audit: type=1804 audit(1615156991.635:364): pid=481 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/353/file0/file0" dev="loop1" ino=17 res=1
FAT-fs (loop5): bogus number of reserved sectors
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
FAT-fs (loop5): Can't find a valid FAT filesystem
audit: type=1804 audit(1615156991.935:365): pid=530 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/354/file0/file0" dev="loop1" ino=17 res=1
audit: type=1804 audit(1615156991.975:366): pid=530 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/354/file0/file0" dev="loop1" ino=17 res=1
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.4'.
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
netlink: 20 bytes leftover after parsing attributes in process `syz-executor.4'.
audit: type=1804 audit(1615156992.225:367): pid=565 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/355/file0/file0" dev="loop1" ino=17 res=1
audit: type=1804 audit(1615156992.255:368): pid=565 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/355/file0/file0" dev="loop1" ino=17 res=1
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
audit: type=1804 audit(1615156992.435:369): pid=599 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/356/file0/file0" dev="loop1" ino=17 res=1
audit: type=1804 audit(1615156992.485:370): pid=599 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.1" name="/root/syzkaller-testdir239625201/syzkaller.weB4ME/356/file0/file0" dev="loop1" ino=17 res=1
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'.
EXT4-fs warning (device sda1): ext4_resize_begin:72: There are errors in the filesystem, so online resizing is not allowed
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
EXT4-fs warning (device sda1): ext4_resize_begin:72: There are errors in the filesystem, so online resizing is not allowed
EXT4-fs (loop1): VFS: Can't find ext4 filesystem
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
ptrace attach of "/root/syz-executor.5"[957] was attempted by "/root/syz-executor.5"[958]
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue