====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc4-syzkaller-00261-g850925a8133c #0 Not tainted ------------------------------------------------------ syz.3.1372/12722 is trying to acquire lock: ffff88804b8482c8 (&sb->s_type->i_mutex_key#12){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline] ffff88804b8482c8 (&sb->s_type->i_mutex_key#12){+.+.}-{3:3}, at: process_measurement+0x39c/0x2370 security/integrity/ima/ima_main.c:250 but task is already holding lock: ffff888000a2ba98 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline] ffff888000a2ba98 (&mm->mmap_lock){++++}-{3:3}, at: __do_sys_remap_file_pages+0x184/0x900 mm/mmap.c:1659 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_lock){++++}-{3:3}: down_read_killable+0x9d/0x380 kernel/locking/rwsem.c:1547 mmap_read_lock_killable include/linux/mmap_lock.h:153 [inline] get_mmap_lock_carefully mm/memory.c:6112 [inline] lock_mm_and_find_vma+0x3a9/0x6a0 mm/memory.c:6163 do_user_addr_fault+0x2b5/0x13f0 arch/x86/mm/fault.c:1361 handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 fault_in_readable+0x160/0x200 mm/gup.c:2235 fault_in_iov_iter_readable+0x101/0x2c0 lib/iov_iter.c:94 generic_perform_write+0x21b/0x920 mm/filemap.c:4044 shmem_file_write_iter+0x10e/0x140 mm/shmem.c:3216 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x5ae/0x1150 fs/read_write.c:683 ksys_write+0x12f/0x260 fs/read_write.c:736 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #0 (&sb->s_type->i_mutex_key#12){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 down_write+0x93/0x200 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] process_measurement+0x39c/0x2370 security/integrity/ima/ima_main.c:250 ima_file_mmap+0x146/0x1d0 security/integrity/ima/ima_main.c:455 security_mmap_file+0x8bd/0x990 security/security.c:2979 __do_sys_remap_file_pages+0x526/0x900 mm/mmap.c:1702 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_lock); lock(&sb->s_type->i_mutex_key#12); lock(&mm->mmap_lock); lock(&sb->s_type->i_mutex_key#12); *** DEADLOCK *** 1 lock held by syz.3.1372/12722: #0: ffff888000a2ba98 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:122 [inline] #0: ffff888000a2ba98 (&mm->mmap_lock){++++}-{3:3}, at: __do_sys_remap_file_pages+0x184/0x900 mm/mmap.c:1659 stack backtrace: CPU: 3 UID: 0 PID: 12722 Comm: syz.3.1372 Not tainted 6.12.0-rc4-syzkaller-00261-g850925a8133c #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x419/0x5d0 kernel/locking/lockdep.c:2074 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 down_write+0x93/0x200 kernel/locking/rwsem.c:1577 inode_lock include/linux/fs.h:815 [inline] process_measurement+0x39c/0x2370 security/integrity/ima/ima_main.c:250 ima_file_mmap+0x146/0x1d0 security/integrity/ima/ima_main.c:455 security_mmap_file+0x8bd/0x990 security/security.c:2979 __do_sys_remap_file_pages+0x526/0x900 mm/mmap.c:1702 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7f01579 Code: 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 00 00 00 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:00000000f566555c EFLAGS: 00000296 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000020491000 RCX: 0000000000001000 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), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi