====================================================== WARNING: possible circular locking dependency detected 4.14.155-syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:1/21195 is trying to acquire lock: (&sb->s_type->i_mutex_key#9){++++}, at: [<00000000e190e40a>] inode_lock include/linux/fs.h:724 [inline] (&sb->s_type->i_mutex_key#9){++++}, at: [<00000000e190e40a>] __generic_file_fsync+0x9e/0x190 fs/libfs.c:985 but task is already holding lock: ((&dio->complete_work)){+.+.}, at: [<00000000103f5b19>] process_one_work+0x735/0x1580 kernel/workqueue.c:2109 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 ((&dio->complete_work)){+.+.}: process_one_work+0x789/0x1580 kernel/workqueue.c:2110 worker_thread+0xdd/0xdf0 kernel/workqueue.c:2271 kthread+0x31f/0x430 kernel/kthread.c:232 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:404 -> #1 ("dio/%s"sb->s_id){+.+.}: flush_workqueue+0x118/0x13b0 kernel/workqueue.c:2639 drain_workqueue+0x177/0x3e0 kernel/workqueue.c:2804 destroy_workqueue+0x22/0x5e0 kernel/workqueue.c:4111 __alloc_workqueue_key+0xb48/0xd80 kernel/workqueue.c:4094 sb_init_dio_done_wq+0x34/0x90 fs/direct-io.c:624 do_blockdev_direct_IO fs/direct-io.c:1286 [inline] __blockdev_direct_IO+0x2f23/0xe24e fs/direct-io.c:1422 ext4_direct_IO_write fs/ext4/inode.c:3730 [inline] ext4_direct_IO+0xa4f/0x2820 fs/ext4/inode.c:3885 generic_file_direct_write+0x1e4/0x430 mm/filemap.c:3036 __generic_file_write_iter+0x209/0x550 mm/filemap.c:3215 ext4_file_write_iter+0x68a/0xdb0 fs/ext4/file.c:268 call_write_iter include/linux/fs.h:1798 [inline] aio_write+0x2ea/0x530 fs/aio.c:1553 io_submit_one fs/aio.c:1641 [inline] do_io_submit+0x8e7/0x13e0 fs/aio.c:1709 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> #0 (&sb->s_type->i_mutex_key#9){++++}: lock_acquire+0x12b/0x360 kernel/locking/lockdep.c:3994 down_write+0x34/0x90 kernel/locking/rwsem.c:54 inode_lock include/linux/fs.h:724 [inline] __generic_file_fsync+0x9e/0x190 fs/libfs.c:985 ext4_sync_file+0x3ac/0x1250 fs/ext4/fsync.c:120 vfs_fsync_range+0x106/0x260 fs/sync.c:196 generic_write_sync include/linux/fs.h:2713 [inline] dio_complete+0x37e/0x860 fs/direct-io.c:330 process_one_work+0x7f1/0x1580 kernel/workqueue.c:2134 worker_thread+0xdd/0xdf0 kernel/workqueue.c:2271 kthread+0x31f/0x430 kernel/kthread.c:232 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:404 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#9 --> "dio/%s"sb->s_id --> (&dio->complete_work) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((&dio->complete_work)); lock("dio/%s"sb->s_id); lock((&dio->complete_work)); lock(&sb->s_type->i_mutex_key#9); *** DEADLOCK *** 2 locks held by kworker/0:1/21195: #0: ("dio/%s"sb->s_id){+.+.}, at: [<0000000077861d79>] process_one_work+0x6ff/0x1580 kernel/workqueue.c:2105 #1: ((&dio->complete_work)){+.+.}, at: [<00000000103f5b19>] process_one_work+0x735/0x1580 kernel/workqueue.c:2109 stack backtrace: CPU: 0 PID: 21195 Comm: kworker/0:1 Not tainted 4.14.155-syzkaller #0 Workqueue: dio/sda1 dio_aio_complete_work Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xe5/0x154 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:1901 [inline] check_prevs_add kernel/locking/lockdep.c:2018 [inline] validate_chain kernel/locking/lockdep.c:2460 [inline] __lock_acquire+0x2f5f/0x4320 kernel/locking/lockdep.c:3487 lock_acquire+0x12b/0x360 kernel/locking/lockdep.c:3994 down_write+0x34/0x90 kernel/locking/rwsem.c:54 inode_lock include/linux/fs.h:724 [inline] __generic_file_fsync+0x9e/0x190 fs/libfs.c:985 ext4_sync_file+0x3ac/0x1250 fs/ext4/fsync.c:120 vfs_fsync_range+0x106/0x260 fs/sync.c:196 generic_write_sync include/linux/fs.h:2713 [inline] dio_complete+0x37e/0x860 fs/direct-io.c:330 process_one_work+0x7f1/0x1580 kernel/workqueue.c:2134 worker_thread+0xdd/0xdf0 kernel/workqueue.c:2271 kthread+0x31f/0x430 kernel/kthread.c:232 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:404 kauditd_printk_skb: 195 callbacks suppressed audit: type=1400 audit(2000000216.960:171126): avc: denied { map } for pid=28608 comm="modprobe" path="/bin/kmod" dev="sda1" ino=1440 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.960:171127): avc: denied { map } for pid=28608 comm="modprobe" path="/bin/kmod" dev="sda1" ino=1440 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.970:171128): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.970:171129): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.980:171130): avc: denied { map } for pid=28608 comm="modprobe" path="/etc/ld.so.cache" dev="sda1" ino=2503 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.980:171131): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/libkmod.so.2.1.3" dev="sda1" ino=2811 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.980:171132): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/libkmod.so.2.1.3" dev="sda1" ino=2811 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.990:171133): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000216.990:171134): avc: denied { map } for pid=28608 comm="modprobe" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000217.050:171135): avc: denied { map } for pid=28610 comm="syz-executor.4" path="/root/syzkaller-testdir045112532/syzkaller.IEPJmm/897/bus" dev="sda1" ino=17727 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 selinux_nlmsg_perm: 6 callbacks suppressed SELinux: unrecognized netlink message: protocol=0 nlmsg_type=24434 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=28625 comm=syz-executor.0 kauditd_printk_skb: 254 callbacks suppressed audit: type=1400 audit(2000000222.040:171390): avc: denied { map } for pid=28829 comm="syz-executor.4" path="/root/syzkaller-testdir045112532/syzkaller.IEPJmm/923/bus" dev="sda1" ino=17779 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.100:171391): avc: denied { map } for pid=28831 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.110:171392): avc: denied { map } for pid=28831 comm="blkid" path="/sbin/blkid" dev="sda1" ino=16128 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.110:171393): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.110:171394): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/ld-2.13.so" dev="sda1" ino=2668 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.140:171395): avc: denied { map } for pid=28831 comm="blkid" path="/etc/ld.so.cache" dev="sda1" ino=2503 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.140:171396): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.140:171397): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/libblkid.so.1.1.0" dev="sda1" ino=2825 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.160:171398): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/libc-2.13.so" dev="sda1" ino=2784 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1 audit: type=1400 audit(2000000222.190:171399): avc: denied { map } for pid=28831 comm="blkid" path="/lib/x86_64-linux-gnu/libuuid.so.1.3.0" dev="sda1" ino=2819 scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:object_r:file_t:s0 tclass=file permissive=1