syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=64, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 64, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=65, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 65, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=66, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 66, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=67, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 67, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=68, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 68, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=69, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 69, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=70, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 70, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=64, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 64, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=65, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 65, async page read syz.0.0: attempt to access beyond end of device loop0: rw=8388608, sector=66, nr_sectors = 1 limit=64 Buffer I/O error on dev loop0, logical block 66, async page read ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.0/5354 is trying to acquire lock: ffff8880548d80a0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680 fs/hfs/extent.c:403 but task is already holding lock: ffff8880147d20a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&tree->tree_lock/1){+.+.}-{4:4}: __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_cat_create+0x23d/0x870 fs/hfs/catalog.c:104 hfs_create+0x78/0xe0 fs/hfs/dir.c:196 lookup_open+0x102d/0x1ae0 fs/namei.c:4575 open_last_lookups fs/namei.c:4774 [inline] path_openat+0x70c/0x20f0 fs/namei.c:5013 do_file_open+0x23e/0x4a0 fs/namei.c:5045 do_sys_openat2+0x115/0x200 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_sys_openat fs/open.c:1465 [inline] __se_sys_openat fs/open.c:1460 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&HFS_I(tree->inode)->extents_lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/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_extend_file+0xf9/0x1680 fs/hfs/extent.c:403 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_ext_read_extent fs/hfs/extent.c:208 [inline] hfs_extend_file+0x3ad/0x1680 fs/hfs/extent.c:407 hfs_get_block+0x401/0xbf0 fs/hfs/extent.c:359 __block_write_begin_int+0x6c1/0x1930 fs/buffer.c:2043 block_write_begin fs/buffer.c:2157 [inline] cont_write_begin+0x71b/0xac0 fs/buffer.c:2519 hfs_write_begin+0x123/0x1c0 fs/hfs/inode.c:62 generic_perform_write+0x2d5/0x8e0 mm/filemap.c:4392 generic_file_write_iter+0xae/0x330 mm/filemap.c:4535 iter_file_splice_write+0x9f9/0x11c0 fs/splice.c:660 do_splice_from fs/splice.c:863 [inline] direct_splice_actor+0x101/0x160 fs/splice.c:1114 splice_direct_to_actor+0x57b/0xcb0 fs/splice.c:1023 do_splice_direct_actor fs/splice.c:1157 [inline] do_splice_direct+0x195/0x290 fs/splice.c:1183 do_sendfile+0x52e/0x7c0 fs/read_write.c:1351 __do_sys_sendfile64 fs/read_write.c:1412 [inline] __se_sys_sendfile64+0x144/0x1a0 fs/read_write.c:1398 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); *** DEADLOCK *** locks held by syz.0.0/5354: 4, on CPU#0: #0: ffff888013e40478 (sb_writers#12){.+.+}-{0:0}, at: direct_splice_actor+0x49/0x160 fs/splice.c:1113 #1: ffff8880548d7040 (&sb->s_type->i_mutex_key#24){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1027 [inline] #1: ffff8880548d7040 (&sb->s_type->i_mutex_key#24){+.+.}-{4:4}, at: generic_file_write_iter+0x82/0x330 mm/filemap.c:4532 #2: ffff8880548d6ea0 (&HFS_I(inode)->extents_lock){+.+.}-{4:4}, at: hfs_extend_file+0xf9/0x1680 fs/hfs/extent.c:403 #3: ffff8880147d20a8 (&tree->tree_lock/1){+.+.}-{4:4}, at: hfs_find_init+0x18d/0x300 fs/hfs/bfind.c:-1 stack backtrace: CPU: 0 UID: 0 PID: 5354 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_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/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_extend_file+0xf9/0x1680 fs/hfs/extent.c:403 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_ext_read_extent fs/hfs/extent.c:208 [inline] hfs_extend_file+0x3ad/0x1680 fs/hfs/extent.c:407 hfs_get_block+0x401/0xbf0 fs/hfs/extent.c:359 __block_write_begin_int+0x6c1/0x1930 fs/buffer.c:2043 block_write_begin fs/buffer.c:2157 [inline] cont_write_begin+0x71b/0xac0 fs/buffer.c:2519 hfs_write_begin+0x123/0x1c0 fs/hfs/inode.c:62 generic_perform_write+0x2d5/0x8e0 mm/filemap.c:4392 generic_file_write_iter+0xae/0x330 mm/filemap.c:4535 iter_file_splice_write+0x9f9/0x11c0 fs/splice.c:660 do_splice_from fs/splice.c:863 [inline] direct_splice_actor+0x101/0x160 fs/splice.c:1114 splice_direct_to_actor+0x57b/0xcb0 fs/splice.c:1023 do_splice_direct_actor fs/splice.c:1157 [inline] do_splice_direct+0x195/0x290 fs/splice.c:1183 do_sendfile+0x52e/0x7c0 fs/read_write.c:1351 __do_sys_sendfile64 fs/read_write.c:1412 [inline] __se_sys_sendfile64+0x144/0x1a0 fs/read_write.c:1398 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f9ddb9a94d9 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:00007f9ddc7aafe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007f9ddbc26180 RCX: 00007f9ddb9a94d9 RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000007 RBP: 00007f9ddba3804e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020fffe82 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f9ddbc26218 R14: 00007f9ddbc26180 R15: 00007ffe0e3795b8