syzbot


possible deadlock in __do_page_fault

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+fb9dbeca926817d3d7e2@syzkaller.appspotmail.com
First crash: 2254d, last: 1825d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 possible deadlock in __do_page_fault C 3356 1825d 2062d 0/1 public: reported C repro on 2019/04/11 00:00
upstream possible deadlock in __do_page_fault fs mm C 820 2097d 2264d 11/28 fixed on 2019/03/28 12:00
upstream possible deadlock in __do_page_fault (2) ext4 C done 8 2007d 2011d 0/28 closed as invalid on 2019/06/23 22:18

Sample crash report:
hrtimer: interrupt took 25792 ns
======================================================
[ INFO: possible circular locking dependency detected ]
4.9.190+ #5 Not tainted
-------------------------------------------------------
syz-executor534/2086 is trying to acquire lock:
 (&mm->mmap_sem){++++++}, at: [<000000002bcfb8bc>] __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337
but task is already holding lock:
 (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000e5dcf918>] inode_lock include/linux/fs.h:771 [inline]
 (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000e5dcf918>] generic_file_write_iter+0x9a/0x630 mm/filemap.c:3089
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
       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

       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

       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_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_write fs/read_write.c:607 [inline]
       SyS_write+0x121/0x270 fs/read_write.c:599
       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(&sb->s_type->i_mutex_key#10);
                               lock(ashmem_mutex);
                               lock(&sb->s_type->i_mutex_key#10);
  lock(&mm->mmap_sem);

 *** DEADLOCK ***

2 locks held by syz-executor534/2086:
 #0:  (sb_writers#6){.+.+.+}, at: [<000000003f868c80>] file_start_write include/linux/fs.h:2646 [inline]
 #0:  (sb_writers#6){.+.+.+}, at: [<000000003f868c80>] vfs_write+0x3e9/0x520 fs/read_write.c:558
 #1:  (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000e5dcf918>] inode_lock include/linux/fs.h:771 [inline]
 #1:  (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<00000000e5dcf918>] generic_file_write_iter+0x9a/0x630 mm/filemap.c:3089

stack backtrace:
CPU: 1 PID: 2086 Comm: syz-executor534 Not tainted 4.9.190+ #5
 ffff8801ced0f5d8 ffffffff81b65c51 ffffffff83caf440 ffffffff83cb8dd0
 ffffffff83ccccc0 ffffffff84250fc0 ffff8801cf2b97c0 ffff8801ced0f630
 ffffffff814069f3 dffffc0000000000 ffffffff84029bc0 ffff8801cf2ba0c0
Call Trace:
 [<0000000024ac8c2e>] __dump_stack lib/dump_stack.c:15 [inline]
 [<0000000024ac8c2e>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
 [<000000007767f001>] print_circular_bug.cold+0x2f6/0x454 kernel/locking/lockdep.c:1202
 [<0000000066084f99>] check_prev_add kernel/locking/lockdep.c:1828 [inline]
 [<0000000066084f99>] check_prevs_add kernel/locking/lockdep.c:1938 [inline]
 [<0000000066084f99>] validate_chain kernel/locking/lockdep.c:2265 [inline]
 [<0000000066084f99>] __lock_acquire+0x2d22/0x4390 kernel/locking/lockdep.c:3345
 [<000000001e85c3ae>] lock_acquire+0x133/0x3d0 kernel/locking/lockdep.c:3756
 [<00000000c8812813>] down_read+0x44/0xb0 kernel/locking/rwsem.c:22
 [<000000002bcfb8bc>] __do_page_fault+0x7bd/0xa60 arch/x86/mm/fault.c:1337
 [<0000000006c7666f>] do_page_fault+0x28/0x30 arch/x86/mm/fault.c:1464
 [<000000006dd33d96>] page_fault+0x25/0x30 arch/x86/entry/entry_64.S:956
 [<00000000cc068bea>] generic_perform_write+0x1b6/0x500 mm/filemap.c:2929
 [<00000000f940ce63>] __generic_file_write_iter+0x340/0x530 mm/filemap.c:3064
 [<00000000103d1f22>] generic_file_write_iter+0x38a/0x630 mm/filemap.c:3092
 [<00000000f36b52b3>] new_sync_write fs/read_write.c:498 [inline]
 [<00000000f36b52b3>] __vfs_write+0x3c1/0x560 fs/read_write.c:511
 [<00000000bef1e415>] vfs_write+0x185/0x520 fs/read_write.c:559
 [<0000000001d6d3d2>] SYSC_write fs/read_write.c:607 [inline]
 [<0000000001d6d3d2>] SyS_write+0x121/0x270 fs/read_write.c:599
 [<0000000069256ca3>] do_syscall_64+0x1ad/0x5c0 arch/x86/entry/common.c:288
 [<00000000e706def4>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Crashes (801):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/08/27 08:50 https://android.googlesource.com/kernel/common android-4.9 476e7ea6e7a1 d21c5d9d .config console log report syz C ci-android-49-kasan-gce-root
2019/02/22 00:03 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba 7ff74a98 .config console log report syz C ci-android-49-kasan-gce-root
2019/02/03 05:34 https://android.googlesource.com/kernel/common android-4.9 5aa04bc73fa2 c198d5dd .config console log report syz C ci-android-49-kasan-gce-root
2019/02/03 04:25 https://android.googlesource.com/kernel/common android-4.9 5aa04bc73fa2 c198d5dd .config console log report syz C ci-android-49-kasan-gce-root
2019/02/01 18:56 https://android.googlesource.com/kernel/common android-4.9 f26c1b2bd6fc 0c07abcf .config console log report syz C ci-android-49-kasan-gce-root
2019/01/06 13:20 https://android.googlesource.com/kernel/common android-4.9 043c92bd0517 94f8adb5 .config console log report syz C ci-android-49-kasan-gce-root
2019/01/03 13:20 https://android.googlesource.com/kernel/common android-4.9 dc64ace4cb70 66fcd29b .config console log report syz C ci-android-49-kasan-gce-root
2019/01/03 12:02 https://android.googlesource.com/kernel/common android-4.9 dc64ace4cb70 66fcd29b .config console log report syz C ci-android-49-kasan-gce-root
2018/12/21 15:59 https://android.googlesource.com/kernel/common android-4.9 a2f9236e8131 588075e6 .config console log report syz C ci-android-49-kasan-gce-root
2018/12/10 07:54 https://android.googlesource.com/kernel/common android-4.9 860c8b893191 96cc4c50 .config console log report syz C ci-android-49-kasan-gce-root
2018/11/17 02:10 https://android.googlesource.com/kernel/common android-4.9 109a48ed2f69 b08ee62a .config console log report syz C ci-android-49-kasan-gce-root
2018/10/01 04:58 https://android.googlesource.com/kernel/common android-4.9 1c7637ca0b04 41e4b329 .config console log report syz C ci-android-49-kasan-gce-root
2019/02/12 11:28 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba 65a0d619 .config console log report syz ci-android-49-kasan-gce-root
2018/11/05 18:33 https://android.googlesource.com/kernel/common android-4.9 f68c8f49db5a 8bd6bd63 .config console log report syz ci-android-49-kasan-gce-root
2019/12/04 09:26 android-4.9 a36b5017c810 0ecb9746 .config console log report ci-android-49-kasan-gce-root
2019/12/04 03:36 android-4.9 a36b5017c810 ae13a849 .config console log report ci-android-49-kasan-gce-root
2019/12/03 17:16 android-4.9 a36b5017c810 ae13a849 .config console log report ci-android-49-kasan-gce-root
2019/12/03 04:54 android-4.9 a36b5017c810 ab342da3 .config console log report ci-android-49-kasan-gce-root
2019/12/02 20:34 android-4.9 a36b5017c810 ab342da3 .config console log report ci-android-49-kasan-gce-root
2019/12/02 00:10 android-4.9 a36b5017c810 f879db37 .config console log report ci-android-49-kasan-gce-root
2019/12/01 09:43 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/12/01 03:25 android-4.9 a36b5017c810 a76bf83f .config console log report ci-android-49-kasan-gce-root
2019/11/30 19:19 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 02:43 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/30 01:13 android-4.9 a36b5017c810 3a75be00 .config console log report ci-android-49-kasan-gce-root
2019/11/29 03:21 android-4.9 13ff5130ff6e 76357d6f .config console log report ci-android-49-kasan-gce-root
2019/11/28 21:10 android-4.9 13ff5130ff6e 46869e3e .config console log report ci-android-49-kasan-gce-root
2019/11/28 07:11 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 22:06 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 17:43 android-4.9 13ff5130ff6e 0d63f89c .config console log report ci-android-49-kasan-gce-root
2019/11/27 15:17 android-4.9 13ff5130ff6e 5a38f3f0 .config console log report ci-android-49-kasan-gce-root
2019/11/27 12:02 android-4.9 13ff5130ff6e 1048481f .config console log report ci-android-49-kasan-gce-root
2019/11/26 08:02 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 06:36 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/26 00:35 android-4.9 13ff5130ff6e f746151a .config console log report ci-android-49-kasan-gce-root
2019/11/25 17:12 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
2019/11/25 12:20 android-4.9 13ff5130ff6e 371caf77 .config console log report ci-android-49-kasan-gce-root
2019/11/25 08:25 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/25 05:43 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/25 03:32 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/25 01:16 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/24 22:59 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/24 20:04 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/24 17:46 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/24 13:09 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/24 01:41 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 19:53 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 17:25 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 09:27 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 08:20 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 04:04 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/23 02:05 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/22 20:59 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/22 13:55 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2019/11/22 12:29 android-4.9 258971b8e1ac 598ca6c8 .config console log report ci-android-49-kasan-gce-root
2018/10/01 03:35 https://android.googlesource.com/kernel/common android-4.9 1c7637ca0b04 41e4b329 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.