syzbot


possible deadlock in process_measurement (2)

Status: fixed on 2021/01/06 01:14
Reported-by: syzbot+18a1619cceea30ed45af@syzkaller.appspotmail.com
Fix commit: 15a8d68e9dc2 mm/hugetlb: a page from buddy is not on any list
First crash: 1037d, last: 668d

Cause bisection: introduced by (bisect log) [merge commit]:
commit bfd93a87eadb03499a5ff02dfebfaf515310d27c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed Oct 24 16:30:39 2018 +0000

  Merge tag 'gfs2-4.20.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Crash: general protection fault in batadv_iv_ogm_queue_add (log)
Repro: C syz .config

Fix bisection: fixed by (bisect log) :
commit 15a8d68e9dc23dc9def4bd7e9563db60f4f86580
Author: Wei Yang <richard.weiyang@linux.alibaba.com>
Date: Tue Oct 13 23:56:33 2020 +0000

  mm/hugetlb: a page from buddy is not on any list

similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in process_measurement (3) C error 123 1d15h 510d 0/24 upstream: reported C repro on 2021/05/10 12:19
linux-4.19 possible deadlock in process_measurement 156 19d 991d 0/1 upstream: reported on 2020/01/15 21:21
upstream possible deadlock in process_measurement C 51 1216d 1448d 0/24 closed as invalid on 2019/07/15 16:35

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.8.0-rc2-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor388/6810 is trying to acquire lock:
ffff88809f4b12c0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x363/0x1760 security/integrity/ima/ima_main.c:247

