syzbot


possible deadlock in __blockdev_direct_IO

Status: upstream: reported C repro on 2024/11/11 18:12
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+95be16803df9182b82e6@syzkaller.appspotmail.com
First crash: 200d, last: 15d
Bug presence (1)
Date Name Commit Repro Result
2025/01/21 upstream (ToT) 3d3a9c8b89d4 C [report] possible deadlock in gup_fast_fallback
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in __blockdev_direct_IO (2) 5 148d 170d 0/3 auto-obsoleted due to no activity on 2025/04/12 12:58
linux-6.1 possible deadlock in __blockdev_direct_IO 4 283d 289d 0/3 auto-obsoleted due to no activity on 2024/11/29 10:24
Last patch testing requests (2)
Created Duration User Patch Repo Result
2025/04/23 19:02 13m retest repro linux-5.15.y report log
2025/02/03 07:25 9m retest repro linux-5.15.y report log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.176-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor307/4160 is trying to acquire lock:
ffff88801746b928 (&mm->mmap_lock){++++}-{3:3}, at: get_current arch/x86/include/asm/current.h:15 [inline]
ffff88801746b928 (&mm->mmap_lock){++++}-{3:3}, at: internal_get_user_pages_fast+0x1c7/0x2810 mm/gup.c:2895

but task is already holding lock:
ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: do_blockdev_direct_IO fs/direct-io.c:1169 [inline]
ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: __blockdev_direct_IO+0x3db/0x4f40 fs/direct-io.c:1368

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       inode_lock include/linux/fs.h:789 [inline]
       ntfs_file_mmap+0x589/0x7e0 fs/ntfs3/file.c:401
       call_mmap include/linux/fs.h:2179 [inline]
       mmap_file+0x5a/0xb0 mm/util.c:1092
       __mmap_region mm/mmap.c:1784 [inline]
       mmap_region+0x1035/0x1870 mm/mmap.c:2921
       do_mmap+0x78d/0xe00 mm/mmap.c:1574
       vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551
       ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&mm->mmap_lock){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       internal_get_user_pages_fast+0x212/0x2810 mm/gup.c:2895
       iov_iter_get_pages+0x25a/0x570 lib/iov_iter.c:1544
       dio_refill_pages fs/direct-io.c:173 [inline]
       dio_get_page fs/direct-io.c:217 [inline]
       do_direct_IO fs/direct-io.c:938 [inline]
       do_blockdev_direct_IO fs/direct-io.c:1276 [inline]
       __blockdev_direct_IO+0x1419/0x4f40 fs/direct-io.c:1368
       blockdev_direct_IO include/linux/fs.h:3346 [inline]
       ntfs_direct_IO+0x193/0x360 fs/ntfs3/inode.c:798
       generic_file_read_iter+0x28d/0x460 mm/filemap.c:2772
       call_read_iter include/linux/fs.h:2168 [inline]
       new_sync_read fs/read_write.c:404 [inline]
       vfs_read+0xa93/0xe10 fs/read_write.c:485
       ksys_read+0x1a2/0x2c0 fs/read_write.c:623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#15);
                               lock(&mm->mmap_lock);
                               lock(&sb->s_type->i_mutex_key#15);
  lock(&mm->mmap_lock);

 *** DEADLOCK ***

1 lock held by syz-executor307/4160:
 #0: ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
 #0: ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: do_blockdev_direct_IO fs/direct-io.c:1169 [inline]
 #0: ffff88806fa803a0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: __blockdev_direct_IO+0x3db/0x4f40 fs/direct-io.c:1368

stack backtrace:
CPU: 1 PID: 4160 Comm: syz-executor307 Not tainted 5.15.176-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 internal_get_user_pages_fast+0x212/0x2810 mm/gup.c:2895
 iov_iter_get_pages+0x25a/0x570 lib/iov_iter.c:1544
 dio_refill_pages fs/direct-io.c:173 [inline]
 dio_get_page fs/direct-io.c:217 [inline]
 do_direct_IO fs/direct-io.c:938 [inline]
 do_blockdev_direct_IO fs/direct-io.c:1276 [inline]
 __blockdev_direct_IO+0x1419/0x4f40 fs/direct-io.c:1368
 blockdev_direct_IO include/linux/fs.h:3346 [inline]
 ntfs_direct_IO+0x193/0x360 fs/ntfs3/inode.c:798
 generic_file_read_iter+0x28d/0x460 mm/filemap.c:2772
 call_read_iter include/linux/fs.h:2168 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa93/0xe10 fs/read_write.c:485
 ksys_read+0x1a2/0x2c0 fs/read_write.c:623
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f9a36964739
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 00 00 90 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:00007ffc3040f258 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007f9a36964739
RDX: 0000000000002000 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 00007f9a369f7610

Crashes (17):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/20 07:09 linux-5.15.y 4735586da88e f2cb035c .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/05/15 19:27 linux-5.15.y 3b8db0e4f263 cfde8269 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/04/09 11:47 linux-5.15.y 0c935c049b5c 47d015b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/04/05 04:04 linux-5.15.y 0c935c049b5c c53ea9c9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/04/01 15:44 linux-5.15.y 0c935c049b5c b8645499 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/04/01 15:44 linux-5.15.y 0c935c049b5c b8645499 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/04/01 15:44 linux-5.15.y 0c935c049b5c b8645499 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/03/28 16:38 linux-5.15.y 0c935c049b5c 9a1a9e31 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/03/28 16:38 linux-5.15.y 0c935c049b5c 9a1a9e31 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/03/04 03:56 linux-5.15.y c16c81c81336 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/01/20 06:12 linux-5.15.y 4735586da88e f2cb035c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/01/07 17:46 linux-5.15.y 91786f140358 f3558dbf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2024/11/18 13:07 linux-5.15.y 0a51d2d4527b e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2024/11/18 13:07 linux-5.15.y 0a51d2d4527b e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2024/11/14 08:39 linux-5.15.y 3c17fc483905 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2024/11/11 18:12 linux-5.15.y 3c17fc483905 0c4b1325 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in __blockdev_direct_IO
2025/02/05 16:08 linux-5.15.y c16c81c81336 4dc70884 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in __blockdev_direct_IO
* Struck through repros no longer work on HEAD.