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: 545d, last: 14d
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 (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in hfsplus_block_allocate 26 27d 423d 0/3 upstream: reported on 2023/03/30 21:16
linux-4.14 possible deadlock in hfsplus_block_allocate hfsplus 2 494d 511d 0/1 upstream: reported on 2023/01/02 02:59
linux-4.19 possible deadlock in hfsplus_block_allocate hfsplus 2 514d 522d 0/1 upstream: reported on 2022/12/22 13:15
linux-5.15 possible deadlock in hfsplus_block_allocate 18 69d 429d 0/3 upstream: reported on 2023/03/24 22:08
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/03/31 17:50 18m retest repro upstream error OK

Sample crash report:
loop0: detected capacity change from 0 to 1024
======================================================
WARNING: possible circular locking dependency detected
6.8.0-syzkaller-05562-g61387b8dcf1d #0 Not tainted
------------------------------------------------------
syz-executor170/6261 is trying to acquire lock:
ffff88807f2b10f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x9e/0x8c0 fs/hfsplus/bitmap.c:35

but task is already holding lock:
ffff88807f19df88 (&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+0x1e4/0x530 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:2384
       filemap_read_folio+0x1a0/0x790 mm/filemap.c:2324
       do_read_cache_folio+0x134/0x820 mm/filemap.c:3694
       do_read_cache_page+0x30/0x200 mm/filemap.c:3760
       read_mapping_page include/linux/pagemap.h:888 [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:2105
       __block_write_begin fs/buffer.c:2154 [inline]
       block_write_begin+0x9b/0x1e0 fs/buffer.c:2213
       cont_write_begin+0x645/0x890 fs/buffer.c:2567
       hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
       cont_expand_zero fs/buffer.c:2527 [inline]
       cont_write_begin+0x6ee/0x890 fs/buffer.c:2557
       hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
       generic_cont_expand_simple+0x18f/0x2b0 fs/buffer.c:2458
       hfsplus_setattr+0x178/0x280 fs/hfsplus/inode.c:259
       notify_change+0xb9d/0xe70 fs/attr.c:497
       do_truncate fs/open.c:65 [inline]
       do_ftruncate+0x46b/0x590 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_64+0xfb/0x240
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

-> #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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1e4/0x530 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_get_block+0x406/0x14f0 fs/hfsplus/extents.c:245
       __block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2105
       __block_write_begin fs/buffer.c:2154 [inline]
       block_write_begin+0x9b/0x1e0 fs/buffer.c:2213
       cont_write_begin+0x645/0x890 fs/buffer.c:2567
       hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
       cont_expand_zero fs/buffer.c:2494 [inline]
       cont_write_begin+0x319/0x890 fs/buffer.c:2557
       hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
       generic_perform_write+0x322/0x640 mm/filemap.c:3921
       generic_file_write_iter+0xaf/0x310 mm/filemap.c:4042
       do_iter_readv_writev+0x5a4/0x800
       vfs_writev+0x395/0xbb0 fs/read_write.c:971
       do_pwritev fs/read_write.c:1072 [inline]
       __do_sys_pwritev2 fs/read_write.c:1131 [inline]
       __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
       do_syscall_64+0xfb/0x240
       entry_SYSCALL_64_after_hwframe+0x6d/0x75

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 ***

3 locks held by syz-executor170/6261:
 #0: ffff88806d1ea420 (sb_writers#11){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2853 [inline]
 #0: ffff88806d1ea420 (sb_writers#11){.+.+}-{0:0}, at: vfs_writev+0x2d9/0xbb0 fs/read_write.c:969
 #1: ffff88807f19e180 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:793 [inline]
 #1: ffff88807f19e180 (&sb->s_type->i_mutex_key#17){+.+.}-{3:3}, at: generic_file_write_iter+0x83/0x310 mm/filemap.c:4039
 #2: ffff88807f19df88 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x21b/0x1b70 fs/hfsplus/extents.c:457

stack backtrace:
CPU: 1 PID: 6261 Comm: syz-executor170 Not tainted 6.8.0-syzkaller-05562-g61387b8dcf1d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1e4/0x530 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_get_block+0x406/0x14f0 fs/hfsplus/extents.c:245
 __block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2105
 __block_write_begin fs/buffer.c:2154 [inline]
 block_write_begin+0x9b/0x1e0 fs/buffer.c:2213
 cont_write_begin+0x645/0x890 fs/buffer.c:2567
 hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
 cont_expand_zero fs/buffer.c:2494 [inline]
 cont_write_begin+0x319/0x890 fs/buffer.c:2557
 hfsplus_write_begin+0x8a/0xd0 fs/hfsplus/inode.c:47
 generic_perform_write+0x322/0x640 mm/filemap.c:3921
 generic_file_write_iter+0xaf/0x310 mm/filemap.c:4042
 do_iter_readv_writev+0x5a4/0x800
 vfs_writev+0x395/0xbb0 fs/read_write.c:971
 do_pwritev fs/read_write.c:1072 [inline]
 __do_sys_pwritev2 fs/read_write.c:1131 [inline]
 __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122
 do_syscall_64+0xfb/0x240
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7fe7ed3c9299
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 1f 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd9249b938 EFLAGS: 00000216 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fe7ed3c9299
RDX: 0000000000000001 RSI: 00000000200001c0 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000007fff R11: 0000000000000216 R12: 00007ffd9249b978
R13: 0000000000000473 R14: 00007ffd9249b9b0 R15: 431bde82d7b634db
 </TASK>

Crashes (219):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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/01/03 19:33 upstream 610a9b8f49fb 28c42cff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in hfsplus_block_allocate
2024/01/02 23:36 upstream 610a9b8f49fb fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2024/01/01 09:55 upstream 610a9b8f49fb fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2023/12/31 22:47 upstream 2639772a11c8 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in hfsplus_block_allocate
2023/12/11 06:20 upstream a39b6ac3781d 28b24332 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in hfsplus_block_allocate
2023/11/28 05:15 upstream df60cee26a2e 7ec6c044 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2023/11/28 03:28 upstream 2cc14f52aeb7 7ec6c044 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2023/11/27 22:48 upstream 2cc14f52aeb7 7ec6c044 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2023/11/27 11:11 upstream 2cc14f52aeb7 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in hfsplus_block_allocate
2023/11/24 00:43 upstream d3fa86b1a7b4 fc59b78e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in hfsplus_block_allocate
2023/11/23 16:20 upstream 9b6de136b5f0 fc59b78e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in hfsplus_block_allocate
2023/11/23 15:14 upstream 9b6de136b5f0 fc59b78e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in hfsplus_block_allocate
2023/11/23 00:11 upstream 9b6de136b5f0 03e12510 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-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
2023/12/31 21:00 upstream 2639772a11c8 fb427a07 .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/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/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
2023/12/31 19:55 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci aafe7ad77b91 fb427a07 .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.