======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/32299 is trying to acquire lock:
000000004edd1650 (sb_writers#3){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline]
000000004edd1650 (sb_writers#3){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360

but task is already holding lock:
000000006356174e (&iint->mutex){+.+.}, at: process_measurement+0x316/0x1440 security/integrity/ima/ima_main.c:224

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&iint->mutex){+.+.}:
       process_measurement+0x316/0x1440 security/integrity/ima/ima_main.c:224
       ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:391
       do_last fs/namei.c:3425 [inline]
       path_openat+0x7e4/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_sys_open+0x3b3/0x520 fs/open.c:1085
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (sb_writers#3){.+.+}:
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       __sb_start_write+0x6e/0x2a0 fs/super.c:1366
       sb_start_write include/linux/fs.h:1579 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:360
       ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:888
       ovl_open+0xb4/0x260 fs/overlayfs/file.c:126
       do_dentry_open+0x4aa/0x1160 fs/open.c:796
       vfs_open fs/open.c:902 [inline]
       dentry_open+0x132/0x1d0 fs/open.c:918
       ima_calc_file_hash+0x628/0x8a0 security/integrity/ima/ima_crypto.c:435
       ima_collect_measurement+0x4c4/0x570 security/integrity/ima/ima_api.c:231
       process_measurement+0xddd/0x1440 security/integrity/ima/ima_main.c:284
       ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:391
       do_last fs/namei.c:3425 [inline]
       path_openat+0x7e4/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_sys_open+0x3b3/0x520 fs/open.c:1085
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       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.3/32299:
 #0: 000000006356174e (&iint->mutex){+.+.}, at: process_measurement+0x316/0x1440 security/integrity/ima/ima_main.c:224

stack backtrace:
CPU: 0 PID: 32299 Comm: syz-executor.3 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/11/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
 percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
 __sb_start_write+0x6e/0x2a0 fs/super.c:1366
 sb_start_write include/linux/fs.h:1579 [inline]
 mnt_want_write+0x3a/0xb0 fs/namespace.c:360
 ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:888
 ovl_open+0xb4/0x260 fs/overlayfs/file.c:126
 do_dentry_open+0x4aa/0x1160 fs/open.c:796
 vfs_open fs/open.c:902 [inline]
 dentry_open+0x132/0x1d0 fs/open.c:918
 ima_calc_file_hash+0x628/0x8a0 security/integrity/ima/ima_crypto.c:435
 ima_collect_measurement+0x4c4/0x570 security/integrity/ima/ima_api.c:231
 process_measurement+0xddd/0x1440 security/integrity/ima/ima_main.c:284
 ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:391
 do_last fs/namei.c:3425 [inline]
 path_openat+0x7e4/0x2df0 fs/namei.c:3537
 do_filp_open+0x18c/0x3f0 fs/namei.c:3567
 do_sys_open+0x3b3/0x520 fs/open.c:1085
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f6874bc55f9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f6873538168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f6874ce5f80 RCX: 00007f6874bc55f9
RDX: 0000000000000000 RSI: 0000000000008003 RDI: 0000000020000000
RBP: 00007f6874c207b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe662413df R14: 00007f6873538300 R15: 0000000000022000
overlayfs: failed to resolve './file1': -2
overlayfs: unrecognized mount option "7orkdir=./file1" or missing value
overlayfs: failed to resolve './file1': -2
overlayfs: failed to resolve './file1': -2
MTD: Attempt to mount non-MTD device "/dev/md0"
kauditd_printk_skb: 65 callbacks suppressed
audit: type=1804 audit(1666703067.693:1057): pid=32360 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir2445622974/syzkaller.LaeH6J/710/bus/file0" dev="overlay" ino=14145 res=1
audit: type=1804 audit(1666703067.733:1058): pid=32387 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir2445622974/syzkaller.LaeH6J/710/bus/file0" dev="overlay" ino=14145 res=1
overlayfs: failed to resolve '.dR�n�P�D-�+tv@��Ъ4�W9��y���l': -2
overlayfs: './bus' not a directory
overlayfs: failed to resolve './file1': -2
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: failed to resolve '.dR�n�P�D-�+tv@��Ъ4�W9��y���l': -2
audit: type=1804 audit(1666703068.064:1059): pid=32443 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir3461796393/syzkaller.2wUCdY/615/file0" dev="sda1" ino=14787 res=1
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: conflicting lowerdir path
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
audit: type=1804 audit(1666703068.134:1060): pid=32471 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/708/file0" dev="sda1" ino=14585 res=1
overlayfs: missing 'lowerdir'
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: unrecognized mount option "00000000000000000004" or missing value
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
audit: type=1804 audit(1666703068.284:1061): pid=32483 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/709/bus" dev="sda1" ino=15271 res=1
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
audit: type=1804 audit(1666703068.444:1062): pid=32497 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/709/file0" dev="sda1" ino=15239 res=1
overlayfs: './bus' not a directory
overlayfs: missing 'lowerdir'
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: './bus' not a directory
overlayfs: unrecognized mount option "up`erdir=./bus" or missing value
audit: type=1804 audit(1666703071.054:1063): pid=32514 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/710/bus" dev="sda1" ino=14613 res=1
overlayfs: unrecognized mount option "00000000000000000003" or missing value
audit: type=1804 audit(1666703071.124:1064): pid=32534 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir3099688653/syzkaller.1GvWVX/717/bus" dev="sda1" ino=13914 res=1
overlayfs: './bus' not a directory
overlayfs: unrecognized mount option "up`erdir=./bus" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
audit: type=1804 audit(1666703071.224:1065): pid=32552 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/710/file0" dev="sda1" ino=14433 res=1
overlayfs: unrecognized mount option "up`erdir=./bus" or missing value
audit: type=1804 audit(1666703071.224:1066): pid=32552 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/710/file0" dev="sda1" ino=14433 res=1
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: './bus' not a directory
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "00000000000000000068" or missing value
overlayfs: failed to resolve './file1': -2
overlayfs: missing 'lowerdir'
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: unrecognized mount option "qp����r=./" or missing value
overlayfs: missing 'lowerdir'
overlayfs: failed to resolve '*/file1': -2
kauditd_printk_skb: 8 callbacks suppressed
audit: type=1804 audit(1666703075.154:1075): pid=32726 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.3" name="/root/syzkaller-testdir3636085817/syzkaller.PsYMBm/716/bus/file0" dev="overlay" ino=14495 res=1
audit: type=1804 audit(1666703075.174:1076): pid=32738 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir3099688653/syzkaller.1GvWVX/719/bus" dev="sda1" ino=14832 res=1
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: failed to resolve '*/file1': -2
overlayfs: filesystem on './bus' not supported as upperdir
audit: type=1804 audit(1666703075.204:1077): pid=32725 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir3461796393/syzkaller.2wUCdY/620/bus/file0" dev="overlay" ino=14370 res=1
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
audit: type=1804 audit(1666703075.304:1078): pid=315 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir3461796393/syzkaller.2wUCdY/621/file0" dev="sda1" ino=13953 res=1
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir
overlayfs: filesystem on './bus' not supported as upperdir