but task is already holding lock:
ffff888214b78450 (sb_writers#4){.+.+}-{0:0}, at: sb_start_write include/linux/fs.h:1664 [inline]
ffff888214b78450 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:354

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sb_writers#4){.+.+}-{0:0}:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write+0x234/0x470 fs/super.c:1672
       sb_start_write include/linux/fs.h:1664 [inline]
       mnt_want_write+0x3a/0xb0 fs/namespace.c:354
       ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:961
       ovl_open+0xba/0x270 fs/overlayfs/file.c:145
       do_dentry_open+0x501/0x1290 fs/open.c:828
       vfs_open fs/open.c:942 [inline]
       dentry_open+0x132/0x1d0 fs/open.c:958
       ima_calc_file_hash+0x32b/0x570 security/integrity/ima/ima_crypto.c:557
       ima_collect_measurement+0x4ca/0x570 security/integrity/ima/ima_api.c:250
       process_measurement+0xca6/0x1760 security/integrity/ima/ima_main.c:324
       ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:492
       do_open fs/namei.c:3245 [inline]
       path_openat+0x156c/0x2750 fs/namei.c:3360
       do_filp_open+0x17e/0x3c0 fs/namei.c:3387
       do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
       do_sys_open fs/open.c:1195 [inline]
       ksys_open include/linux/syscalls.h:1388 [inline]
       __do_sys_open fs/open.c:1201 [inline]
       __se_sys_open fs/open.c:1199 [inline]
       __x64_sys_open+0x119/0x1c0 fs/open.c:1199
       do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

-> #0 (&iint->mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:2496 [inline]
       check_prevs_add kernel/locking/lockdep.c:2601 [inline]
       validate_chain kernel/locking/lockdep.c:3218 [inline]
       __lock_acquire+0x2acb/0x56e0 kernel/locking/lockdep.c:4380
       lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
       __mutex_lock_common kernel/locking/mutex.c:956 [inline]
       __mutex_lock+0x134/0x10d0 kernel/locking/mutex.c:1103
       process_measurement+0x363/0x1760 security/integrity/ima/ima_main.c:247
       ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:492
       do_open fs/namei.c:3245 [inline]
       path_openat+0x156c/0x2750 fs/namei.c:3360
       do_filp_open+0x17e/0x3c0 fs/namei.c:3387
       do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
       do_sys_open fs/open.c:1195 [inline]
       __do_sys_openat fs/open.c:1209 [inline]
       __se_sys_openat fs/open.c:1204 [inline]
       __x64_sys_openat+0x13f/0x1f0 fs/open.c:1204
       do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz-executor388/6810:
 #0: ffff888214b78450 (sb_writers#4){.+.+}-{0:0}, at: sb_start_write include/linux/fs.h:1664 [inline]
 #0: ffff888214b78450 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:354

stack backtrace:
CPU: 0 PID: 6810 Comm: syz-executor388 Not tainted 5.8.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 check_noncircular+0x324/0x3e0 kernel/locking/lockdep.c:1827
 check_prev_add kernel/locking/lockdep.c:2496 [inline]
 check_prevs_add kernel/locking/lockdep.c:2601 [inline]
 validate_chain kernel/locking/lockdep.c:3218 [inline]
 __lock_acquire+0x2acb/0x56e0 kernel/locking/lockdep.c:4380
 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
 __mutex_lock_common kernel/locking/mutex.c:956 [inline]
 __mutex_lock+0x134/0x10d0 kernel/locking/mutex.c:1103
 process_measurement+0x363/0x1760 security/integrity/ima/ima_main.c:247
 ima_file_check+0xb9/0x100 security/integrity/ima/ima_main.c:492
 do_open fs/namei.c:3245 [inline]
 path_openat+0x156c/0x2750 fs/namei.c:3360
 do_filp_open+0x17e/0x3c0 fs/namei.c:3387
 do_sys_openat2+0x16f/0x3b0 fs/open.c:1179
 do_sys_open fs/open.c:1195 [inline]
 __do_sys_openat fs/open.c:1209 [inline]
 __se_sys_openat fs/open.c:1204 [inline]
 __x64_sys_openat+0x13f/0x1f0 fs/open.c:1204
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x445a99
Code: Bad RIP value.
RSP: 002b:00007f1417523db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00000000006dac48 RCX: 0000000000445a99
RDX: 000000000000275a RSI: 00000000200001c0 RDI: 00000000ffffff9c
RBP: 00000000006dac40 R08: 00007f1417524700 R09: 0000000000000000
R10: 0

Crashes (56):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/06/28 10:58 upstream 1590a2e1c681 ffec44b5 .config log report syz C
ci-upstream-kasan-gce-root 2020/06/28 08:10 upstream 1590a2e1c681 ffec44b5 .config log report syz C
ci-upstream-kasan-gce-smack-root 2020/06/28 03:30 upstream 1590a2e1c681 ffec44b5 .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/11/28 01:17 linux-next 6174f05255e6 486f93ef .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/11/28 00:30 linux-next 6174f05255e6 486f93ef .config log report syz C
ci-upstream-linux-next-kasan-gce-root 2020/06/28 07:48 linux-next 36e3135df4d4 ffec44b5 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2020/10/06 12:06 upstream 7575fdda569b 1880b4a9 .config log report info
ci-upstream-kasan-gce-root 2020/10/01 03:11 upstream 02de58b24d2e 8516f6d3 .config log report info
ci-upstream-kasan-gce-smack-root 2020/09/03 06:40 upstream fc3abb53250a abf9ba4f .config log report
ci-upstream-kasan-gce-selinux-root 2020/08/28 01:37 upstream 15bc20c6af4c 816e0689 .config log report
ci-upstream-kasan-gce-smack-root 2020/07/26 21:55 upstream 04300d66f0a0 51265195 .config log report
ci-upstream-kasan-gce-root 2020/07/01 23:57 upstream 7c30b859a947 39acb39d .config log report
ci-upstream-kasan-gce-root 2020/06/29 01:48 upstream 4e99b32169e8 a2cdad9d .config log report
ci-upstream-kasan-gce-smack-root 2020/06/28 02:48 upstream 1590a2e1c681 ffec44b5 .config log report
ci-upstream-kasan-gce-root 2020/05/18 07:01 upstream b9bbe6ed63b2 37bccd4e .config log report
ci-upstream-kasan-gce-root 2020/04/01 14:43 upstream 1a323ea5356e a34e2c33 .config log report
ci-upstream-kasan-gce-root 2020/03/30 08:57 upstream 7111951b8d49 05736b29 .config log report
ci-upstream-kasan-gce-root 2020/03/30 08:24 upstream 7111951b8d49 05736b29 .config log report
ci-upstream-kasan-gce-smack-root 2020/03/28 11:59 upstream 69c5eea3128e f1ebdfba .config log report
ci-upstream-kasan-gce-smack-root 2020/03/26 02:54 upstream 1b649e0bcae7 e8e6c7d2 .config log report
ci-upstream-kasan-gce-root 2020/03/25 19:49 upstream e2cf67f6689a 41f049cc .config log report
ci-upstream-kasan-gce-smack-root 2020/03/25 12:29 upstream 76ccd234269b 41f049cc .config log report
ci-upstream-kasan-gce-smack-root 2020/02/23 16:11 upstream 0a115e5f23b9 2c36e7a7 .config log report
ci-upstream-kasan-gce-root 2020/02/21 02:08 upstream ca7e1fd1026c bd2a74a3 .config log report
ci-upstream-kasan-gce-selinux-root 2020/02/03 17:17 upstream 754beeec1d90 93e5e335 .config log report
ci-upstream-kasan-gce-root 2020/01/31 00:42 upstream 9f68e3655aae 5ed23f9a .config log report
ci-upstream-kasan-gce-root 2020/01/21 06:16 upstream d96d875ef5dd 8eda0b95 .config log report
ci-upstream-kasan-gce-root 2020/01/19 00:31 upstream 244dc2689085 bc8bc756 .config log report
ci-upstream-kasan-gce-root 2020/01/18 23:38 upstream 244dc2689085 bc8bc756 .config log report
ci-upstream-kasan-gce-smack-root 2020/01/18 10:00 upstream 25e73aadf297 3de7aabb .config log report
ci-upstream-kasan-gce-root 2020/01/17 21:08 upstream ab7541c3addd 3de7aabb .config log report
ci-upstream-kasan-gce-root 2020/01/16 13:19 upstream f5ae2ea6347a 3de7aabb .config log report
ci-upstream-kasan-gce-selinux-root 2020/01/15 18:14 upstream 95e20af9fb9c f9b69507 .config log report
ci-upstream-kasan-gce-root 2020/01/14 13:45 upstream b3a987b0264d 32881205 .config log report
ci-upstream-kasan-gce-root 2020/01/14 04:29 upstream b3a987b0264d 32881205 .config log report
ci-upstream-kasan-gce-root 2020/01/14 01:34 upstream b3a987b0264d 32881205 .config log report
ci-upstream-kasan-gce-root 2020/01/13 21:10 upstream b3a987b0264d 99565c1a .config log report
ci-upstream-kasan-gce-selinux-root 2020/01/13 00:53 upstream 040a3c33623b 53faa9fe .config log report
ci-upstream-kasan-gce-root 2020/01/13 00:06 upstream 040a3c33623b 53faa9fe .config log report
ci-upstream-kasan-gce-root 2019/11/30 17:58 upstream 81b6b96475ac 3a75be00 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/12/03 19:04 linux-next 0eedceafd3a6 e6b0d314 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/28 12:17 linux-next 6174f05255e6 76b4dcc7 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/27 05:38 linux-next 6147c83fd749 5018c946 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/27 04:00 linux-next 6147c83fd749 5018c946 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/26 12:47 linux-next 6147c83fd749 1d2b823e .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/26 02:42 linux-next 62918e6fd7b5 2f1cec62 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/09/08 05:19 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/05 07:11 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/09/05 00:25 linux-next 7a6956579ce6 abf9ba4f .config log report
ci-upstream-linux-next-kasan-gce-root 2020/03/05 17:37 linux-next c99b17ac0399 c88c7b75 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/03/05 02:45 linux-next c99b17ac0399 c88c7b75 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/02/29 14:13 linux-next bdc5461b23ca 59b57593 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/02/09 03:15 linux-next 6dff1565d69c 06150bf1 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/01/12 11:59 linux-next 6c09d7dbb7d3 31290a45 .config log report
ci-upstream-linux-next-kasan-gce-root 2020/01/12 09:21 linux-next 6c09d7dbb7d3 4c04afaa .config log report
* Struck through repros no longer work on HEAD.