syzbot


possible deadlock in do_qc

Status: upstream: reported on 2024/04/27 22:18
Reported-by: syzbot+216240cf171bef980ebb@syzkaller.appspotmail.com
First crash: 50d, last: 2d23h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in do_qc gfs2 476 35m 70d 0/27 upstream: reported on 2024/04/07 05:18
linux-6.1 possible deadlock in do_qc 108 2d20h 50d 0/3 upstream: reported on 2024/04/28 01:25

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.160-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/3634 is trying to acquire lock:
ffff88805f84cae0 (&sdp->sd_quota_mutex){+.+.}-{3:3}, at: do_qc+0xc8/0x720 fs/gfs2/quota.c:678

but task is already holding lock:
ffff88806133d080 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1514 [inline]
ffff88806133d080 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x27e5/0x3ab0 fs/gfs2/bmap.c:1839

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ip->i_rw_mutex){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
       __gfs2_iomap_get+0x178/0x1480 fs/gfs2/bmap.c:858
       gfs2_iomap_get fs/gfs2/bmap.c:1398 [inline]
       gfs2_block_map+0x292/0x830 fs/gfs2/bmap.c:1213
       bh_get+0x26d/0x6a0 fs/gfs2/quota.c:385
       qdsb_get+0x209/0x3b0 fs/gfs2/quota.c:518
       gfs2_quota_hold+0x19d/0x5c0 fs/gfs2/quota.c:604
       punch_hole+0xebd/0x3ab0 fs/gfs2/bmap.c:1800
       gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1159
       iomap_iter+0x222/0xe30 fs/iomap/iter.c:62
       iomap_file_buffered_write+0x748/0x8a0 fs/iomap/buffered-io.c:814
       gfs2_file_buffered_write+0x3e3/0x850 fs/gfs2/file.c:1057
       gfs2_file_write_iter+0x4a2/0xf10 fs/gfs2/file.c:1165
       call_write_iter include/linux/fs.h:2172 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0xacf/0xe50 fs/read_write.c:594
       ksys_write+0x1a2/0x2c0 fs/read_write.c:647
       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 (&sdp->sd_quota_mutex){+.+.}-{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
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       do_qc+0xc8/0x720 fs/gfs2/quota.c:678
       gfs2_quota_change+0x2db/0x8c0 fs/gfs2/quota.c:1295
       punch_hole+0x3446/0x3ab0 fs/gfs2/bmap.c:1940
       gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1159
       iomap_iter+0x222/0xe30 fs/iomap/iter.c:62
       iomap_file_buffered_write+0x748/0x8a0 fs/iomap/buffered-io.c:814
       gfs2_file_buffered_write+0x3e3/0x850 fs/gfs2/file.c:1057
       gfs2_file_write_iter+0x4a2/0xf10 fs/gfs2/file.c:1165
       call_write_iter include/linux/fs.h:2172 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0xacf/0xe50 fs/read_write.c:594
       ksys_write+0x1a2/0x2c0 fs/read_write.c:647
       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(&ip->i_rw_mutex);
                               lock(&sdp->sd_quota_mutex);
                               lock(&ip->i_rw_mutex);
  lock(&sdp->sd_quota_mutex);

 *** DEADLOCK ***

6 locks held by syz-executor.4/3634:
 #0: ffff888076620370 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2cb/0x380 fs/file.c:1088
 #1: ffff8880200b6460 (sb_writers#14){.+.+}-{0:0}, at: vfs_write+0x29a/0xe50 fs/read_write.c:590
 #2: ffff88806133cbe8 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
 #2: ffff88806133cbe8 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: gfs2_file_write_iter+0x373/0xf10 fs/gfs2/file.c:1122
 #3: ffff8880200b6650 (sb_internal#3){.+.+}-{0:0}, at: gfs2_trans_begin+0x6d/0xe0 fs/gfs2/trans.c:118
 #4: ffff88805f84d0a8 (&sdp->sd_log_flush_lock){.+.+}-{3:3}, at: __gfs2_trans_begin+0x55a/0x940 fs/gfs2/trans.c:87
 #5: ffff88806133d080 (&ip->i_rw_mutex){++++}-{3:3}, at: sweep_bh_for_rgrps fs/gfs2/bmap.c:1514 [inline]
 #5: ffff88806133d080 (&ip->i_rw_mutex){++++}-{3:3}, at: punch_hole+0x27e5/0x3ab0 fs/gfs2/bmap.c:1839

stack backtrace:
CPU: 0 PID: 3634 Comm: syz-executor.4 Not tainted 5.15.160-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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
 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 do_qc+0xc8/0x720 fs/gfs2/quota.c:678
 gfs2_quota_change+0x2db/0x8c0 fs/gfs2/quota.c:1295
 punch_hole+0x3446/0x3ab0 fs/gfs2/bmap.c:1940
 gfs2_iomap_end+0x511/0x6d0 fs/gfs2/bmap.c:1159
 iomap_iter+0x222/0xe30 fs/iomap/iter.c:62
 iomap_file_buffered_write+0x748/0x8a0 fs/iomap/buffered-io.c:814
 gfs2_file_buffered_write+0x3e3/0x850 fs/gfs2/file.c:1057
 gfs2_file_write_iter+0x4a2/0xf10 fs/gfs2/file.c:1165
 call_write_iter include/linux/fs.h:2172 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacf/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 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:0x7f92e268bea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f92e12050c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f92e27c2f80 RCX: 00007f92e268bea9
RDX: 000000000208e24b RSI: 0000000020000100 RDI: 0000000000000004
RBP: 00007f92e26faff4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f92e27c2f80 R15: 00007fff26657208
 </TASK>

Crashes (188):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/14 05:03 linux-5.15.y c61bd26ae81a a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/14 00:00 linux-5.15.y c61bd26ae81a a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/13 07:51 linux-5.15.y c61bd26ae81a 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/12 19:57 linux-5.15.y c61bd26ae81a f815599d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/11 17:11 linux-5.15.y c61bd26ae81a b7d9eb04 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/09 11:41 linux-5.15.y c61bd26ae81a 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/03 20:23 linux-5.15.y c61bd26ae81a 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/03 17:52 linux-5.15.y c61bd26ae81a 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/01 12:38 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/01 09:06 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/29 13:56 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/29 03:30 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/28 08:54 linux-5.15.y c61bd26ae81a f550015e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/27 00:59 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/26 02:06 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/26 00:51 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/24 11:01 linux-5.15.y 83655231580b 8f98448e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/24 11:01 linux-5.15.y 83655231580b 8f98448e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/24 06:22 linux-5.15.y 83655231580b 8f98448e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/23 04:08 linux-5.15.y 83655231580b 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/22 19:08 linux-5.15.y 83655231580b 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/21 16:32 linux-5.15.y 83655231580b 4c0d3ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/21 06:12 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/20 15:44 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/05/20 09:07 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/04/27 22:17 linux-5.15.y b925f60c6ee7 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in do_qc
2024/06/11 04:23 linux-5.15.y c61bd26ae81a 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/10 10:58 linux-5.15.y c61bd26ae81a 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/10 09:52 linux-5.15.y c61bd26ae81a 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/10 08:11 linux-5.15.y c61bd26ae81a 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/03 02:18 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/02 20:19 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/01 07:42 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/01 07:40 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/06/01 06:29 linux-5.15.y c61bd26ae81a 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/31 04:35 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/29 15:09 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/29 12:11 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/29 10:50 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/29 00:49 linux-5.15.y c61bd26ae81a 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/28 11:55 linux-5.15.y c61bd26ae81a f550015e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/28 07:41 linux-5.15.y c61bd26ae81a f550015e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/27 02:13 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/26 08:12 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/26 06:40 linux-5.15.y c61bd26ae81a a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/23 00:08 linux-5.15.y 83655231580b 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/22 21:15 linux-5.15.y 83655231580b 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/22 06:36 linux-5.15.y 83655231580b 1014eca7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
2024/05/21 13:49 linux-5.15.y 83655231580b 4c0d3ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in do_qc
* Struck through repros no longer work on HEAD.