loop1: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.8.0-rc5-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/3763 is trying to acquire lock: ffff88807c2b14a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 but task is already holding lock: ffff88802b6720b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&tree->tree_lock){+.+.}-{3:3}: lock_acquire+0x1e3/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_file_truncate+0x811/0xb50 fs/hfsplus/extents.c:595 hfsplus_delete_inode+0x174/0x220 hfsplus_unlink+0x512/0x790 fs/hfsplus/dir.c:405 vfs_unlink+0x365/0x600 fs/namei.c:4334 do_unlinkat+0x4ae/0x830 fs/namei.c:4398 __do_sys_unlink fs/namei.c:4446 [inline] __se_sys_unlink fs/namei.c:4444 [inline] __x64_sys_unlink+0x49/0x60 fs/namei.c:4444 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 -> #2 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1e3/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+0x426/0xe20 fs/buffer.c:2382 read_pages+0x5ff/0x840 mm/readahead.c:180 page_cache_ra_unbounded+0x68e/0x7c0 mm/readahead.c:269 page_cache_sync_readahead include/linux/pagemap.h:1300 [inline] filemap_get_pages+0x49c/0x2090 mm/filemap.c:2498 filemap_read+0x41b/0xec0 mm/filemap.c:2594 __kernel_read+0x5c7/0xab0 fs/read_write.c:434 integrity_kernel_read+0xb0/0x100 security/integrity/iint.c:221 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xadb/0x1b30 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x554/0xb40 security/integrity/ima/ima_api.c:290 process_measurement+0x136d/0x21d0 security/integrity/ima/ima_main.c:359 ima_file_check+0xf1/0x170 security/integrity/ima/ima_main.c:557 do_open fs/namei.c:3643 [inline] path_openat+0x28b6/0x3240 fs/namei.c:3798 do_filp_open+0x234/0x490 fs/namei.c:3825 do_sys_openat2+0x13e/0x1d0 fs/open.c:1404 do_sys_open fs/open.c:1419 [inline] __do_sys_openat fs/open.c:1435 [inline] __se_sys_openat fs/open.c:1430 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1430 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 -> #1 (mapping.invalidate_lock#9){.+.+}-{3:3}: lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:857 [inline] filemap_fault+0x646/0x1680 mm/filemap.c:3237 __do_fault+0x135/0x460 mm/memory.c:4376 do_read_fault mm/memory.c:4738 [inline] do_fault mm/memory.c:4868 [inline] do_pte_missing mm/memory.c:3745 [inline] handle_pte_fault mm/memory.c:5144 [inline] __handle_mm_fault+0x49e6/0x72d0 mm/memory.c:5285 handle_mm_fault+0x27e/0x770 mm/memory.c:5450 do_user_addr_fault arch/x86/mm/fault.c:1415 [inline] handle_page_fault arch/x86/mm/fault.c:1507 [inline] exc_page_fault+0x2ad/0x870 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 strncpy_from_user+0x111/0x2f0 lib/strncpy_from_user.c:139 getname_flags+0xf9/0x4f0 fs/namei.c:151 do_sys_openat2+0xd2/0x1d0 fs/open.c:1398 do_sys_open fs/open.c:1419 [inline] __do_sys_openat fs/open.c:1435 [inline] __se_sys_openat fs/open.c:1430 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1430 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 down_read_killable+0xca/0xd20 kernel/locking/rwsem.c:1549 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 get_mmap_lock_carefully mm/memory.c:5486 [inline] lock_mm_and_find_vma+0x2a1/0x2e0 mm/memory.c:5537 do_user_addr_fault arch/x86/mm/fault.c:1387 [inline] handle_page_fault arch/x86/mm/fault.c:1507 [inline] exc_page_fault+0x1b3/0x870 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir64+0x2a5/0x6a0 fs/readdir.c:371 dir_emit_dot include/linux/fs.h:3481 [inline] hfsplus_readdir+0x499/0x1320 fs/hfsplus/dir.c:159 iterate_dir+0x539/0x6f0 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:409 [inline] __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:394 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &HFSPLUS_I(inode)->extents_lock --> &tree->tree_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock); rlock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.1/3763: #0: ffff88804c55a348 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x258/0x320 fs/file.c:1191 #1: ffff888039462b80 (&type->i_mutex_dir_key#9){++++}-{3:3}, at: iterate_dir+0x436/0x6f0 fs/readdir.c:103 #2: ffff88802b6720b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 0 PID: 3763 Comm: syz-executor.1 Not tainted 6.8.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106 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+0x18ca/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754 down_read_killable+0xca/0xd20 kernel/locking/rwsem.c:1549 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 get_mmap_lock_carefully mm/memory.c:5486 [inline] lock_mm_and_find_vma+0x2a1/0x2e0 mm/memory.c:5537 do_user_addr_fault arch/x86/mm/fault.c:1387 [inline] handle_page_fault arch/x86/mm/fault.c:1507 [inline] exc_page_fault+0x1b3/0x870 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:filldir64+0x2a5/0x6a0 fs/readdir.c:375 Code: 8a ff 4c 89 f7 48 89 de e8 18 93 8a ff 49 01 df 0f 88 5a 02 00 00 49 39 df 0f 82 51 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 60 <48> 89 43 08 48 8b 4c 24 10 48 8b 44 24 58 48 89 01 48 8b 44 24 18 RSP: 0018:ffffc90004cd7880 EFLAGS: 00050206 RAX: 0000000000000000 RBX: 0000000020002140 RCX: ffff88802382bb80 RDX: 0000000000000000 RSI: 0000000020002140 RDI: 0000000020002158 RBP: 0000000000000000 R08: ffffffff8208db38 R09: 0000000000000004 R10: 0000000000000002 R11: ffffffff8208d8b0 R12: ffffffff8bc0ee60 R13: 0000000000000001 R14: 0000000020002158 R15: 0000000020002158 dir_emit_dot include/linux/fs.h:3481 [inline] hfsplus_readdir+0x499/0x1320 fs/hfsplus/dir.c:159 iterate_dir+0x539/0x6f0 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:409 [inline] __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:394 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7fe09b47dda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe09c26d0c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007fe09b5abf80 RCX: 00007fe09b47dda9 RDX: 0000000000001009 RSI: 0000000020002140 RDI: 0000000000000003 RBP: 00007fe09b4ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fe09b5abf80 R15: 00007fff23fe2f68 ---------------- Code disassembly (best guess): 0: 8a ff mov %bh,%bh 2: 4c 89 f7 mov %r14,%rdi 5: 48 89 de mov %rbx,%rsi 8: e8 18 93 8a ff call 0xff8a9325 d: 49 01 df add %rbx,%r15 10: 0f 88 5a 02 00 00 js 0x270 16: 49 39 df cmp %rbx,%r15 19: 0f 82 51 02 00 00 jb 0x270 1f: 0f 01 cb stac 22: 0f ae e8 lfence 25: 48 8b 44 24 60 mov 0x60(%rsp),%rax * 2a: 48 89 43 08 mov %rax,0x8(%rbx) <-- trapping instruction 2e: 48 8b 4c 24 10 mov 0x10(%rsp),%rcx 33: 48 8b 44 24 58 mov 0x58(%rsp),%rax 38: 48 89 01 mov %rax,(%rcx) 3b: 48 8b 44 24 18 mov 0x18(%rsp),%rax