====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ kworker/1:3/8916 is trying to acquire lock: 000000007c396f02 (&sb->s_type->i_mutex_key#23){++++}, at: inode_lock include/linux/fs.h:748 [inline] 000000007c396f02 (&sb->s_type->i_mutex_key#23){++++}, at: __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 but task is already holding lock: 000000002f88165e ((work_completion)(&dio->complete_work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 ((work_completion)(&dio->complete_work)){+.+.}: worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #1 ((wq_completion)"dio/%s"sb->s_id){+.+.}: drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 __alloc_workqueue_key+0xb76/0xed0 kernel/workqueue.c:4160 sb_init_dio_done_wq+0x34/0x90 fs/direct-io.c:623 do_blockdev_direct_IO fs/direct-io.c:1285 [inline] __blockdev_direct_IO+0x5f55/0xef40 fs/direct-io.c:1419 blockdev_direct_IO include/linux/fs.h:3059 [inline] fat_direct_IO+0x1d1/0x370 fs/fat/inode.c:282 generic_file_direct_write+0x208/0x4a0 mm/filemap.c:3073 __generic_file_write_iter+0x2d0/0x610 mm/filemap.c:3252 generic_file_write_iter+0x3f8/0x730 mm/filemap.c:3323 call_write_iter include/linux/fs.h:1821 [inline] aio_write+0x37f/0x5c0 fs/aio.c:1574 __io_submit_one fs/aio.c:1858 [inline] io_submit_one+0xecd/0x20c0 fs/aio.c:1909 __do_sys_io_submit fs/aio.c:1953 [inline] __se_sys_io_submit+0x11b/0x4a0 fs/aio.c:1924 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&sb->s_type->i_mutex_key#23){++++}: down_write+0x34/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 fat_file_fsync+0x73/0x200 fs/fat/file.c:198 vfs_fsync_range+0x13a/0x220 fs/sync.c:197 generic_write_sync include/linux/fs.h:2750 [inline] dio_complete+0x763/0xac0 fs/direct-io.c:329 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#23 --> (wq_completion)"dio/%s"sb->s_id --> (work_completion)(&dio->complete_work) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((work_completion)(&dio->complete_work)); lock((wq_completion)"dio/%s"sb->s_id); lock((work_completion)(&dio->complete_work)); lock(&sb->s_type->i_mutex_key#23); *** DEADLOCK *** 2 locks held by kworker/1:3/8916: #0: 000000005bd25b91 ((wq_completion)"dio/%s"sb->s_id){+.+.}, at: process_one_work+0x767/0x1570 kernel/workqueue.c:2124 #1: 000000002f88165e ((work_completion)(&dio->complete_work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128 stack backtrace: CPU: 1 PID: 8916 Comm: kworker/1:3 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 Workqueue: dio/loop3 dio_aio_complete_work 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 down_write+0x34/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 fat_file_fsync+0x73/0x200 fs/fat/file.c:198 vfs_fsync_range+0x13a/0x220 fs/sync.c:197 generic_write_sync include/linux/fs.h:2750 [inline] dio_complete+0x763/0xac0 fs/direct-io.c:329 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue audit: type=1800 audit(1663487220.077:182): pid=32458 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="file0" dev="loop5" ino=169 res=0 EXT4-fs error (device loop4): ext4_mb_mark_diskspace_used:2995: comm syz-executor.4: Allocating blocks 128-144 which overlap fs metadata FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) audit: type=1804 audit(1663487220.077:183): pid=32458 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir3567769537/syzkaller.8I4a6M/344/file0/file0" dev="loop5" ino=169 res=1 FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) audit: type=1804 audit(1663487220.097:184): pid=32458 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir3567769537/syzkaller.8I4a6M/344/file0/file0" dev="loop5" ino=169 res=1 EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) audit: type=1800 audit(1663487220.318:185): pid=32505 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="file0" dev="loop5" ino=170 res=0 syz-executor.0 (32476): drop_caches: 1 FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) audit: type=1800 audit(1663487220.708:186): pid=32533 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="file0" dev="loop5" ino=171 res=0 EXT4-fs (loop4): mounted filesystem without journal. Opts: ,errors=continue audit: type=1804 audit(1663487220.708:187): pid=32533 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir3567769537/syzkaller.8I4a6M/346/file0/file0" dev="loop5" ino=171 res=1 FAT-fs (loop5): Invalid FSINFO signature: 0x00000000, 0x00000000 (sector = 1) syz-executor.0 (32476): drop_caches: 1 audit: type=1804 audit(1663487220.728:188): pid=32533 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir3567769537/syzkaller.8I4a6M/346/file0/file0" dev="loop5" ino=171 res=1 XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. overlayfs: missing 'lowerdir' 9pnet: Could not find request transport: xen overlayfs: failed to resolve './file0': -2 XFS (loop4): Invalid superblock magic number syz-executor.0 (32595): drop_caches: 1 XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. overlayfs: missing 'lowerdir' xt_CT: You must specify a L4 protocol and not use inversions on it syz-executor.0 (32595): drop_caches: 1 UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000) 9pnet: Could not find request transport: xen overlayfs: fs on './file0' does not support file handles, falling back to index=off,nfs_export=off. XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. syz-executor.0 (32675): drop_caches: 1 XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. xt_CT: You must specify a L4 protocol and not use inversions on it EXT4-fs (loop1): Unrecognized mount option "syz$" or missing value syz-executor.0 (32675): drop_caches: 1 XFS (loop4): unknown mount option [: ]. overlayfs: missing 'lowerdir' UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000) XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. overlayfs: fs on './file0' does not support file handles, falling back to index=off,nfs_export=off. 9pnet: Could not find request transport: xen IPVS: ftp: loaded support on port[0] = 21 XFS (loop4): unknown mount option [: ]. IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. XFS (loop4): unknown mount option [: ]. UDF-fs: INFO Mounting volume 'LinuxUDF', timestamp 2020/09/19 18:44 (1000) XFS (loop4): unknown mount option [: ]. XFS (loop2): unknown mount option [%]WIQX*_.:Ǻss{ CHP"wPқV.D|]vwςdm6Xf8?]. audit: type=1804 audit(1663487223.848:189): pid=452 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir3359134959/syzkaller.o69HRm/389/cgroup.controllers" dev="sda1" ino=14102 res=1 XFS (loop4): Invalid superblock magic number EXT4-fs (loop1): Unrecognized mount option "syz$" or missing value EXT4-fs (loop3): Unrecognized mount option "syz" or missing value audit: type=1804 audit(1663487225.058:190): pid=570 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir3359134959/syzkaller.o69HRm/390/cgroup.controllers" dev="sda1" ino=14055 res=1 audit: type=1804 audit(1663487225.148:191): pid=570 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir3359134959/syzkaller.o69HRm/390/cgroup.controllers" dev="sda1" ino=14055 res=1 netlink: 'syz-executor.1': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.1'. audit: type=1804 audit(1663487225.258:192): pid=611 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir3359134959/syzkaller.o69HRm/391/cgroup.controllers" dev="sda1" ino=14040 res=1 netlink: 'syz-executor.1': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 'syz-executor.5': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.1': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 'syz-executor.5': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.1': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 'syz-executor.5': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.5': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.5': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.2': attribute type 21 has an invalid length. netlink: 156 bytes leftover after parsing attributes in process `syz-executor.2'. ieee802154 phy0 wpan0: encryption failed: -22 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 1 CPU: 1 PID: 1124 Comm: syz-executor.1 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 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_node mm/slab.c:3304 [inline] kmem_cache_alloc_node_trace+0x244/0x3b0 mm/slab.c:3666 __do_kmalloc_node mm/slab.c:3688 [inline] __kmalloc_node+0x38/0x70 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] newseg+0x220/0xdf0 ipc/shm.c:622 ipcget_new ipc/util.c:315 [inline] ipcget+0xe6/0xcd0 ipc/util.c:614 ksys_shmget ipc/shm.c:742 [inline] __do_sys_shmget ipc/shm.c:747 [inline] __se_sys_shmget ipc/shm.c:745 [inline] __x64_sys_shmget+0x139/0x1a0 ipc/shm.c:745 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f0d4ca04409 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0d4b379168 EFLAGS: 00000246 ORIG_RAX: 000000000000001d RAX: ffffffffffffffda RBX: 00007f0d4cb16f80 RCX: 00007f0d4ca04409 RDX: 0000000000000000 RSI: 0000000000001000 RDI: 0000000000000000 RBP: 00007f0d4b3791d0 R08: 0000000000000000 R09: 0000000000000000 R10: 000000002021d000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffdb39da4bf R14: 00007f0d4b379300 R15: 0000000000022000 FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 1149 Comm: syz-executor.1 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 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 shmem_alloc_inode+0x18/0x40 mm/shmem.c:3609 alloc_inode+0x5d/0x180 fs/inode.c:211 new_inode_pseudo fs/inode.c:911 [inline] new_inode+0x1d/0xf0 fs/inode.c:940 shmem_get_inode+0x96/0x8d0 mm/shmem.c:2196 __shmem_file_setup.part.0+0x1e2/0x2b0 mm/shmem.c:3965 __shmem_file_setup mm/shmem.c:3959 [inline] shmem_kernel_file_setup+0x64/0x90 mm/shmem.c:3995 newseg+0x4a9/0xdf0 ipc/shm.c:663 ipcget_new ipc/util.c:315 [inline] ipcget+0xe6/0xcd0 ipc/util.c:614 ksys_shmget ipc/shm.c:742 [inline] __do_sys_shmget ipc/shm.c:747 [inline] __se_sys_shmget ipc/shm.c:745 [inline] __x64_sys_shmget+0x139/0x1a0 ipc/shm.c:745 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f0d4ca04409 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f0d4b379168 EFLAGS: 00000246 ORIG_RAX: 000000000000001d RAX: ffffffffffffffda RBX: 00007f0d4cb16f80 RCX: 00007f0d4ca04409 RDX: 0000000000000000 RSI: 0000000000001000 RDI: 0000000000000000