syzbot


possible deadlock in hfsplus_block_allocate (2)

Status: upstream: reported C repro on 2024/12/07 22:33
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+03a0802a8f4ab6fd5607@syzkaller.appspotmail.com
First crash: 319d, last: 8d17h
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2024/12/08 upstream (ToT) 7503345ac5f5 C [report] possible deadlock in hfsplus_block_allocate
Similar bugs (7)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in hfsplus_block_allocate 4 26 541d 937d 0/3 auto-obsoleted due to no activity on 2024/08/08 03:24
linux-4.14 possible deadlock in hfsplus_block_allocate hfsplus 4 2 1008d 1025d 0/1 upstream: reported on 2023/01/02 02:59
linux-5.15 possible deadlock in hfsplus_block_allocate (3) origin:upstream 4 C error 3 22d 282d 0/3 upstream: reported C repro on 2025/01/14 13:47
upstream possible deadlock in hfsplus_block_allocate hfs 4 C done 347 15h40m 1059d 0/29 upstream: reported C repro on 2022/11/29 13:38
linux-5.15 possible deadlock in hfsplus_block_allocate (2) 4 1 445d 445d 0/3 auto-obsoleted due to no activity on 2024/11/11 18:00
linux-4.19 possible deadlock in hfsplus_block_allocate hfsplus 4 2 1028d 1036d 0/1 upstream: reported on 2022/12/22 13:15
linux-5.15 possible deadlock in hfsplus_block_allocate 4 18 583d 943d 0/3 auto-obsoleted due to no activity on 2024/06/27 07:36
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/02/16 15:57 17m bisect fix linux-6.1.y error job log
2025/01/17 03:12 2h17m bisect fix linux-6.1.y OK (0) job log log

Sample crash report:
loop0: detected capacity change from 0 to 1024
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.20/4491 is trying to acquire lock:
ffff0000d230a0f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x88/0x7d8 fs/hfsplus/bitmap.c:35

but task is already holding lock:
ffff0000dc949c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x180/0x1324 fs/hfsplus/extents.c:455

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}:
       __mutex_lock_common+0x190/0x1f38 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
       hfsplus_get_block+0x2bc/0x1154 fs/hfsplus/extents.c:260
       block_read_full_folio+0x2e4/0x97c fs/buffer.c:2271
       hfsplus_read_folio+0x28/0x38 fs/hfsplus/inode.c:28
       filemap_read_folio+0x130/0x37c mm/filemap.c:2490
       do_read_cache_folio+0x24c/0x544 mm/filemap.c:3627
       do_read_cache_page mm/filemap.c:3669 [inline]
       read_cache_page+0x6c/0x184 mm/filemap.c:3678
       read_mapping_page include/linux/pagemap.h:791 [inline]
       hfsplus_block_allocate+0xdc/0x7d8 fs/hfsplus/bitmap.c:37
       hfsplus_file_extend+0x73c/0x1324 fs/hfsplus/extents.c:466
       hfsplus_get_block+0x314/0x1154 fs/hfsplus/extents.c:245
       __block_write_begin_int+0x34c/0x13b8 fs/buffer.c:1991
       __block_write_begin fs/buffer.c:2041 [inline]
       block_write_begin fs/buffer.c:2102 [inline]
       cont_write_begin+0x548/0x780 fs/buffer.c:2456
       hfsplus_write_begin+0x98/0xe4 fs/hfsplus/inode.c:52
       generic_perform_write+0x230/0x4b0 mm/filemap.c:3846
       __generic_file_write_iter+0x168/0x37c mm/filemap.c:3974
       generic_file_write_iter+0xb4/0x2b0 mm/filemap.c:4006
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x5ac/0x7c4 fs/read_write.c:584
       ksys_write+0x120/0x210 fs/read_write.c:637
       __do_sys_write fs/read_write.c:649 [inline]
       __se_sys_write fs/read_write.c:646 [inline]
       __arm64_sys_write+0x7c/0x90 fs/read_write.c:646
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #0 (&sbi->alloc_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain kernel/locking/lockdep.c:3825 [inline]
       __lock_acquire+0x293c/0x6544 kernel/locking/lockdep.c:5049
       lock_acquire+0x20c/0x644 kernel/locking/lockdep.c:5662
       __mutex_lock_common+0x190/0x1f38 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
       hfsplus_block_allocate+0x88/0x7d8 fs/hfsplus/bitmap.c:35
       hfsplus_file_extend+0x73c/0x1324 fs/hfsplus/extents.c:466
       hfsplus_bmap_reserve+0xe8/0x494 fs/hfsplus/btree.c:358
       hfsplus_create_cat+0x170/0xdd4 fs/hfsplus/catalog.c:272
       hfsplus_fill_super+0xf88/0x16c0 fs/hfsplus/super.c:560
       mount_bdev+0x264/0x358 fs/super.c:1443
       hfsplus_mount+0x44/0x58 fs/hfsplus/super.c:641
       legacy_get_tree+0xd4/0x16c fs/fs_context.c:632
       vfs_get_tree+0x90/0x274 fs/super.c:1573
       do_new_mount+0x228/0x810 fs/namespace.c:3069
       path_mount+0x5b4/0xe78 fs/namespace.c:3399
       do_mount fs/namespace.c:3412 [inline]
       __do_sys_mount fs/namespace.c:3620 [inline]
       __se_sys_mount fs/namespace.c:3597 [inline]
       __arm64_sys_mount+0x49c/0x584 fs/namespace.c:3597
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
       do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
       el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

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.0.20/4491:
 #0: ffff0000d62ba0e0 (&type->s_umount_key#50/1){+.+.}-{3:3}, at: alloc_super+0x1a4/0x804 fs/super.c:228
 #1: ffff0000d230a198 (&sbi->vh_mutex){+.+.}-{3:3}, at: hfsplus_fill_super+0xf2c/0x16c0 fs/hfsplus/super.c:553
 #2: ffff0000d614a0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x144/0x1bc fs/hfsplus/bfind.c:28
 #3: ffff0000dc949c08 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x180/0x1324 fs/hfsplus/extents.c:455

