syzbot


possible deadlock in vm_mmap_pgoff

Status: upstream: reported C repro on 2021/04/27 15:18
Reported-by: syzbot+f619f7c0a2a5f87694e6@syzkaller.appspotmail.com
First crash: 653d, last: 6d04h

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: possible deadlock in vm_mmap_pgoff (log)
Repro: C syz .config

Fix bisection: the fix commit could be any of (bisect log):
  7d2a07b76933 Linux 5.14
  3cc40a443a04 Merge tag 'nios2_fixes_v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in vm_mmap_pgoff (2) C error 2 65d 69d 0/1 upstream: reported C repro on 2022/11/25 13:47
linux-4.19 possible deadlock in vm_mmap_pgoff 4 546d 668d 0/1 auto-closed as invalid on 2021/12/02 20:13
linux-4.14 possible deadlock in vm_mmap_pgoff reiserfs C 4 24d 61d 0/1 upstream: reported C repro on 2022/12/03 00:54
Last patch testing requests:
Created Duration User Patch Repo Result
2022/10/22 19:30 16m retest repro upstream report log
2022/10/22 19:30 17m retest repro upstream OK log

Sample crash report:
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
6.2.0-rc1-syzkaller-00084-gc8451c141e07 #0 Not tainted
------------------------------------------------------
syz-executor547/5496 is trying to acquire lock:
ffff888028f92090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x77/0xd0 fs/reiserfs/lock.c:27

