loop3: detected capacity change from 0 to 1024 ====================================================== WARNING: possible circular locking dependency detected 6.3.0-rc6-syzkaller-00188-g3e7bb4f24617 #0 Not tainted ------------------------------------------------------ syz-executor.3/22740 is trying to acquire lock: ffff88801246a598 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:117 [inline] ffff88801246a598 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] ffff88801246a598 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1498 [inline] ffff88801246a598 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 but task is already holding lock: ffff8880789ac0b0 (&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+0x1e1/0x520 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_file_truncate+0x811/0xb40 fs/hfsplus/extents.c:595 hfsplus_file_release+0xf7/0x3e0 fs/hfsplus/inode.c:238 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}: lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_get_block+0x383/0x14e0 fs/hfsplus/extents.c:260 block_read_full_folio+0x47b/0x1000 fs/buffer.c:2319 read_pages+0x5fa/0x830 mm/readahead.c:181 page_cache_ra_unbounded+0x697/0x7c0 mm/readahead.c:270 page_cache_sync_readahead include/linux/pagemap.h:1214 [inline] filemap_get_pages+0x49c/0x20c0 mm/filemap.c:2598 filemap_read+0x45a/0x1170 mm/filemap.c:2693 __kernel_read+0x422/0x8a0 fs/read_write.c:428 integrity_kernel_read+0xb0/0xf0 security/integrity/iint.c:199 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+0xa5b/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x3a7/0x880 security/integrity/ima/ima_api.c:293 process_measurement+0xfdb/0x1ce0 security/integrity/ima/ima_main.c:341 ima_file_check+0xf1/0x170 security/integrity/ima/ima_main.c:539 do_open fs/namei.c:3562 [inline] path_openat+0x280a/0x3170 fs/namei.c:3715 do_filp_open+0x234/0x490 fs/namei.c:3742 do_sys_openat2+0x13f/0x500 fs/open.c:1348 do_sys_open fs/open.c:1364 [inline] __do_sys_open fs/open.c:1372 [inline] __se_sys_open fs/open.c:1368 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1368 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 (mapping.invalidate_lock#5){.+.+}-{3:3}: lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:813 [inline] filemap_fault+0x644/0x1800 mm/filemap.c:3274 __do_fault+0x136/0x500 mm/memory.c:4155 do_read_fault mm/memory.c:4506 [inline] do_fault mm/memory.c:4635 [inline] handle_pte_fault mm/memory.c:4923 [inline] __handle_mm_fault mm/memory.c:5065 [inline] handle_mm_fault+0x3357/0x51c0 mm/memory.c:5211 faultin_page mm/gup.c:925 [inline] __get_user_pages+0x512/0x1180 mm/gup.c:1147 populate_vma_page_range+0x2c7/0x3b0 mm/gup.c:1543 __mm_populate+0x279/0x450 mm/gup.c:1652 mm_populate include/linux/mm.h:3026 [inline] vm_mmap_pgoff+0x22f/0x2e0 mm/util.c:547 ksys_mmap_pgoff+0x4f9/0x6d0 mm/mmap.c:1410 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:117 [inline] do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir+0x326/0x720 fs/readdir.c:254 dir_emit include/linux/fs.h:3140 [inline] hfsplus_readdir+0xcb8/0x1300 fs/hfsplus/dir.c:248 iterate_dir+0x228/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1ef/0x4c0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd 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); lock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.3/22740: #0: ffff88801da66ae8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x254/0x2f0 fs/file.c:1047 #1: ffff88807883f5c0 (&type->i_mutex_dir_key#10){++++}-{3:3}, at: iterate_dir+0x10e/0x570 fs/readdir.c:55 #2: ffff8880789ac0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 1 PID: 22740 Comm: syz-executor.3 Not tainted 6.3.0-rc6-syzkaller-00188-g3e7bb4f24617 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:117 [inline] do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:filldir+0x326/0x720 fs/readdir.c:255 Code: 45 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 30 49 89 44 24 08 48 8b 4c 24 08 48 8b 44 24 58 48 89 01 48 8b 44 24 20 8b 54 24 3c <66> 89 41 10 48 98 88 54 01 ff 48 89 44 24 30 49 63 ee c6 44 29 12 RSP: 0018:ffffc90003d7f8a8 EFLAGS: 00050206 RAX: 0000000000000020 RBX: 00007fffffffefc8 RCX: 0000000020001ff0 RDX: 0000000000000008 RSI: 0000000020001fd8 RDI: 00007fffffffefc8 RBP: 0000000000000038 R08: ffffffff81f4fcff R09: ffffed100ed1a751 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000020001fd8 R13: ffffc90003d7fe70 R14: 0000000000000009 R15: ffff88807b612000 dir_emit include/linux/fs.h:3140 [inline] hfsplus_readdir+0xcb8/0x1300 fs/hfsplus/dir.c:248 iterate_dir+0x228/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1ef/0x4c0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f2a8be8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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:00007f2a8a9fe168 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007f2a8bfabf80 RCX: 00007f2a8be8c169 RDX: 00000000000000b8 RSI: 0000000020001fc0 RDI: 0000000000000004 RBP: 00007f2a8bee7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff3a9da10f R14: 00007f2a8a9fe300 R15: 0000000000022000 ---------------- Code disassembly (best guess): 0: 45 02 00 add (%r8),%r8b 3: 00 0f add %cl,(%rdi) 5: 01 cb add %ecx,%ebx 7: 0f ae e8 lfence a: 48 8b 44 24 30 mov 0x30(%rsp),%rax f: 49 89 44 24 08 mov %rax,0x8(%r12) 14: 48 8b 4c 24 08 mov 0x8(%rsp),%rcx 19: 48 8b 44 24 58 mov 0x58(%rsp),%rax 1e: 48 89 01 mov %rax,(%rcx) 21: 48 8b 44 24 20 mov 0x20(%rsp),%rax 26: 8b 54 24 3c mov 0x3c(%rsp),%edx * 2a: 66 89 41 10 mov %ax,0x10(%rcx) <-- trapping instruction 2e: 48 98 cltq 30: 88 54 01 ff mov %dl,-0x1(%rcx,%rax,1) 34: 48 89 44 24 30 mov %rax,0x30(%rsp) 39: 49 63 ee movslq %r14d,%rbp 3c: c6 .byte 0xc6 3d: 44 29 12 sub %r10d,(%rdx)