====================================================== WARNING: possible circular locking dependency detected 5.2.0-rc3-next-20190604 #8 Not tainted ------------------------------------------------------ syz-executor.3/23079 is trying to acquire lock: 00000000e4a1a111 (&sb->s_type->i_mutex_key#12){+.+.}, at: inode_lock include/linux/fs.h:778 [inline] 00000000e4a1a111 (&sb->s_type->i_mutex_key#12){+.+.}, at: process_measurement+0x9bc/0x15e0 security/integrity/ima/ima_main.c:228 but task is already holding lock: 000000001803b460 (&mm->mmap_sem#2){++++}, at: do_mprotect_pkey+0x1f6/0xa30 mm/mprotect.c:485 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem#2){++++}: down_read+0x3f/0x1e0 kernel/locking/rwsem.c:24 do_user_addr_fault arch/x86/mm/fault.c:1406 [inline] __do_page_fault+0x9e9/0xda0 arch/x86/mm/fault.c:1521 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1552 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 fault_in_pages_readable include/linux/pagemap.h:592 [inline] iov_iter_fault_in_readable+0x1ba/0x450 lib/iov_iter.c:426 generic_perform_write+0x186/0x520 mm/filemap.c:3197 __generic_file_write_iter+0x25e/0x630 mm/filemap.c:3336 generic_file_write_iter+0x360/0x610 mm/filemap.c:3368 call_write_iter include/linux/fs.h:1870 [inline] new_sync_write+0x4d3/0x770 fs/read_write.c:483 __vfs_write+0xe1/0x110 fs/read_write.c:496 vfs_write+0x268/0x5d0 fs/read_write.c:558 ksys_write+0x14f/0x290 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:620 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&sb->s_type->i_mutex_key#12){+.+.}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4300 down_write+0x38/0xa0 kernel/locking/rwsem.c:66 inode_lock include/linux/fs.h:778 [inline] process_measurement+0x9bc/0x15e0 security/integrity/ima/ima_main.c:228 ima_file_mmap+0x11a/0x130 security/integrity/ima/ima_main.c:370 security_file_mprotect+0xd5/0x100 security/security.c:1426 do_mprotect_pkey+0x537/0xa30 mm/mprotect.c:550 __do_sys_mprotect mm/mprotect.c:582 [inline] __se_sys_mprotect mm/mprotect.c:579 [inline] __x64_sys_mprotect+0x78/0xb0 mm/mprotect.c:579 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem#2); lock(&sb->s_type->i_mutex_key#12); lock(&mm->mmap_sem#2); lock(&sb->s_type->i_mutex_key#12); *** DEADLOCK *** 1 lock held by syz-executor.3/23079: #0: 000000001803b460 (&mm->mmap_sem#2){++++}, at: do_mprotect_pkey+0x1f6/0xa30 mm/mprotect.c:485 stack backtrace: CPU: 0 PID: 23079 Comm: syz-executor.3 Not tainted 5.2.0-rc3-next-20190604 #8 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_circular_bug.cold+0x1cc/0x28f kernel/locking/lockdep.c:1566 check_prev_add kernel/locking/lockdep.c:2311 [inline] check_prevs_add kernel/locking/lockdep.c:2419 [inline] validate_chain kernel/locking/lockdep.c:2801 [inline] __lock_acquire+0x3755/0x5490 kernel/locking/lockdep.c:3790 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4300 down_write+0x38/0xa0 kernel/locking/rwsem.c:66 inode_lock include/linux/fs.h:778 [inline] process_measurement+0x9bc/0x15e0 security/integrity/ima/ima_main.c:228 ima_file_mmap+0x11a/0x130 security/integrity/ima/ima_main.c:370 security_file_mprotect+0xd5/0x100 security/security.c:1426 do_mprotect_pkey+0x537/0xa30 mm/mprotect.c:550 __do_sys_mprotect mm/mprotect.c:582 [inline] __se_sys_mprotect mm/mprotect.c:579 [inline] __x64_sys_mprotect+0x78/0xb0 mm/mprotect.c:579 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x459279 Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f29dadd4c78 EFLAGS: 00000246 ORIG_RAX: 000000000000000a RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459279 RDX: 000000000000000d RSI: 0000000000001000 RDI: 0000000020004000 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f29dadd56d4 R13: 00000000004c5d11 R14: 00000000004d9670 R15: 00000000ffffffff