but task is already holding lock:
ffff888028373e98 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline]
ffff888028373e98 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x14d/0x2b0 mm/util.c:518

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
       __might_fault+0xb2/0x110 mm/memory.c:5647
       reiserfs_ioctl+0x11c/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
       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 (&sbi->lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
       __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
       lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
       __mutex_lock_common+0x1bd/0x26e0 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       reiserfs_write_lock+0x77/0xd0 fs/reiserfs/lock.c:27
       reiserfs_dirty_inode+0xdf/0x230 fs/reiserfs/super.c:704
       __mark_inode_dirty+0x1e7/0x600 fs/fs-writeback.c:2419
       generic_update_time fs/inode.c:1859 [inline]
       inode_update_time fs/inode.c:1872 [inline]
       touch_atime+0x3d3/0x630 fs/inode.c:1944
       file_accessed include/linux/fs.h:2516 [inline]
       generic_file_mmap+0xbb/0x120 mm/filemap.c:3473
       call_mmap include/linux/fs.h:2191 [inline]
       mmap_region+0xfe6/0x1e20 mm/mmap.c:2621
       do_mmap+0x8d9/0xf30 mm/mmap.c:1411
       vm_mmap_pgoff+0x19e/0x2b0 mm/util.c:520
       ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1457
       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(&mm->mmap_lock);
                               lock(&sbi->lock);
                               lock(&mm->mmap_lock);
  lock(&sbi->lock);

 *** DEADLOCK ***

2 locks held by syz-executor547/5496:
 #0: ffff888028373e98 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline]
 #0: ffff888028373e98 (&mm->mmap_lock){++++}-{3:3}, at: vm_mmap_pgoff+0x14d/0x2b0 mm/util.c:518
 #1: ffff8880790d0460 (sb_writers#9){.+.+}-{0:0}, at: file_accessed include/linux/fs.h:2516 [inline]
 #1: ffff8880790d0460 (sb_writers#9){.+.+}-{0:0}, at: generic_file_mmap+0xbb/0x120 mm/filemap.c:3473

stack backtrace:
CPU: 0 PID: 5496 Comm: syz-executor547 Not tainted 6.2.0-rc1-syzkaller-00084-gc8451c141e07 #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+0x1b1/0x290 lib/dump_stack.c:106
 check_noncircular+0x2cc/0x390 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+0x1898/0x6ae0 kernel/locking/lockdep.c:3831
 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5055
 lock_acquire+0x182/0x3c0 kernel/locking/lockdep.c:5668
 __mutex_lock_common+0x1bd/0x26e0 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
 reiserfs_write_lock+0x77/0xd0 fs/reiserfs/lock.c:27
 reiserfs_dirty_inode+0xdf/0x230 fs/reiserfs/super.c:704
 __mark_inode_dirty+0x1e7/0x600 fs/fs-writeback.c:2419
 generic_update_time fs/inode.c:1859 [inline]
 inode_update_time fs/inode.c:1872 [inline]
 touch_atime+0x3d3/0x630 fs/inode.c:1944
 file_accessed include/linux/fs.h:2516 [inline]
 generic_file_mmap+0xbb/0x120 mm/filemap.c:3473
 call_mmap include/linux/fs.h:2191 [inline]
 mmap_region+0xfe6/0x1e20 mm/mmap.c:2621
 do_mmap+0x8d9/0xf30 mm/mmap.c:1411
 vm_mmap_pgoff+0x19e/0x2b0 mm/util.c:520
 ksys_mmap_pgoff+0x48c/0x6d0 mm/mmap.c:1457
 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:0x7f18a9e0cd19
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 15 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:00007f18a9db81f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007f18a9e927a8 RCX: 00007f18a9e0cd19
RDX: 0000000000000001 RSI: 0000000000400000 RDI: 0000000020000000
RBP: 00007f18a9e927a0 R08: 0000000000000004 R09: 0000000000000000
R10: 0000000000010012 R11: 0000000000000246 R12: 00007f18a9e927ac
R13: 00007ffc98f95b0f R14: 00007f18a9db8300 R15: 0000000000022000
 </TASK>

Crashes (38):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-upstream-fs 2022/12/31 22:07 upstream c8451c141e07 ab32d508 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/16 21:46 upstream 84e57d292203 05494336 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2022/12/10 18:00 upstream 3ecc37918c80 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-selinux-root 2021/08/31 09:40 upstream 7d2a07b76933 8f58a0ef .config console log report syz C possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2023/01/21 03:10 upstream ff83fec8179e 559a440a .config strace log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2022/11/27 19:19 upstream faf68e3523c2 74a66371 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-smack-root 2021/07/23 15:15 upstream 9bead1b58c4c bc5f1d88 .config console log report syz C possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/27 11:05 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/22 14:58 upstream 2241ab53cbb5 cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/21 01:43 upstream edc00350d205 cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/19 21:21 upstream 081edded9b38 71197f3a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/18 12:36 upstream c1649ec55708 4620c2d9 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/17 16:39 upstream 6e50979a9c87 42660d9e .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/11 14:29 upstream 7dd4b804e080 96166539 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/11 02:01 upstream 40c18f363a08 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/09 22:36 upstream 1fe4fd6f5cad 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/07 15:37 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/07 15:23 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/05 05:48 upstream 512dee0c00ad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/03 11:35 upstream 69b41ac87e4a f0036e18 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/03 11:04 upstream 69b41ac87e4a f0036e18 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2023/01/01 12:23 upstream e4cf7c25bae5 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/31 02:58 upstream bff687b3dad6 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2022/12/26 04:49 upstream 1b929c02afd3 9da18ae8 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/18 12:01 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/18 08:43 upstream f9ff5644bcc0 05494336 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/10 08:02 upstream 3ecc37918c80 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/10 07:47 upstream 3ecc37918c80 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/09 01:13 upstream 479174d402bc 1034e5fa .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci2-upstream-fs 2022/12/04 11:51 upstream c2bf05db6c78 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2022/12/01 10:20 upstream ef4d3ea40565 4c2a66e8 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-root 2021/10/17 04:18 upstream 304040fb4909 0c5d9412 .config console log report info possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-smack-root 2021/09/25 12:16 upstream 7d42e9818258 8cac236e .config console log report info possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-smack-root 2021/09/25 08:31 upstream 4c4f0c2bf341 8cac236e .config console log report info possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-smack-root 2021/09/24 22:43 upstream 4c4f0c2bf341 8cac236e .config console log report info possible deadlock in vm_mmap_pgoff
ci-upstream-kasan-gce-smack-root 2021/09/24 21:29 upstream 4c4f0c2bf341 8cac236e .config console log report info possible deadlock in vm_mmap_pgoff
ci-qemu-upstream 2021/04/20 10:31 upstream 7af08140979a c0ced557 .config console log report info possible deadlock in vm_mmap_pgoff
ci-upstream-linux-next-kasan-gce-root 2022/11/24 12:08 linux-next 15f3bff12cf6 12c66417 .config console log report info [disk image] [vmlinux] [kernel image] possible deadlock in vm_mmap_pgoff
* Struck through repros no longer work on HEAD.