syzbot


possible deadlock in ovl_maybe_copy_up

Status: upstream: reported C repro on 2020/11/23 10:05
Reported-by: syzbot+c18f2f6a7b08c51e3025@syzkaller.appspotmail.com
First crash: 802d, last: 3d20h

Cause bisection: introduced by (bisect log) [merge commit]:
commit b753c5a7f99f390fc100de18647ce0dcacdceafc
Author: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Wed Aug 14 01:12:45 2019 +0000

  Merge branch 'r8152-RX-improve'

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

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc4-syzkaller-00356-g8f2975c2bb4c #0 Not tainted
------------------------------------------------------
syz-executor255/3605 is trying to acquire lock:
ffff88814ab9a460 (sb_writers#4){.+.+}-{0:0}, at: ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:1083

but task is already holding lock:
ffff8880266553e0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x3b9/0x18b0 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}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747
       process_measurement+0x3b9/0x18b0 security/integrity/ima/ima_main.c:260
       ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3559 [inline]
       path_openat+0x1611/0x2860 fs/namei.c:3713
       do_filp_open+0x1b6/0x400 fs/namei.c:3740
       do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_openat fs/open.c:1342 [inline]
       __se_sys_openat fs/open.c:1337 [inline]
       __x64_sys_openat+0x13f/0x1f0 fs/open.c:1337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/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:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain kernel/locking/lockdep.c:3831 [inline]
       __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
       lock_acquire kernel/locking/lockdep.c:5668 [inline]
       lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1826 [inline]
       sb_start_write include/linux/fs.h:1901 [inline]
       mnt_want_write+0x6c/0x3e0 fs/namespace.c:393
       ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:1083
       ovl_open+0xf1/0x2d0 fs/overlayfs/file.c:152
       do_dentry_open+0x6cc/0x13f0 fs/open.c:882
       vfs_open fs/open.c:1013 [inline]
       dentry_open+0x132/0x1d0 fs/open.c:1029
       ima_calc_file_hash+0x2c6/0x4a0 security/integrity/ima/ima_crypto.c:558
       ima_collect_measurement+0x63e/0x7a0 security/integrity/ima/ima_api.c:292
       process_measurement+0xd1e/0x18b0 security/integrity/ima/ima_main.c:337
       ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:517
       do_open fs/namei.c:3559 [inline]
       path_openat+0x1611/0x2860 fs/namei.c:3713
       do_filp_open+0x1b6/0x400 fs/namei.c:3740
       do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_open fs/open.c:1334 [inline]
       __se_sys_open fs/open.c:1330 [inline]
       __x64_sys_open+0x119/0x1c0 fs/open.c:1330
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/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-executor255/3605:
 #0: ffff8880266553e0 (&iint->mutex){+.+.}-{3:3}, at: process_measurement+0x3b9/0x18b0 security/integrity/ima/ima_main.c:260

stack backtrace:
CPU: 0 PID: 3605 Comm: syz-executor255 Not tainted 6.1.0-rc4-syzkaller-00356-g8f2975c2bb4c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177
 check_prev_add kernel/locking/lockdep.c:3097 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain kernel/locking/lockdep.c:3831 [inline]
 __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1df/0x630 kernel/locking/lockdep.c:5633
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1826 [inline]
 sb_start_write include/linux/fs.h:1901 [inline]
 mnt_want_write+0x6c/0x3e0 fs/namespace.c:393
 ovl_maybe_copy_up+0x11f/0x190 fs/overlayfs/copy_up.c:1083
 ovl_open+0xf1/0x2d0 fs/overlayfs/file.c:152
 do_dentry_open+0x6cc/0x13f0 fs/open.c:882
 vfs_open fs/open.c:1013 [inline]
 dentry_open+0x132/0x1d0 fs/open.c:1029
 ima_calc_file_hash+0x2c6/0x4a0 security/integrity/ima/ima_crypto.c:558
 ima_collect_measurement+0x63e/0x7a0 security/integrity/ima/ima_api.c:292
 process_measurement+0xd1e/0x18b0 security/integrity/ima/ima_main.c:337
 ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:517
 do_open fs/namei.c:3559 [inline]
 path_openat+0x1611/0x2860 fs/namei.c:3713
 do_filp_open+0x1b6/0x400 fs/namei.c:3740
 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
 do_sys_open fs/open.c:1326 [inline]
 __do_sys_open fs/open.c:1334 [inline]
 __se_sys_open fs/open.c:1330 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1330
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8b7519bc69
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffee264fc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f8b7519bc69
RDX: 0000000000000000 RSI: 000000000000007f RDI: 0000000020000180

