syzbot


possible deadlock in hfsplus_block_allocate

Status: upstream: reported C repro on 2022/11/29 13:38
Subsystems: hfs
[Documentation on labels]
Reported-by: syzbot+b6ccd31787585244a855@syzkaller.appspotmail.com
First crash: 679d, last: 11h22m
Cause bisection: introduced by (bisect log) :
commit 427c76aed29ec12a57f11546a5036df3cc52855e
Author: Sean Christopherson <seanjc@google.com>
Date: Sat Jul 29 01:35:32 2023 +0000

  KVM: x86/mmu: Bug the VM if write-tracking is used but not enabled

Crash: possible deadlock in hfsplus_block_allocate (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] possible deadlock in hfsplus_block_allocate 0 (3) 2024/03/14 08:20
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in hfsplus_block_allocate 26 161d 558d 0/3 auto-obsoleted due to no activity on 2024/08/08 03:24
linux-4.14 possible deadlock in hfsplus_block_allocate hfsplus 2 629d 645d 0/1 upstream: reported on 2023/01/02 02:59
linux-5.15 possible deadlock in hfsplus_block_allocate (2) 1 66d 66d 0/3 upstream: reported on 2024/08/03 18:00
linux-4.19 possible deadlock in hfsplus_block_allocate hfsplus 2 648d 656d 0/1 upstream: reported on 2022/12/22 13:15
linux-5.15 possible deadlock in hfsplus_block_allocate 18 203d 564d 0/3 auto-obsoleted due to no activity on 2024/06/27 07:36
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/07/07 18:36 15m retest repro upstream report log
2024/06/22 19:10 21m retest repro upstream OK log
2024/03/31 17:50 18m retest repro upstream error

Sample crash report:
loop0: detected capacity change from 0 to 1024
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc4-syzkaller-00301-g5f583a3162ff #0 Not tainted
------------------------------------------------------
syz-executor777/5100 is trying to acquire lock:
ffff88802d4428f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x9e/0x8c0 fs/hfsplus/bitmap.c:35

but task is already holding lock:
ffff88802da4c488 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x21b/0x1b70 fs/hfsplus/extents.c:457

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       hfsplus_get_block+0x383/0x14f0 fs/hfsplus/extents.c:260
       block_read_full_folio+0x42e/0xe10 fs/buffer.c:2407
       filemap_read_folio+0x1a0/0x790 mm/filemap.c:2355
       do_read_cache_folio+0x134/0x820 mm/filemap.c:3788
       do_read_cache_page+0x30/0x200 mm/filemap.c:3854
       read_mapping_page include/linux/pagemap.h:900 [inline]
       hfsplus_block_allocate+0xee/0x8c0 fs/hfsplus/bitmap.c:37
       hfsplus_file_extend+0xade/0x1b70 fs/hfsplus/extents.c:468
       hfsplus_get_block+0x406/0x14f0 fs/hfsplus/extents.c:245
       __block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2128
       __block_write_begin fs/buffer.c:2177 [inline]
       block_write_begin+0x9b/0x1e0 fs/buffer.c:2236
       cont_write_begin+0x645/0x890 fs/buffer.c:2590
       hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
       generic_perform_write+0x322/0x640 mm/filemap.c:4015
       generic_file_write_iter+0xaf/0x310 mm/filemap.c:4136
       new_sync_write fs/read_write.c:497 [inline]
       vfs_write+0xa72/0xc90 fs/read_write.c:590
       ksys_write+0x1a0/0x2c0 fs/read_write.c:643
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&sbi->alloc_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       hfsplus_block_allocate+0x9e/0x8c0 fs/hfsplus/bitmap.c:35
       hfsplus_file_extend+0xade/0x1b70 fs/hfsplus/extents.c:468
       hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358
       hfsplus_create_cat+0x1b0/0x1b60 fs/hfsplus/catalog.c:272
       hfsplus_fill_super+0x13ee/0x1ca0 fs/hfsplus/super.c:566
       mount_bdev+0x20a/0x2d0 fs/super.c:1659
       legacy_get_tree+0xee/0x190 fs/fs_context.c:662
       vfs_get_tree+0x90/0x2a0 fs/super.c:1780
       do_new_mount+0x2be/0xb40 fs/namespace.c:3352
       do_mount fs/namespace.c:3692 [inline]
       __do_sys_mount fs/namespace.c:3898 [inline]
       __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3875
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&HFSPLUS_I(inode)->extents_lock);
                               lock(&sbi->alloc_mutex);
                               lock(&HFSPLUS_I(inode)->extents_lock);
  lock(&sbi->alloc_mutex);

 *** DEADLOCK ***

4 locks held by syz-executor777/5100:
 #0: ffff888011fa00e0 (&type->s_umount_key#43/1){+.+.}-{3:3}, at: alloc_super+0x221/0x9d0 fs/super.c:344
 #1: ffff88802d442998 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_fill_super+0x1380/0x1ca0 fs/hfsplus/super.c:559
 #2: ffff88802d20a0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0
 #3: ffff88802da4c488 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x21b/0x1b70 fs/hfsplus/extents.c:457