stack backtrace:
CPU: 1 PID: 4491 Comm: syz.0.20 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/30/2025
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack+0x30/0x40 lib/dump_stack.c:88
 dump_stack_lvl+0xf8/0x160 lib/dump_stack.c:106
 dump_stack+0x1c/0x5c lib/dump_stack.c:113
 print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2048
 check_noncircular+0x240/0x2d4 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain kernel/locking/lockdep.c:3825 [inline]
 __lock_acquire+0x293c/0x6544 kernel/locking/lockdep.c:5049
 lock_acquire+0x20c/0x644 kernel/locking/lockdep.c:5662
 __mutex_lock_common+0x190/0x1f38 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
 hfsplus_block_allocate+0x88/0x7d8 fs/hfsplus/bitmap.c:35
 hfsplus_file_extend+0x73c/0x1324 fs/hfsplus/extents.c:466
 hfsplus_bmap_reserve+0xe8/0x494 fs/hfsplus/btree.c:358
 hfsplus_create_cat+0x170/0xdd4 fs/hfsplus/catalog.c:272
 hfsplus_fill_super+0xf88/0x16c0 fs/hfsplus/super.c:560
 mount_bdev+0x264/0x358 fs/super.c:1443
 hfsplus_mount+0x44/0x58 fs/hfsplus/super.c:641
 legacy_get_tree+0xd4/0x16c fs/fs_context.c:632
 vfs_get_tree+0x90/0x274 fs/super.c:1573
 do_new_mount+0x228/0x810 fs/namespace.c:3069
 path_mount+0x5b4/0xe78 fs/namespace.c:3399
 do_mount fs/namespace.c:3412 [inline]
 __do_sys_mount fs/namespace.c:3620 [inline]
 __se_sys_mount fs/namespace.c:3597 [inline]
 __arm64_sys_mount+0x49c/0x584 fs/namespace.c:3597
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x138 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/14 20:52 linux-6.1.y 882efbdd9d34 b6605ba8 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2025/10/13 00:56 linux-6.1.y 882efbdd9d34 ff1712fe .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2024/12/07 22:33 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2025/10/12 23:52 linux-6.1.y 882efbdd9d34 ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2025/06/03 20:56 linux-6.1.y da3c5173c55f a30356b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2025/03/22 23:30 linux-6.1.y 344a09659766 c6512ef7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
2025/03/22 23:28 linux-6.1.y 344a09659766 c6512ef7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_block_allocate
* Struck through repros no longer work on HEAD.