loop0: detected capacity change from 0 to 64 syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=25903, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 25903, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=26319, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 26319, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=26320, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 26320, async page read ============================================ WARNING: possible recursive locking detected syzkaller #0 Not tainted -------------------------------------------- syz.0.0/5328 is trying to acquire lock: ffff88805422e0a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 but task is already holding lock: ffff88805422e0a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&tree->tree_lock/1); lock(&tree->tree_lock/1); *** DEADLOCK *** May be due to missing lock nesting notation locks held by syz.0.0/5328: 6, last CPU#0: #0: ffff8880455620f0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x118/0x160 fs/file.c:1408 #1: ffff888036d36460 (sb_writers#12){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2758 [inline] #1: ffff888036d36460 (sb_writers#12){.+.+}-{0:0}, at: vfs_write+0x22b/0xba0 fs/read_write.c:683 #2: ffff888054233040 (&sb->s_type->i_mutex_key#25){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1024 [inline] #2: ffff888054233040 (&sb->s_type->i_mutex_key#25){+.+.}-{4:4}, at: generic_file_write_iter+0x82/0x330 mm/filemap.c:4514 #3: ffff888054232ea0 (&HFS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfs_file_truncate+0x39b/0xb70 fs/hfs/extent.c:518 #4: ffff88805422e0a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 #5: ffff8880542340a0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680 fs/hfs/extent.c:403 stack backtrace: CPU: 0 UID: 0 PID: 5328 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_deadlock_bug+0x27a/0x290 kernel/locking/lockdep.c:3085 check_deadlock kernel/locking/lockdep.c:3137 [inline] validate_chain kernel/locking/lockdep.c:3939 [inline] __lock_acquire+0x25db/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 hfs_ext_read_extent fs/hfs/extent.c:206 [inline] hfs_extend_file+0x367/0x1680 fs/hfs/extent.c:407 hfs_bmap_reserve+0x108/0x430 fs/hfs/btree.c:402 __hfs_ext_write_extent+0x200/0x620 fs/hfs/extent.c:121 __hfs_ext_cache_extent+0x6e/0x9b0 fs/hfs/extent.c:180 hfs_file_truncate+0x4e6/0xb70 fs/hfs/extent.c:533 hfs_write_begin+0x178/0x1c0 fs/hfs/inode.c:66 generic_perform_write+0x2d5/0x8e0 mm/filemap.c:4374 generic_file_write_iter+0xae/0x330 mm/filemap.c:4517 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa0ee99f559 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa0ef8effe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fa0eec25fa0 RCX: 00007fa0ee99f559 RDX: 00000000fffffdef RSI: 0000200000000a40 RDI: 0000000000000004 RBP: 00007fa0eea36b20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fa0eec26038 R14: 00007fa0eec25fa0 R15: 00007ffd7316e978