syzbot


possible deadlock in mnt_want_write (2)

Status: upstream: reported C repro on 2021/06/15 16:59
Reported-by: syzbot+b42fe626038981fb7bfa@syzkaller.appspotmail.com
First crash: 473d, last: 1d00h

Cause bisection: introduced by (bisect log) [no-op commit]:
commit b9fc8b4a591811546fec2dbef7e9f809362100c9
Author: Grant Seltzer <grantseltzer@gmail.com>
Date: Mon Feb 22 19:58:46 2021 +0000

  bpf: Add kernel/modules BTF presence checks to bpftool feature command

Crash: WARNING in kvm_wait (log)
Repro: C syz .config
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 720d 1527d 17/24 fixed on 2020/11/16 12:12
linux-4.19 possible deadlock in mnt_want_write C 674 13h57m 1257d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 1 1510d 1510d 0/3 auto-closed as invalid on 2019/02/22 14:57
linux-4.14 possible deadlock in mnt_want_write C 8520 2h00m 1252d 0/1 upstream: reported C repro on 2019/04/25 05:09
Patch testing requests:
Created Duration User Patch Repo Result
2022/07/03 07:07 19m hdanton@sina.com patch http://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/torvalds/linux.git 089866061428 OK log
2022/07/03 01:34 17m hdanton@sina.com patch http://kernel.source.codeaurora.cn/pub/scm/linux/kernel/git/torvalds/linux.git 089866061428 error

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.19.0-rc4-syzkaller-00187-g089866061428 #0 Not tainted
------------------------------------------------------
syz-executor450/3829 is trying to acquire lock:
ffff88807e574460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393

but task is already holding lock:
ffff888074de91a0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7d2/0x1c10 security/integrity/ima/ima_main.c:260

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&iint->mutex){+.+.}-{3:3}:
       lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5665
       __mutex_lock_common+0x1de/0x26c0 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       process_measurement+0x7d2/0x1c10 security/integrity/ima/ima_main.c:260
       ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3522 [inline]
       path_openat+0x2705/0x2ec0 fs/namei.c:3653
       do_filp_open+0x277/0x4f0 fs/namei.c:3680
       do_sys_openat2+0x13b/0x500 fs/open.c:1278
       do_sys_open fs/open.c:1294 [inline]
       __do_sys_open fs/open.c:1302 [inline]
       __se_sys_open fs/open.c:1298 [inline]
       __x64_sys_open+0x221/0x270 fs/open.c:1298
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0

-> #0 (sb_writers#4){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3095 [inline]
       check_prevs_add kernel/locking/lockdep.c:3214 [inline]
       validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3829
       __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5053
       lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5665
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1699 [inline]
       sb_start_write+0x4d/0x1a0 include/linux/fs.h:1774
       mnt_want_write+0x3b/0x80 fs/namespace.c:393
       ovl_maybe_copy_up+0x124/0x190 fs/overlayfs/copy_up.c:1078
       ovl_open+0x106/0x2a0 fs/overlayfs/file.c:152
       do_dentry_open+0x789/0x1040 fs/open.c:848
       vfs_open fs/open.c:981 [inline]
       dentry_open+0xc1/0x120 fs/open.c:997
       ima_calc_file_hash+0x157/0x1cb0 security/integrity/ima/ima_crypto.c:557
       ima_collect_measurement+0x3de/0x850 security/integrity/ima/ima_api.c:292
       process_measurement+0xf87/0x1c10 security/integrity/ima/ima_main.c:337
       ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3522 [inline]
       path_openat+0x2705/0x2ec0 fs/namei.c:3653
       do_filp_open+0x277/0x4f0 fs/namei.c:3680
       do_sys_openat2+0x13b/0x500 fs/open.c:1278
       do_sys_open fs/open.c:1294 [inline]
       __do_sys_open fs/open.c:1302 [inline]
       __se_sys_open fs/open.c:1298 [inline]
       __x64_sys_open+0x221/0x270 fs/open.c:1298
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz-executor450/3829:
 #0: ffff888074de91a0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7d2/0x1c10 security/integrity/ima/ima_main.c:260

stack backtrace:
CPU: 1 PID: 3829 Comm: syz-executor450 Not tainted 5.19.0-rc4-syzkaller-00187-g089866061428 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2f7/0x3b0 kernel/locking/lockdep.c:2175
 check_prev_add kernel/locking/lockdep.c:3095 [inline]
 check_prevs_add kernel/locking/lockdep.c:3214 [inline]
 validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3829
 __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5053
 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5665
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1699 [inline]
 sb_start_write+0x4d/0x1a0 include/linux/fs.h:1774
 mnt_want_write+0x3b/0x80 fs/namespace.c:393
 ovl_maybe_copy_up+0x124/0x190 fs/overlayfs/copy_up.c:1078
 ovl_open+0x106/0x2a0 fs/overlayfs/file.c:152
 do_dentry_open+0x789/0x1040 fs/open.c:848
 vfs_open fs/open.c:981 [inline]
 dentry_open+0xc1/0x120 fs/open.c:997
 ima_calc_file_hash+0x157/0x1cb0 security/integrity/ima/ima_crypto.c:557
 ima_collect_measurement+0x3de/0x850 security/integrity/ima/ima_api.c:292
 process_measurement+0xf87/0x1c10 security/integrity/ima/ima_main.c:337
 ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
 do_open fs/namei.c:3522 [inline]
 path_openat+0x2705/0x2ec0 fs/namei.c:3653
 do_filp_open+0x277/0x4f0 fs/namei.c:3680
 do_sys_openat2+0x13b/0x500 fs/open.c:1278
 do_sys_open fs/open.c:1294 [inline]
 __do_sys_open fs/open.c:1302 [inline]
 __se_sys_open fs/open.c:1298 [inline]
 __x64_sys_open+0x221/0x270 fs/open.c:1298
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7faf98402749
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 16 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007faf9838e2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007faf98491270 RCX: 00007faf98402749
RDX: 0000000000000000 RSI: 000000000000000b RDI: 00000000200000c0
RBP: 00007faf98458504 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 3d7269647265776f R14: 0079616c7265766f R15: 00007faf98491278
 </TASK>