stack backtrace:
CPU: 0 PID: 5100 Comm: syz-executor777 Not tainted 6.10.0-rc4-syzkaller-00301-g5f583a3162ff #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+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 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+0x18e0/0x5900 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
 hfsplus_block_allocate+0x9e/0x8c0 fs/hfsplus/bitmap.c:35
 hfsplus_file_extend+0xade/0x1b70 fs/hfsplus/extents.c:468
 hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358
 hfsplus_create_cat+0x1b0/0x1b60 fs/hfsplus/catalog.c:272
 hfsplus_fill_super+0x13ee/0x1ca0 fs/hfsplus/super.c:566
 mount_bdev+0x20a/0x2d0 fs/super.c:1659
 legacy_get_tree+0xee/0x190 fs/fs_context.c:662
 vfs_get_tree+0x90/0x2a0 fs/super.c:1780
 do_new_mount+0x2be/0xb40 fs/namespace.c:3352
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3875
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa7545cd79a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffe831f18d8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffe831f1930 RCX: 00007fa7545cd79a
RDX: 0000000020000000 RSI: 0000000020002900 RDI: 00007ffe831f1930
RBP: 0000000020002900 R08: 00007ffe831f1970 R09: 00000000000006c3
R10: 0000000002000010 R11: 0000000000000286 R12: 0000000020000000
R13: 00007ffe831f1970 R14: 00000000000006c9 R15: 00000000200022c0
 </TASK>
hfsplus: xattr search failed

Crashes (232):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/23 16:33 upstream 5f583a3162ff edc5149a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/03/13 22:36 upstream 61387b8dcf1d f919f202 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/09/22 23:36 upstream de5cb0dcb74c 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/09/19 05:41 upstream 4a39ac5b7d62 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/09/12 06:17 upstream 7c6a3a65ace7 d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/08/30 02:53 upstream d5d547aa7b51 9bd464fc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/08/18 19:24 upstream c3f2d783a459 dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/13 16:45 upstream a38297e3fb01 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/12 11:58 upstream cf87f46fd34d 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/12 06:55 upstream cf87f46fd34d 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/12 03:27 upstream cf87f46fd34d 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/09 20:19 upstream 45db3ab70092 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/09 15:23 upstream 45db3ab70092 05079661 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/02 05:50 upstream 0106679839f7 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/02 04:02 upstream 0106679839f7 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/01 11:08 upstream 18daea77cca6 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/05/01 05:54 upstream 50dffbf77180 9e0e6af1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in hfsplus_block_allocate
2024/05/01 02:06 upstream 50dffbf77180 9e0e6af1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in hfsplus_block_allocate
2024/04/30 00:47 upstream b947cc5bf6d7 f10afd69 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/04/29 18:27 upstream e67572cd2204 27e33c58 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/04/27 16:18 upstream 5eb4573ea63d 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/04/27 13:41 upstream 5eb4573ea63d 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/04/24 15:05 upstream 9d1ddab261f3 21339d7b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/04/23 06:14 upstream a2c63a3f3d68 36c961ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/02/21 18:08 upstream 9fc1ccccfd8d 3af7dd65 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in hfsplus_block_allocate
2024/02/19 01:50 upstream c02197fc9076 578f7538 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/01/20 19:12 upstream 125514880ddd 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/20 09:19 upstream 9d64bf433c53 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in hfsplus_block_allocate
2024/01/20 00:23 upstream 9d1694dc91ce 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/19 21:15 upstream 9d1694dc91ce 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/19 01:26 upstream 86c4d58a99ab 21772ce4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/18 04:08 upstream 1b1934dbbdcf 915053c7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/07 02:53 upstream 52b1853b080a d0304e9c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/05 08:48 upstream 5eff55d725a4 28c42cff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/04 21:02 upstream 5eff55d725a4 28c42cff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/03 23:22 upstream ac865f00af29 28c42cff .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/10/08 13:35 upstream 87d6aab2389e 402f1df0 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in hfsplus_block_allocate
2024/04/30 11:22 upstream 98369dccd2f8 3cb29304 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in hfsplus_block_allocate
2024/04/30 09:21 upstream 98369dccd2f8 f10afd69 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in hfsplus_block_allocate
2024/04/12 12:36 upstream 586b5dfb51b9 a154e056 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in hfsplus_block_allocate
2024/04/22 01:33 upstream 3b68086599f8 af24b050 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in hfsplus_block_allocate
2024/01/04 01:42 upstream ac865f00af29 28c42cff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in hfsplus_block_allocate
2024/07/16 17:59 linux-next 4f40be61af99 215bec2d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/06/08 07:44 linux-next d35b2284e966 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/05/13 05:41 linux-next 75fa778d74b7 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/04/12 11:35 linux-next 4118d9533ff3 27de0a5c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/04/02 22:41 linux-next c0b832517f62 7925100d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/04/02 17:53 linux-next c0b832517f62 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/04/02 17:52 linux-next c0b832517f62 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/01/14 05:30 linux-next 8d04a7e2ee3f 551587c1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/10/04 07:20 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
2024/04/03 10:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 7925100d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
2024/03/17 17:12 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
2022/11/29 13:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6d464646530f 05dc7993 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
* Struck through repros no longer work on HEAD.