syzbot


possible deadlock in __generic_file_fsync

Status: upstream: reported C repro on 2019/06/13 18:12
Subsystems: ext4 btrfs fat
[Documentation on labels]
Reported-by: syzbot+4ecceb225d012d854785@syzkaller.appspotmail.com
First crash: 1865d, last: 517d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in __generic_file_fsync ext4 fat syz error 171 521d 1858d 0/1 upstream: reported syz repro on 2019/06/19 20:20
upstream possible deadlock in __generic_file_fsync ext4 C done unreliable 80 1965d 2105d 0/27 auto-obsoleted due to no activity on 2022/09/04 03:10
android-414 possible deadlock in __generic_file_fsync syz 262 1693d 1927d 0/1 public: reported syz repro on 2019/04/12 00:01
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2021/06/22 07:15 44m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.19.197-syzkaller #0 Not tainted
------------------------------------------------------
kworker/1:0/8184 is trying to acquire lock:
00000000f790aa52 (&sb->s_type->i_mutex_key#17){+.+.}, at: inode_lock include/linux/fs.h:748 [inline]
00000000f790aa52 (&sb->s_type->i_mutex_key#17){+.+.}, at: __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989

but task is already holding lock:
000000008ee573ac ((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:4177
       __alloc_workqueue_key+0xb76/0xed0 kernel/workqueue.c:4154
       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#17){+.+.}:
       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#17 --> (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#17);

 *** DEADLOCK ***

2 locks held by kworker/1:0/8184:
 #0: 0000000017e5a9c6 ((wq_completion)"dio/%s"sb->s_id){+.+.}, at: process_one_work+0x767/0x1570 kernel/workqueue.c:2124
 #1: 000000008ee573ac ((work_completion)(&dio->complete_work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128

stack backtrace:
CPU: 1 PID: 8184 Comm: kworker/1:0 Not tainted 4.19.197-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: dio/loop2 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

Crashes (577):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/07/16 06:55 linux-4.19.y fcfbdfe9626e f115ae98 .config console log report syz C ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/07/16 03:16 linux-4.19.y fcfbdfe9626e f115ae98 .config console log report syz C ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/07/07 11:45 linux-4.19.y 9f84340f012e 4846d5c1 .config console log report syz C ci2-linux-4-19 possible deadlock in __generic_file_fsync
2020/06/03 03:57 linux-4.19.y 2d16cf4817bc f3ba1b5b .config console log report syz C ci2-linux-4-19
2022/09/10 22:59 linux-4.19.y 3f8a27f9e27b 356d8217 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/04/29 20:25 linux-4.19.y 3f8a27f9e27b 44a5ca63 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/03/29 06:55 linux-4.19.y 3f8a27f9e27b 6bdac766 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/01/24 02:34 linux-4.19.y 3f8a27f9e27b 214351e1 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/12/25 10:18 linux-4.19.y 3f8a27f9e27b 6caa12e4 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/07/29 19:21 linux-4.19.y a89b48fe9308 8a799410 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/01/25 21:16 linux-4.19.y 2263955bf7e7 52e37319 .config console log report syz ci2-linux-4-19 possible deadlock in __generic_file_fsync
2020/11/14 15:11 linux-4.19.y 31acccdc8774 1bf9a662 .config console log report syz ci2-linux-4-19
2019/08/02 18:23 linux-4.19.y 9a9de33a9dfa 3faab807 .config console log report syz ci2-linux-4-19
2019/08/02 14:51 linux-4.19.y 9a9de33a9dfa 835dffe7 .config console log report syz ci2-linux-4-19
2023/02/20 12:04 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/02/20 02:22 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/02/07 20:35 linux-4.19.y 3f8a27f9e27b 15c3d445 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/02/06 19:39 linux-4.19.y 3f8a27f9e27b 0a9c11b6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/02/06 07:52 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/02/05 22:35 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/31 12:15 linux-4.19.y 3f8a27f9e27b b68fb8d6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/27 09:53 linux-4.19.y 3f8a27f9e27b 9dfcf09c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/22 16:19 linux-4.19.y 3f8a27f9e27b cc0f9968 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/20 14:33 linux-4.19.y 3f8a27f9e27b dd15ff29 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/18 22:14 linux-4.19.y 3f8a27f9e27b 4620c2d9 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/16 04:30 linux-4.19.y 3f8a27f9e27b a63719e7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/07 15:26 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/05 09:24 linux-4.19.y 3f8a27f9e27b 1dac8c7a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2023/01/02 06:09 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/12/20 17:08 linux-4.19.y 3f8a27f9e27b c52b2efb .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/12/12 15:05 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/12/09 15:54 linux-4.19.y 3f8a27f9e27b 67be1ae7 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/12/03 12:44 linux-4.19.y 3f8a27f9e27b e080de16 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/11/21 20:38 linux-4.19.y 3f8a27f9e27b 1c576c23 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/11/20 19:52 linux-4.19.y 3f8a27f9e27b 5bb70014 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/11/05 11:07 linux-4.19.y 3f8a27f9e27b 6d752409 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/30 04:14 linux-4.19.y 3f8a27f9e27b 2a71366b .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/26 17:13 linux-4.19.y 3f8a27f9e27b 2159e4d2 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/19 21:07 linux-4.19.y 3f8a27f9e27b b31320fc .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/17 21:16 linux-4.19.y 3f8a27f9e27b 94744d21 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/16 13:43 linux-4.19.y 3f8a27f9e27b 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/15 10:54 linux-4.19.y 3f8a27f9e27b 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/14 06:44 linux-4.19.y 3f8a27f9e27b 4954e4b2 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/03 14:37 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/03 02:30 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/03 00:12 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/10/02 06:58 linux-4.19.y 3f8a27f9e27b feb56351 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/25 14:43 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report info ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/24 05:29 linux-4.19.y 3f8a27f9e27b 0042f2b4 .config console log report info ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/22 14:06 linux-4.19.y 3f8a27f9e27b 60af5050 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/22 12:06 linux-4.19.y 3f8a27f9e27b 60af5050 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/22 03:14 linux-4.19.y 3f8a27f9e27b 60af5050 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/21 00:00 linux-4.19.y 3f8a27f9e27b c4b8ccfd .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/20 08:36 linux-4.19.y 3f8a27f9e27b 7c41a9ba .config console log report info ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/19 18:19 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/19 08:18 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/18 07:47 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/17 18:44 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/17 15:34 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/17 12:45 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/17 06:39 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2022/09/16 15:33 linux-4.19.y 3f8a27f9e27b dd9a85ff .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __generic_file_fsync
2021/01/12 20:51 linux-4.19.y 675cc038067f 0cdd6185 .config console log report info ci2-linux-4-19
2019/06/13 17:11 linux-4.19.y 768292d05361 d25bb7ad .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.