Crashes (56):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/07/02 17:27 upstream 089866061428 1434eec0 .config log report syz C possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/27 13:55 upstream 3800a713b607 10323ddf .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/26 22:08 upstream f76349cf4145 d59ba983 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/09/25 21:45 upstream 105a36f3694e 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/09/25 17:53 upstream 105a36f3694e 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/25 00:41 upstream 3db61221f4e8 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/24 07:55 upstream bf682942cd26 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/24 06:21 upstream bf682942cd26 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/23 18:03 upstream bf682942cd26 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/23 04:42 upstream dc164f4fb00a 0042f2b4 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/22 12:35 upstream dc164f4fb00a 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/21 22:43 upstream 06f7db949993 60af5050 .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/21 17:59 upstream 06f7db949993 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/21 16:28 upstream 60891ec99e14 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/21 11:08 upstream 60891ec99e14 380f82fb .config log report info possible deadlock in mnt_want_write
ci2-upstream-fs 2022/09/20 23:34 upstream 60891ec99e14 c4b8ccfd .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/09/19 14:14 upstream 521a547ced64 dd9a85ff .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/09/03 13:19 upstream d895ec7938c4 49e94a20 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/08/15 04:24 upstream 7ebfc85e2cd7 8dfcaa3d .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/08/13 10:30 upstream 7ebfc85e2cd7 8dfcaa3d .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/07/23 23:24 upstream 70664fc10c0d 22343af4 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/07/17 18:42 upstream 972a278fe60c 95cb00d1 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/07/15 10:14 upstream 9bd572ec7a66 5d921b08 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/07/09 01:55 upstream a471da3100ef b5765a15 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/07/02 09:26 upstream 089866061428 1434eec0 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/06/27 17:04 upstream 03c765b0e3b4 a371c43c .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/06/24 06:05 upstream de5c208d533a 912f5df7 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/06/24 06:03 upstream de5c208d533a 912f5df7 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/05/23 08:55 upstream 4b0986a3613c 7268fa62 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/03/16 12:54 upstream 56e337f2cf13 9e8eaa75 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/03/13 04:42 upstream aad611a868d1 9e8eaa75 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/03/12 11:25 upstream 68453767131a 9e8eaa75 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/03/11 16:14 upstream dda64ead7e82 9e8eaa75 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/02/20 09:43 upstream 4f12b742eb2b 3cd800e4 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/02/09 01:29 upstream e6251ab4551f 0b33604d .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/01/29 18:19 upstream 169387e2aa29 495e00c5 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/01/14 20:31 upstream fb3b0673b7d5 53e00b45 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2022/01/08 13:35 upstream d1587f7bfe9a 2ca0d385 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/12/22 03:54 upstream 2f47a9a4dfa3 6caa12e4 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/12/14 07:00 upstream 5472f14a3742 5d14b1ea .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/11/03 00:58 upstream bfc484fe6abb 17f3edd2 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/10/30 22:51 upstream 119c85055d86 098b5d53 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/10/19 14:48 upstream 519d81956ee2 24dc29db .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/09/26 09:33 upstream a5e0aceabef6 8cac236e .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/09/08 00:14 upstream a2b28235335f 064c9eb7 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/09/07 22:43 upstream a2b28235335f 064c9eb7 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/09/07 21:54 upstream a2b28235335f 064c9eb7 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/08/29 22:10 upstream 3f5ad13cb012 be2c130d .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/16 02:19 upstream dd9c7df94c1b f115ae98 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/16 00:58 upstream dd9c7df94c1b f115ae98 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/15 04:40 upstream 8096acd7442e b9a2f64e .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/13 16:18 upstream 7fef2edf7cc7 fa0594c3 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/12 22:27 upstream 7fef2edf7cc7 f415556d .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/11 20:13 upstream 98f7fdced2e0 8f5a7b8c .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/07/07 08:53 upstream 3dbdb38e2869 4846d5c1 .config log report info possible deadlock in mnt_want_write
ci-upstream-kasan-gce-smack-root 2021/06/11 16:55 upstream 06af8679449d 1ba81399 .config log report info possible deadlock in mnt_want_write
* Struck through repros no longer work on HEAD.