syzbot


possible deadlock in hfs_extend_file

Status: upstream: reported C repro on 2025/06/17 13:12
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+c50f306994c052787c32@syzkaller.appspotmail.com
First crash: 140d, last: 12d
Bug presence (3)
Date Name Commit Repro Result
2025/08/25 linux-6.6.y (ToT) bb9c90ab9c5a C [report] possible deadlock in hfs_extend_file
2025/07/09 upstream (ToT) 733923397fd9 C [report] possible deadlock in hfs_extend_file
2025/08/25 upstream (ToT) 1b237f190eb3 C Didn't crash
Similar bugs (9)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in hfs_extend_file hfs 4 1 1043d 1043d 0/1 upstream: reported on 2022/12/27 15:22
linux-5.15 possible deadlock in hfs_extend_file (2) 4 1 743d 743d 0/3 auto-obsoleted due to no activity on 2024/01/31 18:25
linux-6.1 possible deadlock in hfs_extend_file 4 7 781d 967d 0/3 auto-obsoleted due to no activity on 2023/12/24 21:20
upstream possible deadlock in hfs_extend_file hfs 4 46 804d 1048d 0/29 auto-obsoleted due to no activity on 2023/11/06 09:48
linux-6.1 possible deadlock in hfs_extend_file (2) origin:upstream 4 C 144 1d09h 580d 0/3 upstream: reported C repro on 2024/04/04 03:11
upstream possible deadlock in hfs_extend_file (3) hfs 4 C unreliable 2900 14h51m 565d 0/29 upstream: reported C repro on 2024/04/18 14:41
linux-5.15 possible deadlock in hfs_extend_file (3) 4 164 1d11h 602d 0/3 upstream: reported on 2024/03/13 05:11
upstream possible deadlock in hfs_extend_file (2) hfs 4 C done done 4 673d 693d 0/29 auto-obsoleted due to no activity on 2024/04/11 05:11
linux-5.15 possible deadlock in hfs_extend_file 4 5 869d 932d 0/3 auto-obsoleted due to no activity on 2023/09/28 05:53

Sample crash report:
loop0: detected capacity change from 0 to 64
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.122/6053 is trying to acquire lock:
ffff888030cc9478 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xdb/0x1220 fs/hfs/extent.c:397

but task is already holding lock:
ffff88801d3d40b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x17e/0x1f0 fs/hfs/bfind.c:-1

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&tree->tree_lock/1){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       hfs_find_init+0x17e/0x1f0 fs/hfs/bfind.c:-1
       hfs_ext_read_extent fs/hfs/extent.c:200 [inline]
       hfs_extend_file+0x2ef/0x1220 fs/hfs/extent.c:401
       hfs_bmap_reserve+0x107/0x430 fs/hfs/btree.c:269
       hfs_cat_create+0x1b4/0x620 fs/hfs/catalog.c:104
       hfs_create+0x66/0xd0 fs/hfs/dir.c:202
       lookup_open fs/namei.c:3496 [inline]
       open_last_lookups fs/namei.c:3564 [inline]
       path_openat+0x1277/0x3190 fs/namei.c:3794
       do_filp_open+0x1c5/0x3d0 fs/namei.c:3824
       do_sys_openat2+0x12c/0x1c0 fs/open.c:1419
       do_sys_open fs/open.c:1434 [inline]
       __do_sys_openat fs/open.c:1450 [inline]
       __se_sys_openat fs/open.c:1445 [inline]
       __x64_sys_openat+0x139/0x160 fs/open.c:1445
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
       hfs_extend_file+0xdb/0x1220 fs/hfs/extent.c:397
       hfs_bmap_reserve+0x107/0x430 fs/hfs/btree.c:269
       __hfs_ext_write_extent+0x1fa/0x470 fs/hfs/extent.c:121
       hfs_ext_write_extent+0x162/0x1e0 fs/hfs/extent.c:144
       hfs_write_inode+0x92/0x7d0 fs/hfs/inode.c:434
       write_inode fs/fs-writeback.c:1483 [inline]
       __writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1700
       writeback_single_inode+0x211/0x720 fs/fs-writeback.c:1756
       write_inode_now+0x161/0x1e0 fs/fs-writeback.c:2802
       hfs_file_fsync+0xa7/0x140 fs/hfs/inode.c:681
       generic_write_sync include/linux/fs.h:2651 [inline]
       generic_file_write_iter+0x261/0x2e0 mm/filemap.c:4141
       call_write_iter include/linux/fs.h:2018 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x43b/0x940 fs/read_write.c:584
       ksys_write+0x147/0x250 fs/read_write.c:637
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&tree->tree_lock/1);
                               lock(&HFS_I(tree->inode)->extents_lock);
                               lock(&tree->tree_lock/1);
  lock(&HFS_I(tree->inode)->extents_lock);

 *** DEADLOCK ***

