======================================================
WARNING: possible circular locking dependency detected
5.1.0-rc5+ #78 Not tainted
------------------------------------------------------
syz-executor.0/7876 is trying to acquire lock:
0000000087ca1920 (sb_writers#3){.+.+}, at: sb_start_write include/linux/fs.h:1621 [inline]
0000000087ca1920 (sb_writers#3){.+.+}, at: mnt_want_write+0x3f/0xc0 fs/namespace.c:358

but task is already holding lock:
0000000051ba1f5f (&iint->mutex){+.+.}, at: process_measurement+0x354/0x1570 security/integrity/ima/ima_main.c:226

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&iint->mutex){+.+.}:
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
       __mutex_lock_common kernel/locking/mutex.c:925 [inline]
       __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087
       process_measurement+0x354/0x1570 security/integrity/ima/ima_main.c:226
       ima_file_check+0xc5/0x110 security/integrity/ima/ima_main.c:393
       do_last fs/namei.c:3420 [inline]
       path_openat+0x1142/0x46e0 fs/namei.c:3533
       do_filp_open+0x1a1/0x280 fs/namei.c:3563
       do_sys_open+0x3fe/0x5d0 fs/open.c:1069
       __do_sys_open fs/open.c:1087 [inline]
       __se_sys_open fs/open.c:1082 [inline]
       __x64_sys_open+0x7e/0xc0 fs/open.c:1082
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (sb_writers#3){.+.+}:
       check_prevs_add kernel/locking/lockdep.c:2333 [inline]
       validate_chain kernel/locking/lockdep.c:2714 [inline]
       __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
       percpu_down_read include/linux/percpu-rwsem.h:36 [inline]
       __sb_start_write+0x20b/0x360 fs/super.c:1613
       sb_start_write include/linux/fs.h:1621 [inline]
       mnt_want_write+0x3f/0xc0 fs/namespace.c:358
       ovl_want_write+0x76/0xa0 fs/overlayfs/util.c:24
       ovl_open_maybe_copy_up+0x122/0x180 fs/overlayfs/copy_up.c:917
       ovl_open+0xb3/0x270 fs/overlayfs/file.c:123
       do_dentry_open+0x4e2/0x1250 fs/open.c:777
       vfs_open fs/open.c:886 [inline]
       dentry_open+0x132/0x1d0 fs/open.c:902
       ima_calc_file_hash+0x33f/0x570 security/integrity/ima/ima_crypto.c:427
       ima_collect_measurement+0x50f/0x5c0 security/integrity/ima/ima_api.c:231
       process_measurement+0xeca/0x1570 security/integrity/ima/ima_main.c:286
       ima_file_check+0xc5/0x110 security/integrity/ima/ima_main.c:393
       do_last fs/namei.c:3420 [inline]
       path_openat+0x1142/0x46e0 fs/namei.c:3533
       do_filp_open+0x1a1/0x280 fs/namei.c:3563
       do_sys_open+0x3fe/0x5d0 fs/open.c:1069
       __do_sys_open fs/open.c:1087 [inline]
       __se_sys_open fs/open.c:1082 [inline]
       __x64_sys_open+0x7e/0xc0 fs/open.c:1082
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&iint->mutex);
                               lock(sb_writers#3);
                               lock(&iint->mutex);
  lock(sb_writers#3);

 *** DEADLOCK ***

1 lock held by syz-executor.0/7876:
 #0: 0000000051ba1f5f (&iint->mutex){+.+.}, at: process_measurement+0x354/0x1570 security/integrity/ima/ima_main.c:226

stack backtrace:
CPU: 0 PID: 7876 Comm: syz-executor.0 Not tainted 5.1.0-rc5+ #78
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.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1571
 check_prev_add.constprop.0+0xf11/0x23c0 kernel/locking/lockdep.c:2220
 check_prevs_add kernel/locking/lockdep.c:2333 [inline]
 validate_chain kernel/locking/lockdep.c:2714 [inline]
 __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701
 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
 percpu_down_read include/linux/percpu-rwsem.h:36 [inline]
 __sb_start_write+0x20b/0x360 fs/super.c:1613
 sb_start_write include/linux/fs.h:1621 [inline]
 mnt_want_write+0x3f/0xc0 fs/namespace.c:358
 ovl_want_write+0x76/0xa0 fs/overlayfs/util.c:24
 ovl_open_maybe_copy_up+0x122/0x180 fs/overlayfs/copy_up.c:917
 ovl_open+0xb3/0x270 fs/overlayfs/file.c:123
 do_dentry_open+0x4e2/0x1250 fs/open.c:777
 vfs_open fs/open.c:886 [inline]
 dentry_open+0x132/0x1d0 fs/open.c:902
 ima_calc_file_hash+0x33f/0x570 security/integrity/ima/ima_crypto.c:427
 ima_collect_measurement+0x50f/0x5c0 security/integrity/ima/ima_api.c:231
 process_measurement+0xeca/0x1570 security/integrity/ima/ima_main.c:286
 ima_file_check+0xc5/0x110 security/integrity/ima/ima_main.c:393
 do_last fs/namei.c:3420 [inline]
 path_openat+0x1142/0x46e0 fs/namei.c:3533
 do_filp_open+0x1a1/0x280 fs/namei.c:3563
 do_sys_open+0x3fe/0x5d0 fs/open.c:1069
 __do_sys_open fs/open.c:1087 [inline]
 __se_sys_open fs/open.c:1082 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1082
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x458c29
Code: ad b8 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 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff3249fc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458c29
RDX: 0000000000000000 RSI: 0000000000000927 RDI: 0000000020000040