syzbot


possible deadlock in mnt_want_write

Status: upstream: reported C repro on 2023/03/28 13:05
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+b595038f3a0e8023266e@syzkaller.appspotmail.com
First crash: 615d, last: 372d
Fix commit to backport (bisect log) :
tree: upstream
commit a0e6a017ab56936c0405fe914a793b241ed25ee0
Author: MaΓ­ra Canal <mcanal@igalia.com>
Date: Tue May 23 12:32:08 2023 +0000

  drm/vkms: Fix race-condition between the hrtimer and the atomic commit

  
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: possible deadlock in mnt_want_write (log)
Repro: C syz .config
  
Bug presence (3)
Date Name Commit Repro Result
2023/11/20 linux-6.1.y (ToT) 69e434a1cb21 C [report] possible deadlock in mnt_want_write
2023/05/15 upstream (ToT) f1fcbaa18b28 C [report] possible deadlock in mnt_want_write
2023/11/20 upstream (ToT) 98b1cc82c4af C Didn't crash
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in mnt_want_write missing-backport C done 117 371d 623d 0/3 auto-obsoleted due to no activity on 2024/10/15 12:27
upstream possible deadlock in mnt_want_write fs C done done 662 1517d 2324d 15/28 fixed on 2020/11/16 12:12
linux-4.19 possible deadlock in mnt_want_write romfs C 730 637d 2054d 0/1 upstream: reported C repro on 2019/04/19 16:54
android-49 possible deadlock in mnt_want_write 1 2307d 2307d 0/3 auto-closed as invalid on 2019/02/22 14:57
upstream possible deadlock in mnt_want_write (4) kernfs 1 86d 82d 0/28 upstream: reported on 2024/09/11 14:21
upstream possible deadlock in mnt_want_write (2) integrity overlayfs C done 867 398d 1266d 25/28 fixed on 2023/12/21 01:43
upstream possible deadlock in mnt_want_write (3) kernfs 9 234d 337d 0/28 auto-obsoleted due to no activity on 2024/07/22 10:45
linux-4.14 possible deadlock in mnt_want_write ubifs C 10467 637d 2049d 0/1 upstream: reported C repro on 2019/04/25 05:09
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/09/21 11:56 18m pz010001011111@proton.me https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git linux-6.1.y OK log
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2023/12/05 23:01 4h33m fix candidate upstream OK (1) job log
2023/10/29 18:34 1h09m bisect fix linux-6.1.y OK (0) job log log
2023/06/14 11:52 41m bisect fix linux-6.1.y OK (0) job log log

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

