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: 722d, last: 4h20m
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 205d 601d 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 672d 689d 0/1 upstream: reported on 2023/01/02 02:59
linux-5.15 possible deadlock in hfsplus_block_allocate (2) 1 109d 109d 0/3 auto-obsoleted due to no activity on 2024/11/11 18:00
linux-4.19 possible deadlock in hfsplus_block_allocate hfsplus 2 692d 699d 0/1 upstream: reported on 2022/12/22 13:15
linux-5.15 possible deadlock in hfsplus_block_allocate 18 246d 607d 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.12.0-rc7-syzkaller-00070-g0a9b9d17f3a7 #0 Not tainted
------------------------------------------------------
syz-executor116/5921 is trying to acquire lock:
ffff88807e31f0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x9e/0x8c0 fs/hfsplus/bitmap.c:35

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

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:5825
       __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+0x418/0xcd0 fs/buffer.c:2401
       filemap_read_folio+0x14b/0x630 mm/filemap.c:2367
       do_read_cache_folio+0x3f5/0x850 mm/filemap.c:3825
       do_read_cache_page+0x30/0x200 mm/filemap.c:3891
       read_mapping_page include/linux/pagemap.h:1005 [inline]
       hfsplus_block_allocate+0xee/0x8c0 fs/hfsplus/bitmap.c:37
       hfsplus_file_extend+0xade/0x1b70 fs/hfsplus/extents.c:469
       hfsplus_get_block+0x406/0x14f0 fs/hfsplus/extents.c:245
       __block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121
       block_write_begin fs/buffer.c:2231 [inline]
       cont_write_begin+0x6e2/0x9d0 fs/buffer.c:2582
       hfsplus_write_begin+0x68/0xb0 fs/hfsplus/inode.c:46
       cont_expand_zero fs/buffer.c:2509 [inline]
       cont_write_begin+0x338/0x9d0 fs/buffer.c:2572
       hfsplus_write_begin+0x68/0xb0 fs/hfsplus/inode.c:46
       generic_cont_expand_simple+0x18f/0x2b0 fs/buffer.c:2473
       hfsplus_setattr+0x16d/0x270 fs/hfsplus/inode.c:258
       notify_change+0xbca/0xe90 fs/attr.c:503
       do_truncate fs/open.c:65 [inline]
       do_ftruncate+0x462/0x580 fs/open.c:181
       do_sys_ftruncate fs/open.c:199 [inline]
       __do_sys_ftruncate fs/open.c:207 [inline]
       __se_sys_ftruncate fs/open.c:205 [inline]
       __x64_sys_ftruncate+0x95/0xf0 fs/open.c:205
       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:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
       __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:469
       hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358
       hfsplus_create_cat+0x1b0/0x1b70 fs/hfsplus/catalog.c:272
       hfsplus_fill_super+0x13ee/0x1ca0 fs/hfsplus/super.c:566
       mount_bdev+0x20a/0x2d0 fs/super.c:1693
       legacy_get_tree+0xee/0x190 fs/fs_context.c:662
       vfs_get_tree+0x90/0x2b0 fs/super.c:1814
       do_new_mount+0x2be/0xb40 fs/namespace.c:3507
       do_mount fs/namespace.c:3847 [inline]
       __do_sys_mount fs/namespace.c:4057 [inline]
       __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034
       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-executor116/5921:
 #0: ffff888143f980e0 (&type->s_umount_key#43/1){+.+.}-{3:3}, at: alloc_super+0x221/0x9d0 fs/super.c:344
 #1: ffff88807e31f198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_fill_super+0x1380/0x1ca0 fs/hfsplus/super.c:559
 #2: ffff8880316000b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 fs/hfsplus/bfind.c:28
 #3: ffff88805d4758c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x21b/0x1b70 fs/hfsplus/extents.c:458

stack backtrace:
CPU: 1 UID: 0 PID: 5921 Comm: syz-executor116 Not tainted 6.12.0-rc7-syzkaller-00070-g0a9b9d17f3a7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206
 check_prev_add kernel/locking/lockdep.c:3161 [inline]
 check_prevs_add kernel/locking/lockdep.c:3280 [inline]
 validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
 __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:469
 hfsplus_bmap_reserve+0x105/0x4e0 fs/hfsplus/btree.c:358
 hfsplus_create_cat+0x1b0/0x1b70 fs/hfsplus/catalog.c:272
 hfsplus_fill_super+0x13ee/0x1ca0 fs/hfsplus/super.c:566
 mount_bdev+0x20a/0x2d0 fs/super.c:1693
 legacy_get_tree+0xee/0x190 fs/fs_context.c:662
 vfs_get_tree+0x90/0x2b0 fs/super.c:1814
 do_new_mount+0x2be/0xb40 fs/namespace.c:3507
 do_mount fs/namespace.c:3847 [inline]
 __do_sys_mount fs/namespace.c:4057 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034
 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:0x7f59a0a5b76a
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:00007ffc479c28d8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc479c2930 RCX: 00007f59a0a5b76a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc479c2930
RBP: 0000000020000100 R08: 00007ffc479c2970 R09: 00000000000006e7
R10: 000000000180000c R11: 0000000000000286 R12: 0000000020000000
R13: 00007ffc479c2970 R14: 00000000000006ed R15: 0000000020000900
 </TASK>

Crashes (245):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/14 08:37 upstream 0a9b9d17f3a7 a8c99394 .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/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/11/18 20:43 upstream adc218676eef e7bb5d6e .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in hfsplus_block_allocate
2024/11/06 12:05 upstream 2e1b3cc9d7f7 3a465482 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in hfsplus_block_allocate
2024/10/26 13:32 upstream 850925a8133c 65e8686b .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in hfsplus_block_allocate
2024/10/19 22:25 upstream 3d5ad2d4eca3 cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in hfsplus_block_allocate
2024/10/19 08:42 upstream b04ae0f45168 cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root 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/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/11/21 02:00 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 7b1d1d4cfac0 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
2024/11/06 07:59 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 8936d33c1f69 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in hfsplus_block_allocate
2024/10/19 17:37 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci d2b1b3bccef6 cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 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.