print_req_error: I/O error, dev loop2, sector 0 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) ====================================================== WARNING: possible circular locking dependency detected 4.14.182-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/25477 is trying to acquire lock: ("dio/%s"sb->s_id){+.+.}, at: [] flush_workqueue+0xda/0x1380 kernel/workqueue.c:2621 but task is already holding lock: (&sb->s_type->i_mutex_key#23){++++}, at: [] inode_lock include/linux/fs.h:719 [inline] (&sb->s_type->i_mutex_key#23){++++}, at: [] generic_file_write_iter+0x99/0x650 mm/filemap.c:3197 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&sb->s_type->i_mutex_key#23){++++}: down_write+0x34/0x90 kernel/locking/rwsem.c:54 inode_lock include/linux/fs.h:719 [inline] __generic_file_fsync+0x9e/0x190 fs/libfs.c:987 fat_file_fsync+0x73/0x1f0 fs/fat/file.c:165 vfs_fsync_range+0x103/0x250 fs/sync.c:196 generic_write_sync include/linux/fs.h:2678 [inline] dio_complete+0x3ae/0x840 fs/direct-io.c:330 process_one_work+0x7c0/0x14c0 kernel/workqueue.c:2116 worker_thread+0x5d7/0x1080 kernel/workqueue.c:2250 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 -> #1 ((&dio->complete_work)){+.+.}: process_one_work+0x762/0x14c0 kernel/workqueue.c:2092 worker_thread+0x5d7/0x1080 kernel/workqueue.c:2250 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 -> #0 ("dio/%s"sb->s_id){+.+.}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 flush_workqueue+0x109/0x1380 kernel/workqueue.c:2624 drain_workqueue+0x177/0x3e0 kernel/workqueue.c:2789 destroy_workqueue+0x71/0x660 kernel/workqueue.c:4102 __alloc_workqueue_key+0xb65/0xdc0 kernel/workqueue.c:4079 sb_init_dio_done_wq+0x34/0x80 fs/direct-io.c:624 do_blockdev_direct_IO fs/direct-io.c:1286 [inline] __blockdev_direct_IO+0x2f6f/0xe97c fs/direct-io.c:1422 blockdev_direct_IO include/linux/fs.h:2988 [inline] fat_direct_IO+0x19b/0x2b0 fs/fat/inode.c:275 generic_file_direct_write+0x1df/0x420 mm/filemap.c:2950 __generic_file_write_iter+0x2a5/0x590 mm/filemap.c:3129 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3200 call_write_iter include/linux/fs.h:1778 [inline] aio_write+0x2ba/0x4f0 fs/aio.c:1553 io_submit_one fs/aio.c:1641 [inline] do_io_submit+0x930/0x1400 fs/aio.c:1709 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: Chain exists of: "dio/%s"sb->s_id --> (&dio->complete_work) --> &sb->s_type->i_mutex_key#23 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#23); lock((&dio->complete_work)); lock(&sb->s_type->i_mutex_key#23); lock("dio/%s"sb->s_id); *** DEADLOCK *** 2 locks held by syz-executor.4/25477: #0: (sb_writers#21){.+.+}, at: [] file_start_write include/linux/fs.h:2708 [inline] #0: (sb_writers#21){.+.+}, at: [] aio_write+0x3dc/0x4f0 fs/aio.c:1552 #1: (&sb->s_type->i_mutex_key#23){++++}, at: [] inode_lock include/linux/fs.h:719 [inline] #1: (&sb->s_type->i_mutex_key#23){++++}, at: [] generic_file_write_iter+0x99/0x650 mm/filemap.c:3197 stack backtrace: CPU: 0 PID: 25477 Comm: syz-executor.4 Not tainted 4.14.182-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x283 lib/dump_stack.c:58 print_circular_bug.isra.0.cold+0x2dc/0x425 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+0x3057/0x42a0 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 flush_workqueue+0x109/0x1380 kernel/workqueue.c:2624 drain_workqueue+0x177/0x3e0 kernel/workqueue.c:2789 destroy_workqueue+0x71/0x660 kernel/workqueue.c:4102 __alloc_workqueue_key+0xb65/0xdc0 kernel/workqueue.c:4079 sb_init_dio_done_wq+0x34/0x80 fs/direct-io.c:624 do_blockdev_direct_IO fs/direct-io.c:1286 [inline] __blockdev_direct_IO+0x2f6f/0xe97c fs/direct-io.c:1422 blockdev_direct_IO include/linux/fs.h:2988 [inline] fat_direct_IO+0x19b/0x2b0 fs/fat/inode.c:275 generic_file_direct_write+0x1df/0x420 mm/filemap.c:2950 __generic_file_write_iter+0x2a5/0x590 mm/filemap.c:3129 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3200 call_write_iter include/linux/fs.h:1778 [inline] aio_write+0x2ba/0x4f0 fs/aio.c:1553 io_submit_one fs/aio.c:1641 [inline] do_io_submit+0x930/0x1400 fs/aio.c:1709 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x45ca69 RSP: 002b:00007f4df90edc78 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1 RAX: ffffffffffffffda RBX: 00000000004e0d40 RCX: 000000000045ca69 RDX: 0000000020000540 RSI: 0000000000000006 RDI: 00007f4df90ef000 RBP: 000000000078bfa0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000007 R13: 00000000000001fb R14: 00000000004c4486 R15: 00007f4df90ee6d4 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) attempt to access beyond end of device loop4: rw=34817, want=157, limit=116 audit: type=1400 audit(1590927648.936:11928): avc: denied { relabelto } for pid=25530 comm="syz-executor.1" name="UDP-Lite" dev="sockfs" ino=85927 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=rawip_socket permissive=1 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) print_req_error: I/O error, dev loop4, sector 0 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) audit: type=1400 audit(1590927651.726:11929): avc: denied { name_connect } for pid=25584 comm="syz-executor.5" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=dccp_socket permissive=1 ip6_tables: ip6tables: counters copy to user failed while replacing table FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) attempt to access beyond end of device loop4: rw=34817, want=157, limit=116 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) attempt to access beyond end of device loop4: rw=34817, want=157, limit=116 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop4): Filesystem has been set read-only FAT-fs (loop4): error, invalid access to FAT (entry 0x00000020) Unknown ioctl 19248 Unknown ioctl 19248 FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020) FAT-fs (loop2): Filesystem has been set read-only FAT-fs (loop2): error, invalid access to FAT (entry 0x00000020)