syzbot


possible deadlock in mnt_want_write

Status: upstream: reported C repro on 2019/04/25 05:09
Reported-by: syzbot+662c18f543a2543ad297@syzkaller.appspotmail.com
First crash: 1250d, last: now
similar bugs (4):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in mnt_want_write C done done 662 718d 1525d 17/24 fixed on 2020/11/16 12:12
linux-4.19 possible deadlock in mnt_want_write C 669 1h44m 1255d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 1 1508d 1508d 0/3 auto-closed as invalid on 2019/02/22 14:57
upstream possible deadlock in mnt_want_write (2) C unreliable 54 12h53m 467d 0/24 upstream: reported C repro on 2021/06/15 16:59

Sample crash report:
audit: type=1804 audit(1656803882.106:2): pid=7971 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor304" name="/root/bus/file0" dev="sda1" ino=13861 res=1
======================================================
WARNING: possible circular locking dependency detected
4.14.286-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor304/7971 is trying to acquire lock:
 (sb_writers#3){.+.+}, at: [<ffffffff818e059a>] sb_start_write include/linux/fs.h:1551 [inline]
 (sb_writers#3){.+.+}, at: [<ffffffff818e059a>] mnt_want_write+0x3a/0xb0 fs/namespace.c:386

but task is already holding lock:
 (&iint->mutex){+.+.}, at: [<ffffffff82eebf50>] process_measurement+0x270/0xb20 security/integrity/ima/ima_main.c:225

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&iint->mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       process_measurement+0x270/0xb20 security/integrity/ima/ima_main.c:225
       do_last fs/namei.c:3435 [inline]
       path_openat+0x10ad/0x2970 fs/namei.c:3569
       do_filp_open+0x179/0x3c0 fs/namei.c:3603
       do_sys_open+0x296/0x410 fs/open.c:1081
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (sb_writers#3){.+.+}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       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+0x64/0x260 fs/super.c:1342
       sb_start_write include/linux/fs.h:1551 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:386
       ovl_open_maybe_copy_up+0xcf/0x130 fs/overlayfs/inode.c:344
       ovl_d_real+0xbc/0x350 fs/overlayfs/super.c:88
       d_real include/linux/dcache.h:587 [inline]
       vfs_open+0x19e/0x220 fs/open.c:882
       dentry_open+0xa7/0x210 fs/open.c:905
       ima_calc_file_hash+0x51c/0x780 security/integrity/ima/ima_crypto.c:452
       ima_collect_measurement+0x39d/0x430 security/integrity/ima/ima_api.c:227
       process_measurement+0x78b/0xb20 security/integrity/ima/ima_main.c:264
       do_last fs/namei.c:3435 [inline]
       path_openat+0x10ad/0x2970 fs/namei.c:3569
       do_filp_open+0x179/0x3c0 fs/namei.c:3603
       do_sys_open+0x296/0x410 fs/open.c:1081
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

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-executor304/7971:
 #0:  (&iint->mutex){+.+.}, at: [<ffffffff82eebf50>] process_measurement+0x270/0xb20 security/integrity/ima/ima_main.c:225

stack backtrace:
CPU: 0 PID: 7971 Comm: syz-executor304 Not tainted 4.14.286-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 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+0x64/0x260 fs/super.c:1342
 sb_start_write include/linux/fs.h:1551 [inline]
 mnt_want_write+0x3a/0xb0 fs/namespace.c:386
 ovl_open_maybe_copy_up+0xcf/0x130 fs/overlayfs/inode.c:344
 ovl_d_real+0xbc/0x350 fs/overlayfs/super.c:88
 d_real include/linux/dcache.h:587 [inline]
 vfs_open+0x19e/0x220 fs/open.c:882
 dentry_open+0xa7/0x210 fs/open.c:905
 ima_calc_file_hash+0x51c/0x780 security/integrity/ima/ima_crypto.c:452
 ima_collect_measurement+0x39d/0x430 security/integrity/ima/ima_api.c:227
 process_measurement+0x78b/0xb20 security/integrity/ima/ima_main.c:264
 do_last fs/namei.c:3435 [inline]
 path_openat+0x10ad/0x2970 fs/namei.c:3569
 do_filp_open+0x179/0x3c0 fs/namei.c:3603
 do_sys_open+0x296/0x410 fs/open.c:1081
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f829b7290c9
RSP: 002b:00007ffe5508e828 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f829b7290c9
RDX: 0000000000000000 RSI: 000000000000000b RDI: 00000000200000c0
RBP: 00007f829b6ed0b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000

Fix bisection attempts:
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2021/08/06 04:30 linux-4.14.y 94cb1fed447a 9d2ab5df .config log report syz C
ci2-linux-4-14 2020/05/19 12:19 linux-4.14.y ab9dfda23248 acb51638 .config log report syz
* Struck through repros no longer work on HEAD.
Crashes (8443):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2022/07/02 23:19 linux-4.14.y ed2e96e11936 1434eec0 .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/10/31 00:07 linux-4.14.y cd5296934610 098b5d53 .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/09/23 15:11 linux-4.14.y 8ea4f73cfa7e 8cac236e .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/09/18 12:44 linux-4.14.y f96eb53cbd76 70b76c1d .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/08/24 14:51 linux-4.14.y 162b95d01320 b599f2fc .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/06/28 07:27 linux-4.14.y cfb41ef9deb1 9d2ab5df .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/06/22 18:41 linux-4.14.y cfb41ef9deb1 aba2b2fb .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/06/21 03:33 linux-4.14.y cfb41ef9deb1 aba2b2fb .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/05/16 20:26 linux-4.14.y 7d7d1c0ab3eb f54a5c09 .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2021/05/05 05:36 linux-4.14.y 7d7d1c0ab3eb 06c27ff5 .config log report syz C possible deadlock in mnt_want_write
ci2-linux-4-14 2020/12/01 08:25 linux-4.14.y 87335852c5d9 b3a34598 .config log report syz C
ci2-linux-4-14 2020/12/01 07:45 linux-4.14.y 87335852c5d9 b3a34598 .config log report syz C
ci2-linux-4-14 2020/11/02 20:04 linux-4.14.y 2b7915014161 8bc4594f .config log report syz C
ci2-linux-4-14 2020/10/16 04:36 linux-4.14.y cbfa1702aaf6 6e262c73 .config log report syz C
ci2-linux-4-14 2020/10/09 19:59 linux-4.14.y cbfa1702aaf6 fa79ed2a .config log report syz C
ci2-linux-4-14 2020/10/09 15:08 linux-4.14.y cbfa1702aaf6 fa79ed2a .config log report syz C
ci2-linux-4-14 2020/10/08 01:46 linux-4.14.y cbfa1702aaf6 1880b4a9 .config log report syz C
ci2-linux-4-14 2020/10/04 01:50 linux-4.14.y cbfa1702aaf6 1a3f9408 .config log report syz C
ci2-linux-4-14 2020/09/27 21:55 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz C
ci2-linux-4-14 2020/09/27 19:41 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz C
ci2-linux-4-14 2020/09/27 19:20 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz C
ci2-linux-4-14 2020/09/27 07:42 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz C
ci2-linux-4-14 2020/09/27 03:13 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz C
ci2-linux-4-14 2020/09/26 22:45 linux-4.14.y cbfa1702aaf6 2d5ea0cb .config log report syz C
ci2-linux-4-14 2020/09/26 17:50 linux-4.14.y cbfa1702aaf6 2d5ea0cb .config log report syz C
ci2-linux-4-14 2020/09/26 10:57 linux-4.14.y cbfa1702aaf6 4a006f63 .config log report syz C
ci2-linux-4-14 2020/09/24 05:34 linux-4.14.y cbfa1702aaf6 54289b08 .config log report syz C
ci2-linux-4-14 2020/09/09 00:36 linux-4.14.y 2f166cdcf8a9 abf9ba4f .config log report syz C
ci2-linux-4-14 2020/09/07 23:42 linux-4.14.y 2f166cdcf8a9 abf9ba4f .config log report syz C
ci2-linux-4-14 2020/05/22 11:25 linux-4.14.y a41ba30d9df2 4afdfa20 .config log report syz C
ci2-linux-4-14 2022/05/12 04:49 linux-4.14.y e3a56aaade89 beb0b407 .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2021/11/01 00:45 linux-4.14.y cd5296934610 098b5d53 .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2021/07/03 19:42 linux-4.14.y 313e82bbefb3 55aa55c2 .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2021/03/29 03:10 linux-4.14.y 670d6552eda8 a8529b82 .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2021/01/27 02:04 linux-4.14.y 2d2791fce891 55a7d4df .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2021/01/25 20:54 linux-4.14.y 2d2791fce891 52e37319 .config log report syz possible deadlock in mnt_want_write
ci2-linux-4-14 2020/12/12 21:59 linux-4.14.y 3f2ecb86cb90 bca53db9 .config log report syz
ci2-linux-4-14 2020/10/09 22:52 linux-4.14.y cbfa1702aaf6 93817d89 .config log report syz
ci2-linux-4-14 2020/10/07 20:29 linux-4.14.y cbfa1702aaf6 1880b4a9 .config log report syz
ci2-linux-4-14 2020/09/27 21:30 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz
ci2-linux-4-14 2020/09/27 07:21 linux-4.14.y cbfa1702aaf6 5dd8aee8 .config log report syz
ci2-linux-4-14 2020/09/26 18:57 linux-4.14.y cbfa1702aaf6 2d5ea0cb .config log report syz
ci2-linux-4-14 2019/08/10 18:44 linux-4.14.y 3ffe1e79c174 acb51638 .config log report syz
ci2-linux-4-14 2019/06/20 21:19 linux-4.14.y bb263a2a2d43 34bf9440 .config log report syz
ci2-linux-4-14 2022/09/26 10:27 linux-4.14.y 4edbf74132a4 d59ba983 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/26 09:32 linux-4.14.y 4edbf74132a4 d59ba983 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/26 07:52 linux-4.14.y 4edbf74132a4 d59ba983 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/24 18:03 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/24 15:14 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 21:06 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 19:44 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 18:36 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 17:21 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 16:06 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 15:03 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/23 10:08 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 19:30 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 19:13 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 18:10 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 16:19 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 15:17 linux-4.14.y 4edbf74132a4 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 10:55 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 02:34 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 01:22 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/22 00:13 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 23:12 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 22:17 linux-4.14.y 4edbf74132a4 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 17:40 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 14:27 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 13:19 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 12:03 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 11:13 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/21 10:12 linux-4.14.y 4edbf74132a4 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 21:51 linux-4.14.y 4edbf74132a4 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 20:12 linux-4.14.y 4edbf74132a4 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 18:56 linux-4.14.y 4edbf74132a4 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 17:54 linux-4.14.y 4edbf74132a4 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 16:53 linux-4.14.y 4edbf74132a4 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 15:51 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 14:59 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 13:54 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 12:38 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 11:57 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 10:47 linux-4.14.y 4edbf74132a4 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 09:46 linux-4.14.y 5df8b4735177 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2022/09/20 08:23 linux-4.14.y 5df8b4735177 7c41a9ba .config log report info possible deadlock in mnt_want_write
ci2-linux-4-14 2021/01/17 11:41 linux-4.14.y f79dc86058bc 813be542 .config log report info
ci2-linux-4-14 2019/04/25 04:09 linux-4.14.y 68d7a45eec10 8e3c52b1 .config log report
* Struck through repros no longer work on HEAD.