3 locks held by syz.0.122/6053:
 #0: ffff88801d3d2418 (sb_writers#13){.+.+}-{0:0}, at: vfs_write+0x20e/0x940 fs/read_write.c:580
 #1: ffff888030cce438 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
 #1: ffff888030cce438 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: hfs_file_fsync+0x9d/0x140 fs/hfs/inode.c:678
 #2: ffff88801d3d40b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x17e/0x1f0 fs/hfs/bfind.c:-1

stack backtrace:
CPU: 1 PID: 6053 Comm: syz.0.122 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
 hfs_extend_file+0xdb/0x1220 fs/hfs/extent.c:397
 hfs_bmap_reserve+0x107/0x430 fs/hfs/btree.c:269
 __hfs_ext_write_extent+0x1fa/0x470 fs/hfs/extent.c:121
 hfs_ext_write_extent+0x162/0x1e0 fs/hfs/extent.c:144
 hfs_write_inode+0x92/0x7d0 fs/hfs/inode.c:434
 write_inode fs/fs-writeback.c:1483 [inline]
 __writeback_single_inode+0x705/0xee0 fs/fs-writeback.c:1700
 writeback_single_inode+0x211/0x720 fs/fs-writeback.c:1756
 write_inode_now+0x161/0x1e0 fs/fs-writeback.c:2802
 hfs_file_fsync+0xa7/0x140 fs/hfs/inode.c:681
 generic_write_sync include/linux/fs.h:2651 [inline]
 generic_file_write_iter+0x261/0x2e0 mm/filemap.c:4141
 call_write_iter include/linux/fs.h:2018 [inline]
 new_sync_write fs/read_write.c:491 [inline]
 vfs_write+0x43b/0x940 fs/read_write.c:584
 ksys_write+0x147/0x250 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f4480f8efc9
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd4a28e888 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f44811e5fa0 RCX: 00007f4480f8efc9
RDX: 0000000000000e09 RSI: 0000200000000040 RDI: 0000000000000004
RBP: 00007f4481011f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f44811e5fa0 R14: 00007f44811e5fa0 R15: 0000000000000003
 </TASK>

Crashes (37):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/24 04:32 linux-6.6.y 4a243110dc88 c0460fcd .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/09 07:39 linux-6.6.y a5df3a702b2c 4d9fdfa4 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/23 22:25 linux-6.6.y 4a243110dc88 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/23 21:49 linux-6.6.y 4a243110dc88 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/23 21:49 linux-6.6.y 4a243110dc88 c0460fcd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/10 02:53 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/10 02:52 linux-6.6.y e617101e5626 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/10/07 04:04 linux-6.6.y e617101e5626 8ef35d49 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/09/26 20:58 linux-6.6.y 147338df3487 001c9061 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/09/19 07:56 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/09/12 16:34 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/09/09 21:44 linux-6.6.y fe9731e10004 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/09/09 21:44 linux-6.6.y fe9731e10004 d291dd2d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/30 01:24 linux-6.6.y cc1a1c5b404a 807a3b61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/21 16:50 linux-6.6.y bb9c90ab9c5a 3e79b825 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/21 00:27 linux-6.6.y bb9c90ab9c5a 0b9605c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/19 08:33 linux-6.6.y bb9c90ab9c5a 523f460e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/19 07:53 linux-6.6.y bb9c90ab9c5a 523f460e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/08 02:13 linux-6.6.y 3a8ababb8b6a 6a893178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/08 02:13 linux-6.6.y 3a8ababb8b6a 6a893178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/08/01 12:25 linux-6.6.y 3a8ababb8b6a 40127d41 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/27 02:16 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/27 02:16 linux-6.6.y dbcb8d8e4163 fb8f743d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/17 15:13 linux-6.6.y 9247f4e6573a 0d1223f1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/17 15:13 linux-6.6.y 9247f4e6573a 0d1223f1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/10 20:38 linux-6.6.y 59a2de10b81a 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/10 20:37 linux-6.6.y 59a2de10b81a 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/10 20:35 linux-6.6.y 59a2de10b81a 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/08 15:11 linux-6.6.y a5df3a702b2c 4d9fdfa4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/08 15:11 linux-6.6.y a5df3a702b2c 4d9fdfa4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/06 12:19 linux-6.6.y a5df3a702b2c 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/07/06 12:18 linux-6.6.y a5df3a702b2c 4f67c4ae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/06/27 13:10 linux-6.6.y 3f5b4c104b7d 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/06/27 13:10 linux-6.6.y 3f5b4c104b7d 803ce19b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/06/17 23:17 linux-6.6.y c2603c511feb e77fae15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/06/17 13:11 linux-6.6.y c2603c511feb cfebc887 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
2025/06/17 13:11 linux-6.6.y c2603c511feb cfebc887 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in hfs_extend_file
* Struck through repros no longer work on HEAD.