Crashes (748):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/11/13 01:57 upstream 8f2975c2bb4c 3ead01ad .config strace log report syz C [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2022/12/15 23:56 linux-next 459c73db4069 6f9c033e .config strace log report syz C [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2021/04/03 19:18 linux-next 454c576c3f5e 6a81331a .config console log report syz C possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/29 19:37 upstream c96618275234 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/22 11:54 upstream f67144022885 559a440a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/18 20:33 upstream c1649ec55708 42660d9e .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/15 15:10 upstream 7c6984405241 a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/11 04:58 upstream 7dd4b804e080 48bc529a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/10 04:20 upstream 5a41237ad1d4 48bc529a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/10 01:58 upstream 5a41237ad1d4 48bc529a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/09 18:10 upstream 1fe4fd6f5cad 48bc529a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/09 15:43 upstream 1fe4fd6f5cad 48bc529a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/09 10:13 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/08 23:07 upstream e9ffbf16caa6 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/08 18:25 upstream 93928d485d9d 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/07 04:14 upstream a689b938df39 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/06 23:43 upstream a689b938df39 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/06 04:59 upstream 1f5abbd77e2c 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/06 01:24 upstream 41c03ba9beea 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/05 22:40 upstream 41c03ba9beea 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/05 16:14 upstream 41c03ba9beea 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/05 12:42 upstream 41c03ba9beea 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/05 03:34 upstream 512dee0c00ad 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/04 23:01 upstream 512dee0c00ad 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/04 17:51 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-selinux-root 2023/01/04 08:28 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/04 05:59 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/04 04:49 upstream 69b41ac87e4a 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/04 03:07 upstream 69b41ac87e4a 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/03 23:32 upstream 69b41ac87e4a 1dac8c7a .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/03 13:55 upstream 69b41ac87e4a d43e0eb8 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/03 03:00 upstream 69b41ac87e4a ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/03 00:15 upstream 69b41ac87e4a ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2023/01/02 20:15 upstream 88603b6dc419 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/02 17:43 upstream 88603b6dc419 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/02 11:54 upstream 88603b6dc419 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/02 01:04 upstream 150aae354b81 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/01 23:27 upstream 150aae354b81 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2023/01/01 01:20 upstream e4cf7c25bae5 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/31 21:08 upstream e4cf7c25bae5 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/31 07:54 upstream c8451c141e07 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/31 05:14 upstream c8451c141e07 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/30 20:41 upstream bff687b3dad6 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/30 15:49 upstream bff687b3dad6 ab32d508 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/30 13:42 upstream bff687b3dad6 44712fbc .config console log report info possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream 2022/12/29 22:29 upstream 2258c2dc850b 44712fbc .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-selinux-root 2022/12/29 19:03 upstream 1b929c02afd3 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2022/12/29 11:37 upstream 1b929c02afd3 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-selinux-root 2022/12/27 12:59 upstream 72a85e2b0a1e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-selinux-root 2022/12/27 04:45 upstream 72a85e2b0a1e 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-qemu-upstream-386 2023/01/03 15:01 upstream 69b41ac87e4a d43e0eb8 .config console log report info possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2023/01/22 09:24 linux-next d514392f17fd 559a440a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2022/12/31 01:40 linux-next c76083fac3ba ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2022/12/30 22:45 linux-next c76083fac3ba ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2022/12/28 11:26 linux-next c76083fac3ba 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-linux-next-kasan-gce-root 2022/12/28 06:57 linux-next c76083fac3ba 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in ovl_maybe_copy_up
ci-upstream-kasan-gce-root 2021/01/03 14:41 upstream 3516bd729358 79264ae3 .config console log report info
ci-upstream-kasan-gce-selinux-root 2020/11/22 09:45 upstream a349e4c65960 0d27f508 .config console log report info
ci-upstream-kasan-gce-root 2020/11/22 09:40 upstream a349e4c65960 0d27f508 .config console log report info
* Struck through repros no longer work on HEAD.