====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc2-syzkaller-00010-g69b41ac87e4a #0 Not tainted ------------------------------------------------------ syz-executor.2/17006 is trying to acquire lock: ffff88801b00e0b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 but task is already holding lock: ffff888064c71478 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0x97/0xae0 fs/hfs/extent.c:397 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_extend_file+0x97/0xae0 fs/hfs/extent.c:397 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 __hfs_ext_write_extent+0x3c1/0x510 fs/hfs/extent.c:121 __hfs_ext_cache_extent fs/hfs/extent.c:174 [inline] hfs_ext_read_extent+0x81c/0xa20 fs/hfs/extent.c:202 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_get_block+0x17f/0x820 fs/hfs/extent.c:353 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0xb9/0x4d0 fs/buffer.c:2102 cont_write_begin+0x534/0x740 fs/buffer.c:2456 hfs_write_begin+0x87/0x150 fs/hfs/inode.c:58 generic_perform_write+0x256/0x570 mm/filemap.c:3772 __generic_file_write_iter+0x2ae/0x500 mm/filemap.c:3900 generic_file_write_iter+0xe3/0x350 mm/filemap.c:3932 call_write_iter include/linux/fs.h:2186 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x12b/0x250 fs/read_write.c:637 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 -> #0 (&tree->tree_lock/1){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x18d/0xa20 fs/hfs/extent.c:200 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 hfs_cat_create+0x208/0xaa0 fs/hfs/catalog.c:104 hfs_create+0x6b/0xf0 fs/hfs/dir.c:202 lookup_open.isra.0+0xee7/0x1270 fs/namei.c:3413 open_last_lookups fs/namei.c:3481 [inline] path_openat+0x975/0x2a50 fs/namei.c:3711 do_filp_open+0x1ba/0x410 fs/namei.c:3741 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_compat_sys_open fs/open.c:1377 [inline] __se_compat_sys_open fs/open.c:1375 [inline] __ia32_compat_sys_open+0x11d/0x1c0 fs/open.c:1375 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); lock(&HFS_I(tree->inode)->extents_lock); lock(&tree->tree_lock/1); *** DEADLOCK *** 4 locks held by syz-executor.2/17006: #0: ffff888044134460 (sb_writers#14){.+.+}-{0:0}, at: open_last_lookups fs/namei.c:3470 [inline] #0: ffff888044134460 (sb_writers#14){.+.+}-{0:0}, at: path_openat+0x2a25/0x2a50 fs/namei.c:3711 #1: ffff888064c70fa8 (&type->i_mutex_dir_key#9){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline] #1: ffff888064c70fa8 (&type->i_mutex_dir_key#9){+.+.}-{3:3}, at: open_last_lookups fs/namei.c:3478 [inline] #1: ffff888064c70fa8 (&type->i_mutex_dir_key#9){+.+.}-{3:3}, at: path_openat+0x90f/0x2a50 fs/namei.c:3711 #2: ffff8880649920b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfs_find_init+0x1c9/0x240 fs/hfs/bfind.c:30 #3: ffff888064c71478 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0x97/0xae0 fs/hfs/extent.c:397 stack backtrace: CPU: 2 PID: 17006 Comm: syz-executor.2 Not tainted 6.2.0-rc2-syzkaller-00010-g69b41ac87e4a #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177 check_prev_add kernel/locking/lockdep.c:3097 [inline] check_prevs_add kernel/locking/lockdep.c:3216 [inline] validate_chain kernel/locking/lockdep.c:3831 [inline] __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055 lock_acquire kernel/locking/lockdep.c:5668 [inline] lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633 __mutex_lock_common kernel/locking/mutex.c:603 [inline] __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747 hfs_find_init+0x182/0x240 fs/hfs/bfind.c:33 hfs_ext_read_extent+0x18d/0xa20 fs/hfs/extent.c:200 hfs_extend_file+0x4b5/0xae0 fs/hfs/extent.c:401 hfs_bmap_reserve+0x29f/0x380 fs/hfs/btree.c:234 hfs_cat_create+0x208/0xaa0 fs/hfs/catalog.c:104 hfs_create+0x6b/0xf0 fs/hfs/dir.c:202 lookup_open.isra.0+0xee7/0x1270 fs/namei.c:3413 open_last_lookups fs/namei.c:3481 [inline] path_openat+0x975/0x2a50 fs/namei.c:3711 do_filp_open+0x1ba/0x410 fs/namei.c:3741 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_compat_sys_open fs/open.c:1377 [inline] __se_compat_sys_open fs/open.c:1375 [inline] __ia32_compat_sys_open+0x11d/0x1c0 fs/open.c:1375 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f3f549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7f195cc EFLAGS: 00000296 ORIG_RAX: 0000000000000005 RAX: ffffffffffffffda RBX: 0000000020000180 RCX: 000000000004c37e RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi