syzbot


possible deadlock in mnt_want_write (2)
Status: upstream: reported on 2021/06/15 16:59
Reported-by: syzbot+b42fe626038981fb7bfa@syzkaller.appspotmail.com
First crash: 351d, last: 5d13h
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 597d 1405d 17/22 fixed on 2020/11/16 12:12
linux-4.19 possible deadlock in mnt_want_write C 434 6h59m 1135d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 1 1387d 1387d 0/3 auto-closed as invalid on 2019/02/22 14:57
linux-4.14 possible deadlock in mnt_want_write C 6887 6h05m 1129d 0/1 upstream: reported C repro on 2019/04/25 05:09

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.18.0-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.5/28242 is trying to acquire lock:
ffff88814bf9e460 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393

but task is already holding lock:
ffff88807e9401a0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x70c/0x1ca0 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:5641
       __mutex_lock_common+0x1de/0x26e0 kernel/locking/mutex.c:600
       __mutex_lock kernel/locking/mutex.c:733 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:785
       process_measurement+0x70c/0x1ca0 security/integrity/ima/ima_main.c:260
       ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3478 [inline]
       path_openat+0x2705/0x2ec0 fs/namei.c:3609
       do_filp_open+0x277/0x4f0 fs/namei.c:3636
       do_sys_openat2+0x13b/0x500 fs/open.c:1213
       do_sys_open fs/open.c:1229 [inline]
       __do_sys_openat fs/open.c:1245 [inline]
       __se_sys_openat fs/open.c:1240 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1240
       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+0x44/0xae

-> #0 (
sb_writers#4
){.+.+}-{0:0}
:
       check_prev_add kernel/locking/lockdep.c:3065 [inline]
       check_prevs_add kernel/locking/lockdep.c:3188 [inline]
       validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3803
       __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5029
       lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5641
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1698 [inline]
       sb_start_write+0x4d/0x1a0 include/linux/fs.h:1768
       mnt_want_write+0x3b/0x80 fs/namespace.c:393
       ovl_maybe_copy_up+0x124/0x190 fs/overlayfs/copy_up.c:1070
       ovl_open+0x9f/0x1f0 fs/overlayfs/file.c:150
       do_dentry_open+0x77f/0xfd0 fs/open.c:824
       vfs_open fs/open.c:958 [inline]
       dentry_open+0xc1/0x120 fs/open.c:974
       ima_calc_file_hash+0x157/0x1cb0 security/integrity/ima/ima_crypto.c:557
       ima_collect_measurement+0x292/0x530 security/integrity/ima/ima_api.c:252
       process_measurement+0xed8/0x1ca0 security/integrity/ima/ima_main.c:337
       ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3478 [inline]
       path_openat+0x2705/0x2ec0 fs/namei.c:3609
       do_filp_open+0x277/0x4f0 fs/namei.c:3636
       do_sys_openat2+0x13b/0x500 fs/open.c:1213
       do_sys_open fs/open.c:1229 [inline]
       __do_sys_open fs/open.c:1237 [inline]
       __se_sys_open fs/open.c:1233 [inline]
       __x64_sys_open+0x221/0x270 fs/open.c:1233
       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+0x44/0xae

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-executor.5/28242:
 #0: ffff88807e9401a0
 (&iint->mutex
){+.+.}-{3:3}
, at: process_measurement+0x70c/0x1ca0 security/integrity/ima/ima_main.c:260

stack backtrace:
CPU: 0 PID: 28242 Comm: syz-executor.5 Not tainted 5.18.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
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:2145
 check_prev_add kernel/locking/lockdep.c:3065 [inline]
 check_prevs_add kernel/locking/lockdep.c:3188 [inline]
 validate_chain+0x185c/0x65c0 kernel/locking/lockdep.c:3803
 __lock_acquire+0x129a/0x1f80 kernel/locking/lockdep.c:5029
 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5641
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1698 [inline]
 sb_start_write+0x4d/0x1a0 include/linux/fs.h:1768
 mnt_want_write+0x3b/0x80 fs/namespace.c:393
 ovl_maybe_copy_up+0x124/0x190 fs/overlayfs/copy_up.c:1070
 ovl_open+0x9f/0x1f0 fs/overlayfs/file.c:150
 do_dentry_open+0x77f/0xfd0 fs/open.c:824
 vfs_open fs/open.c:958 [inline]
 dentry_open+0xc1/0x120 fs/open.c:974
 ima_calc_file_hash+0x157/0x1cb0 security/integrity/ima/ima_crypto.c:557
 ima_collect_measurement+0x292/0x530 security/integrity/ima/ima_api.c:252
 process_measurement+0xed8/0x1ca0 security/integrity/ima/ima_main.c:337
 ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517
 do_open fs/namei.c:3478 [inline]
 path_openat+0x2705/0x2ec0 fs/namei.c:3609
 do_filp_open+0x277/0x4f0 fs/namei.c:3636
 do_sys_openat2+0x13b/0x500 fs/open.c:1213
 do_sys_open fs/open.c:1229 [inline]
 __do_sys_open fs/open.c:1237 [inline]
 __se_sys_open fs/open.c:1233 [inline]
 __x64_sys_open+0x221/0x270 fs/open.c:1233
 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+0x44/0xae
RIP: 0033:0x7f9c13a890e9
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:00007f9c14bb3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f9c13b9bf60 RCX: 00007f9c13a890e9
RDX: 0000000000000000 RSI: 0000000000000003 RDI: 0000000020000040
RBP: 00007f9c13ae308d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff717c162f R14: 00007f9c14bb3300 R15: 0000000000022000
 </TASK>

Crashes (28):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
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