syzbot


possible deadlock in shmem_fallocate

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+9fce278e78218b0d5799@syzkaller.appspotmail.com
First crash: 2398d, last: 1814d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in shmem_fallocate (2) 2 1649d 1717d 0/1 auto-closed as invalid on 2020/09/14 02:25
upstream possible deadlock in shmem_fallocate mm 8087 2591d 2634d 0/28 closed as invalid on 2017/11/05 09:38
linux-4.19 possible deadlock in shmem_fallocate 1 1939d 1939d 0/1 auto-closed as invalid on 2019/11/29 05:22
android-414 possible deadlock in shmem_fallocate C 7876 1814d 2051d 0/1 public: reported C repro on 2019/04/11 00:00
upstream possible deadlock in shmem_fallocate (3) mm 1 1903d 1899d 0/28 auto-closed as invalid on 2019/11/05 02:34
upstream possible deadlock in shmem_fallocate (4) mm C done 81 1577d 1791d 15/28 fixed on 2020/09/16 22:51
upstream possible deadlock in shmem_fallocate (2) mm C 1325 2086d 2295d 11/28 fixed on 2019/03/28 12:00

Sample crash report:
random: crng init done
======================================================
[ INFO: possible circular locking dependency detected ]
4.9.194+ #0 Not tainted
-------------------------------------------------------
syz-executor488/2080 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<0000000039d4492a>] inode_lock include/linux/fs.h:771 [inline]
 (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<0000000039d4492a>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2681
but task is already holding lock:
 (ashmem_mutex){+.+.+.}, at: [<00000000f5700507>] ashmem_shrink_scan+0x56/0x4c0 drivers/staging/android/ashmem.c:455
which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
       __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       mutex_lock_nested+0xc7/0x920 kernel/locking/mutex.c:621
       ashmem_mmap+0x53/0x470 drivers/staging/android/ashmem.c:378
       mmap_region+0x7e7/0xfa0 mm/mmap.c:1726
       do_mmap+0x539/0xbc0 mm/mmap.c:1505
       do_mmap_pgoff include/linux/mm.h:2071 [inline]
       vm_mmap_pgoff+0x179/0x1c0 mm/util.c:329
       SYSC_mmap_pgoff mm/mmap.c:1555 [inline]
       SyS_mmap_pgoff+0xfa/0x1b0 mm/mmap.c:1513
       SYSC_mmap arch/x86/kernel/sys_x86_64.c:96 [inline]
       SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:87
       do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
       entry_SYSCALL_64_after_swapgs+0x5d/0xdb

       lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
       down_read+0x44/0xb0 kernel/locking/rwsem.c:22
       __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337
       do_page_fault+0x28/0x30 arch/x86/mm/fault.c:1464
       page_fault+0x25/0x30 arch/x86/entry/entry_64.S:956
       generic_perform_write+0x1b6/0x500 mm/filemap.c:2929
       __generic_file_write_iter+0x340/0x530 mm/filemap.c:3064
       generic_file_write_iter+0x38a/0x630 mm/filemap.c:3092
       new_sync_write fs/read_write.c:498 [inline]
       __vfs_write+0x3c1/0x560 fs/read_write.c:511
       vfs_write+0x185/0x520 fs/read_write.c:559
       SYSC_pwrite64 fs/read_write.c:649 [inline]
       SyS_pwrite64+0x13f/0x170 fs/read_write.c:636
       do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
       entry_SYSCALL_64_after_swapgs+0x5d/0xdb

       check_prev_add kernel/locking/lockdep.c:1828 [inline]
       check_prevs_add kernel/locking/lockdep.c:1938 [inline]
       validate_chain kernel/locking/lockdep.c:2265 [inline]
       __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345
       lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
       down_write+0x41/0xa0 kernel/locking/rwsem.c:52
       inode_lock include/linux/fs.h:771 [inline]
       shmem_fallocate+0x143/0xab0 mm/shmem.c:2681
       ashmem_shrink_scan drivers/staging/android/ashmem.c:462 [inline]
       ashmem_shrink_scan+0x1c3/0x4c0 drivers/staging/android/ashmem.c:446
       ashmem_ioctl+0x29b/0xdd0 drivers/staging/android/ashmem.c:804
       vfs_ioctl fs/ioctl.c:43 [inline]
       file_ioctl fs/ioctl.c:493 [inline]
       do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677
       SYSC_ioctl fs/ioctl.c:694 [inline]
       SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
       do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
       entry_SYSCALL_64_after_swapgs+0x5d/0xdb

other info that might help us debug this:

Chain exists of:
 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ashmem_mutex);
                               lock(&mm->mmap_sem);
                               lock(ashmem_mutex);
  lock(&sb->s_type->i_mutex_key#10);

 *** DEADLOCK ***

1 lock held by syz-executor488/2080:
 #0:  (ashmem_mutex){+.+.+.}, at: [<00000000f5700507>] ashmem_shrink_scan+0x56/0x4c0 drivers/staging/android/ashmem.c:455

stack backtrace:
CPU: 1 PID: 2080 Comm: syz-executor488 Not tainted 4.9.194+ #0
 ffff8801c561f6b8 ffffffff81b67001 ffffffff83cba170 ffffffff83cce210
 ffffffff83cb0990 ffffffff84252000 ffff8801d1ca0000 ffff8801c561f710
 ffffffff81406d83 0000000000000000 ffffffff8402b000 ffff8801d1ca08d8
Call Trace:
 [<0000000098d3fab7>] __dump_stack lib/dump_stack.c:15 [inline]
 [<0000000098d3fab7>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
 [<0000000011d79d4d>] print_circular_bug.cold+0x2f6/0x454 kernel/locking/lockdep.c:1202
 [<0000000092edc2e5>] check_prev_add kernel/locking/lockdep.c:1828 [inline]
 [<0000000092edc2e5>] check_prevs_add kernel/locking/lockdep.c:1938 [inline]
 [<0000000092edc2e5>] validate_chain kernel/locking/lockdep.c:2265 [inline]
 [<0000000092edc2e5>] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345
 [<0000000041cf82ef>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
 [<0000000018b1a8aa>] down_write+0x41/0xa0 kernel/locking/rwsem.c:52
 [<0000000039d4492a>] inode_lock include/linux/fs.h:771 [inline]
 [<0000000039d4492a>] shmem_fallocate+0x143/0xab0 mm/shmem.c:2681
 [<00000000d4ef63f7>] ashmem_shrink_scan drivers/staging/android/ashmem.c:462 [inline]
 [<00000000d4ef63f7>] ashmem_shrink_scan+0x1c3/0x4c0 drivers/staging/android/ashmem.c:446
 [<00000000b49c0f42>] ashmem_ioctl+0x29b/0xdd0 drivers/staging/android/ashmem.c:804
 [<00000000f7c6a53b>] vfs_ioctl fs/ioctl.c:43 [inline]
 [<00000000f7c6a53b>] file_ioctl fs/ioctl.c:493 [inline]
 [<00000000f7c6a53b>] do_vfs_ioctl+0xb87/0x11d0 fs/ioctl.c:677
 [<000000009b17ebe3>] SYSC_ioctl fs/ioctl.c:694 [inline]
 [<000000009b17ebe3>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
 [<00000000d1c7aa44>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 [<00000000577c685c>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Crashes (2441):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/07 04:31 https://android.googlesource.com/kernel/common android-4.9 7fe05eede1c8 f3f7d9c8 .config console log report syz C ci-android-49-kasan-gce-root
2018/09/07 19:11 https://android.googlesource.com/kernel/common android-4.9 dcae9fa1319b 69cfeb80 .config console log report syz C ci-android-49-kasan-gce-root
2018/08/31 02:35 https://android.googlesource.com/kernel/common android-4.9 09eb2ba5ed0c 938220fd .config console log report syz C ci-android-49-kasan-gce-root
2018/08/20 18:40 https://android.googlesource.com/kernel/common android-4.9 54068d61e7d8 2dc4378f .config console log report syz C ci-android-49-kasan-gce-root
2018/08/14 16:27 https://android.googlesource.com/kernel/common android-4.9 9dc978d43ec7 7a88b141 .config console log report syz C ci-android-49-kasan-gce-root
2018/08/12 20:45 https://android.googlesource.com/kernel/common android-4.9 9dc978d43ec7 7a88b141 .config console log report syz C ci-android-49-kasan-gce-root
2018/08/09 19:05 https://android.googlesource.com/kernel/common android-4.9 92e87041ed2d 1fb62d58 .config console log report syz C ci-android-49-kasan-gce-root
2018/04/29 15:09 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d d5a5d045 .config console log report syz C ci-android-49-kasan-gce-root
2019/12/04 09:13 android-4.9 a36b5017c810 0ecb9746 .config console log report ci-android-49-kasan-gce-root
2019/12/03 02:50 android-4.9 a36b5017c810 ab342da3 .config console log report ci-android-49-kasan-gce-root
2019/12/02 21:30 android-4.9 a36b5017c810 ab342da3 .config console log report ci-android-49-kasan-gce-root
2019/12/02 17:50 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/02 06:59 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/01 23:26 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/01 21:48 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 20:07 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 17:31 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 14:54 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 13:33 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/11/30 22:37 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/11/30 21:35 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/11/30 18:38 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 17:06 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 14:56 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 00:35 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/29 22:47 android-4.9 a36b5017c810 d29b9e84 .config console log report ci-android-49-kasan-gce-root
2019/11/29 12:00 android-4.9 a36b5017c810 d29b9e84 .config console log report ci-android-49-kasan-gce-root
2019/11/29 08:53 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/29 07:03 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/28 23:48 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/28 22:09 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 19:56 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 14:09 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 12:11 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 11:11 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 08:12 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 16:34 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 14:34 android-4.9 13ff5130ff6e 5a38f3f0 .config console log report ci-android-49-kasan-gce-root
2019/11/27 10:59 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 17:45 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 16:29 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 12:52 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 10:01 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 05:24 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 00:42 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/25 21:32 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
2019/11/25 20:13 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
2019/11/25 17:44 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
2019/11/25 13:01 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.