but task is already holding lock:
ffff888024c2b860 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7fe/0x1cf0 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+0x1f8/0x5a0 kernel/locking/lockdep.c:5661
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       process_measurement+0x7fe/0x1cf0 security/integrity/ima/ima_main.c:260
       ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520
       do_open fs/namei.c:3560 [inline]
       path_openat+0x2687/0x2e60 fs/namei.c:3715
       do_filp_open+0x230/0x480 fs/namei.c:3742
       do_sys_openat2+0x13b/0x500 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1345
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (sb_writers#4){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3824
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5048
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5661
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1832 [inline]
       sb_start_write+0x4d/0x1c0 include/linux/fs.h:1907
       mnt_want_write+0x3b/0x80 fs/namespace.c:393
       ovl_maybe_copy_up+0x111/0x180 fs/overlayfs/copy_up.c:1090
       ovl_open+0x108/0x2a0 fs/overlayfs/file.c:152
       do_dentry_open+0x7f9/0x10f0 fs/open.c:882
       vfs_open fs/open.c:1013 [inline]
       dentry_open+0xc1/0x120 fs/open.c:1029
       ima_calc_file_hash+0x159/0x1c00 security/integrity/ima/ima_crypto.c:558
       ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292
       process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337
       ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520
       do_open fs/namei.c:3560 [inline]
       path_openat+0x2687/0x2e60 fs/namei.c:3715
       do_filp_open+0x230/0x480 fs/namei.c:3742
       do_sys_openat2+0x13b/0x500 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_openat fs/open.c:1350 [inline]
       __se_sys_openat fs/open.c:1345 [inline]
       __x64_sys_openat+0x243/0x290 fs/open.c:1345
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

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-executor180/3540:
 #0: ffff888024c2b860 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x7fe/0x1cf0 security/integrity/ima/ima_main.c:260

stack backtrace:
CPU: 1 PID: 3540 Comm: syz-executor180 Not tainted 6.1.62-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3824
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5048
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5661
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1832 [inline]
 sb_start_write+0x4d/0x1c0 include/linux/fs.h:1907
 mnt_want_write+0x3b/0x80 fs/namespace.c:393
 ovl_maybe_copy_up+0x111/0x180 fs/overlayfs/copy_up.c:1090
 ovl_open+0x108/0x2a0 fs/overlayfs/file.c:152
 do_dentry_open+0x7f9/0x10f0 fs/open.c:882
 vfs_open fs/open.c:1013 [inline]
 dentry_open+0xc1/0x120 fs/open.c:1029
 ima_calc_file_hash+0x159/0x1c00 security/integrity/ima/ima_crypto.c:558
 ima_collect_measurement+0x4d4/0x970 security/integrity/ima/ima_api.c:292
 process_measurement+0x1018/0x1cf0 security/integrity/ima/ima_main.c:337
 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:520
 do_open fs/namei.c:3560 [inline]
 path_openat+0x2687/0x2e60 fs/namei.c:3715
 do_filp_open+0x230/0x480 fs/namei.c:3742
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f2bdb2124e9
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 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:00007ffca0f6d228 EFLAGS: 00000246 ORIG_RAX: 0000000000000101

Crashes (56):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/11/09 10:17 linux-6.1.y fb2635ac69ab 4862372a .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/05/15 01:29 linux-6.1.y bf4ad6fa4e53 2b9ba477 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/27 10:30 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/27 07:12 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/26 23:01 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/26 20:09 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/26 00:04 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/25 04:13 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/24 06:38 linux-6.1.y 69e434a1cb21 5b429f39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/23 02:28 linux-6.1.y 69e434a1cb21 03e12510 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/22 10:01 linux-6.1.y 69e434a1cb21 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/22 08:00 linux-6.1.y 69e434a1cb21 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/21 01:27 linux-6.1.y 69e434a1cb21 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/21 01:12 linux-6.1.y 69e434a1cb21 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/20 15:19 linux-6.1.y 69e434a1cb21 cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/18 13:52 linux-6.1.y fb2635ac69ab cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/18 13:31 linux-6.1.y fb2635ac69ab cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/18 02:54 linux-6.1.y fb2635ac69ab cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/14 16:31 linux-6.1.y fb2635ac69ab cb976f63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/13 04:03 linux-6.1.y fb2635ac69ab 6d6dbf8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/13 03:44 linux-6.1.y fb2635ac69ab 6d6dbf8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/11 04:09 linux-6.1.y fb2635ac69ab d80eec66 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/11 01:51 linux-6.1.y fb2635ac69ab d80eec66 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 19:37 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 19:09 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 18:57 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 18:57 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 18:39 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 18:39 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/10 18:25 linux-6.1.y fb2635ac69ab 45e9b83e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/09 08:47 linux-6.1.y fb2635ac69ab 4862372a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/04 15:36 linux-6.1.y 4a61839152cc 500bfdc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/11/04 12:09 linux-6.1.y 4a61839152cc 500bfdc4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/27 05:51 linux-6.1.y d23900f974e0 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/15 06:00 linux-6.1.y 09045dae0d90 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/06 19:32 linux-6.1.y c2cbfe5f5122 72324844 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/05 07:11 linux-6.1.y c2cbfe5f5122 0b6286dc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/04 21:48 linux-6.1.y c2cbfe5f5122 db3306a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/04 13:28 linux-6.1.y c2cbfe5f5122 db3306a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/04 08:39 linux-6.1.y c2cbfe5f5122 696ea0d2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/09/04 07:51 linux-6.1.y c2cbfe5f5122 696ea0d2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/07/21 15:07 linux-6.1.y a456e1743881 28847498 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/07/12 04:16 linux-6.1.y 61fd484b2cf6 2f19aa4f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/07/09 01:49 linux-6.1.y 61fd484b2cf6 668cb1fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/07/05 02:19 linux-6.1.y 0f4ac6b4c5f0 f99c2404 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/06/17 08:53 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/06/17 08:26 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/06/17 07:40 linux-6.1.y ca87e77a2ef8 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/04/24 07:21 linux-6.1.y f17b0ab65d17 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
2023/03/28 13:05 linux-6.1.y e3a87a10f259 47f3aaf1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in mnt_want_write
* Struck through repros no longer work on HEAD.