syzbot


possible deadlock in vfs_fallocate

Status: upstream: reported C repro on 2019/04/21 16:20
Reported-by: syzbot+368834a2d8d850ed556f@syzkaller.appspotmail.com
First crash: 2043d, last: 816d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in vfs_fallocate fs C 3981 2288d 2400d 11/28 fixed on 2019/03/28 12:00
Last patch testing requests (10)
Created Duration User Patch Repo Result
2023/03/06 11:32 0m retest repro linux-4.14.y error
2023/03/06 09:32 0m retest repro linux-4.14.y error
2023/03/06 08:32 1m retest repro linux-4.14.y error
2023/03/06 07:32 0m retest repro linux-4.14.y error
2023/03/06 06:32 1m retest repro linux-4.14.y error
2023/03/06 05:32 0m retest repro linux-4.14.y error
2023/03/06 04:32 0m retest repro linux-4.14.y error
2023/03/06 03:32 0m retest repro linux-4.14.y error
2023/03/06 02:32 0m retest repro linux-4.14.y error
2023/03/06 01:32 0m retest repro linux-4.14.y error
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2022/10/13 02:12 0m bisect fix linux-4.14.y error job log
2022/08/30 08:16 25m bisect fix linux-4.14.y OK (0) job log log
2022/06/23 12:52 21m bisect fix linux-4.14.y OK (0) job log log
2022/05/24 12:20 32m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.288-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor303/7973 is trying to acquire lock:
 (sb_writers#6){.+.+}, at: [<ffffffff81863b11>] file_start_write include/linux/fs.h:2714 [inline]
 (sb_writers#6){.+.+}, at: [<ffffffff81863b11>] vfs_fallocate+0x5c1/0x790 fs/open.c:318

but task is already holding lock:
 (ashmem_mutex){+.+.}, at: [<ffffffff858d8ace>] ashmem_shrink_scan drivers/staging/android/ashmem.c:494 [inline]
 (ashmem_mutex){+.+.}, at: [<ffffffff858d8ace>] ashmem_ioctl+0x27e/0xd00 drivers/staging/android/ashmem.c:843

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (ashmem_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       ashmem_mmap+0x50/0x5c0 drivers/staging/android/ashmem.c:393
       call_mmap include/linux/fs.h:1785 [inline]
       mmap_region+0xa1a/0x1220 mm/mmap.c:1717
       do_mmap+0x5b3/0xcb0 mm/mmap.c:1495
       do_mmap_pgoff include/linux/mm.h:2187 [inline]
       vm_mmap_pgoff+0x14e/0x1a0 mm/util.c:366
       SYSC_mmap_pgoff mm/mmap.c:1545 [inline]
       SyS_mmap_pgoff+0x249/0x510 mm/mmap.c:1503
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #2 (&mm->mmap_sem){++++}:
       __might_fault mm/memory.c:4700 [inline]
       __might_fault+0x137/0x1b0 mm/memory.c:4685
       _copy_to_user+0x27/0xd0 lib/usercopy.c:25
       copy_to_user include/linux/uaccess.h:155 [inline]
       filldir+0x1d5/0x390 fs/readdir.c:237
       dir_emit_dot include/linux/fs.h:3361 [inline]
       dir_emit_dots include/linux/fs.h:3372 [inline]
       dcache_readdir+0x180/0x860 fs/libfs.c:192
       iterate_dir+0x1a0/0x5e0 fs/readdir.c:52
       SYSC_getdents fs/readdir.c:272 [inline]
       SyS_getdents+0x125/0x240 fs/readdir.c:253
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #1 (&type->i_mutex_dir_key#5){++++}:
       down_write+0x34/0x90 kernel/locking/rwsem.c:54
       inode_lock include/linux/fs.h:719 [inline]
       do_last fs/namei.c:3331 [inline]
       path_openat+0xde2/0x2970 fs/namei.c:3569
       do_filp_open+0x179/0x3c0 fs/namei.c:3603
       do_sys_open+0x296/0x410 fs/open.c:1081
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

-> #0 (sb_writers#6){.+.+}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
       percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
       __sb_start_write+0x64/0x260 fs/super.c:1342
       file_start_write include/linux/fs.h:2714 [inline]
       vfs_fallocate+0x5c1/0x790 fs/open.c:318
       ashmem_shrink_scan.part.0+0x135/0x3d0 drivers/staging/android/ashmem.c:501
       ashmem_shrink_scan drivers/staging/android/ashmem.c:494 [inline]
       ashmem_ioctl+0x294/0xd00 drivers/staging/android/ashmem.c:843
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

Chain exists of:
  sb_writers#6 --> &mm->mmap_sem --> ashmem_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ashmem_mutex);
                               lock(&mm->mmap_sem);
                               lock(ashmem_mutex);
  lock(sb_writers#6);

 *** DEADLOCK ***

1 lock held by syz-executor303/7973:
 #0:  (ashmem_mutex){+.+.}, at: [<ffffffff858d8ace>] ashmem_shrink_scan drivers/staging/android/ashmem.c:494 [inline]
 #0:  (ashmem_mutex){+.+.}, at: [<ffffffff858d8ace>] ashmem_ioctl+0x27e/0xd00 drivers/staging/android/ashmem.c:843

stack backtrace:
CPU: 0 PID: 7973 Comm: syz-executor303 Not tainted 4.14.288-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline]
 percpu_down_read include/linux/percpu-rwsem.h:59 [inline]
 __sb_start_write+0x64/0x260 fs/super.c:1342
 file_start_write include/linux/fs.h:2714 [inline]
 vfs_fallocate+0x5c1/0x790 fs/open.c:318
 ashmem_shrink_scan.part.0+0x135/0x3d0 drivers/staging/android/ashmem.c:501
 ashmem_shrink_scan drivers/staging/android/ashmem.c:494 [inline]
 ashmem_ioctl+0x294/0xd00 drivers/staging/android/ashmem.c:843
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7fc378e8d089
RSP: 002b:00007fff187071b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000

Crashes (2871):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/07/17 10:31 linux-4.14.y 424a46ea058e 95cb00d1 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/19 08:30 linux-4.14.y 162b95d01320 a2fe1cb5 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/12 09:59 linux-4.14.y 46914f96189b 6972b106 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/10 18:54 linux-4.14.y 46914f96189b 6972b106 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/10 02:15 linux-4.14.y 46914f96189b 6972b106 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/08 05:26 linux-4.14.y 94cb1fed447a 6972b106 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/08/03 15:37 linux-4.14.y ce4d1565392b 6c236867 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/04/21 04:39 linux-4.14.y cf256fbcbe34 c0ced557 .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/03/20 05:32 linux-4.14.y cb83ddcd5332 3d01c4de .config console log report syz C ci2-linux-4-14 possible deadlock in vfs_fallocate
2020/04/12 15:17 linux-4.14.y 4520f06b03ae 36b0b050 .config console log report syz C ci2-linux-4-14
2019/09/29 23:15 linux-4.14.y f6e27dbb1afa c1ad5441 .config console log report syz C ci2-linux-4-14
2019/09/01 21:12 linux-4.14.y 01fd1694b93c bad3cce2 .config console log report syz C ci2-linux-4-14
2019/08/27 08:52 linux-4.14.y b5260801526c d21c5d9d .config console log report syz C ci2-linux-4-14
2019/04/21 15:40 linux-4.14.y 68d7a45eec10 b0e8efcb .config console log report syz C ci2-linux-4-14
2022/07/29 18:23 linux-4.14.y b641242202ed fef302b1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/29 14:24 linux-4.14.y 9c3bf9cf362f fef302b1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/29 12:33 linux-4.14.y 9c3bf9cf362f fef302b1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/28 00:13 linux-4.14.y 9c3bf9cf362f fb95c74d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/27 21:36 linux-4.14.y 9c3bf9cf362f fb95c74d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/27 11:38 linux-4.14.y 9c3bf9cf362f da9d0366 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/26 23:23 linux-4.14.y 9c3bf9cf362f ae971e66 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/26 12:20 linux-4.14.y 9c3bf9cf362f 279b89c2 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/26 01:54 linux-4.14.y 9c3bf9cf362f 34795c51 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/25 22:03 linux-4.14.y 9c3bf9cf362f 34795c51 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/25 14:34 linux-4.14.y 9c3bf9cf362f 664c519c .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/22 11:41 linux-4.14.y 9c3bf9cf362f 22343af4 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/21 23:45 linux-4.14.y 9c3bf9cf362f 5e6028b9 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/21 22:22 linux-4.14.y 9c3bf9cf362f 5e6028b9 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/21 11:17 linux-4.14.y 424a46ea058e 6e67af9d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/20 16:39 linux-4.14.y 424a46ea058e 88cb1383 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/20 14:15 linux-4.14.y 424a46ea058e 88cb1383 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/19 20:27 linux-4.14.y 424a46ea058e 775344bc .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/19 12:05 linux-4.14.y 424a46ea058e 72a3cc0c .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/19 09:57 linux-4.14.y 424a46ea058e 72a3cc0c .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/18 17:12 linux-4.14.y 424a46ea058e ff988920 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/18 15:00 linux-4.14.y 424a46ea058e ff988920 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/07/17 10:18 linux-4.14.y 424a46ea058e 95cb00d1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/24 12:19 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/23 22:35 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/23 15:10 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/22 20:57 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/22 19:41 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/22 17:21 linux-4.14.y 15a1c6b6f516 131df97d .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/21 18:12 linux-4.14.y 15a1c6b6f516 2738b391 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/21 17:01 linux-4.14.y 15a1c6b6f516 2738b391 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/21 15:51 linux-4.14.y 15a1c6b6f516 2738b391 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/21 11:57 linux-4.14.y 15a1c6b6f516 d4befee1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/21 06:02 linux-4.14.y 15a1c6b6f516 d4befee1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 17:44 linux-4.14.y 15a1c6b6f516 d4befee1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 15:54 linux-4.14.y 15a1c6b6f516 d4befee1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 15:28 linux-4.14.y 15a1c6b6f516 d4befee1 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 10:12 linux-4.14.y 15a1c6b6f516 7d7bc738 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 09:03 linux-4.14.y 15a1c6b6f516 7d7bc738 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 07:31 linux-4.14.y 74766a973637 7d7bc738 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 05:28 linux-4.14.y 74766a973637 7d7bc738 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/20 03:18 linux-4.14.y 74766a973637 7d7bc738 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/19 19:12 linux-4.14.y 74766a973637 33fc6ed6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/19 15:36 linux-4.14.y 74766a973637 33fc6ed6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/19 13:48 linux-4.14.y 74766a973637 c334415e .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/19 12:31 linux-4.14.y 74766a973637 c334415e .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/18 03:52 linux-4.14.y 74766a973637 8bcc32a6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/17 10:29 linux-4.14.y 74766a973637 8bcc32a6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/17 00:01 linux-4.14.y 74766a973637 8bcc32a6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2022/04/16 17:21 linux-4.14.y 74766a973637 8bcc32a6 .config console log report info ci2-linux-4-14 possible deadlock in vfs_fallocate
2021/01/13 21:37 linux-4.14.y f79dc86058bc a945f0a3 .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.