syzbot


possible deadlock in __might_fault

Status: fixed on 2018/04/24 18:02
Fix commit: staging: android: ashmem: Fix possible deadlock in ashmem_ioctl
First crash: 2275d, last: 2248d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in __might_fault staging C 8978 2258d 2274d 4/26 fixed on 2018/03/23 18:14
linux-4.19 possible deadlock in __might_fault C done 385 1614d 1865d 1/1 fixed on 2020/01/18 20:51
linux-4.14 possible deadlock in __might_fault C done 295 1624d 1864d 1/1 fixed on 2020/01/09 09:47
android-49 possible deadlock in __might_fault C 10264 2253d 2275d 3/3 fixed on 2018/04/24 17:23
android-414 possible deadlock in __might_fault 136 1637d 1864d 0/1 auto-closed as invalid on 2020/03/25 09:38
upstream possible deadlock in __might_fault (3) usb C 10722 1618d 2089d 0/26 closed as dup on 2018/09/16 01:51
upstream possible deadlock in __might_fault (2) net C 20 2211d 2215d 8/26 fixed on 2018/07/09 18:05

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read, 98 bits of entropy available)
random: sshd: uninitialized urandom read (32 bytes read, 104 bits of entropy available)
random: sshd: uninitialized urandom read (32 bytes read, 110 bits of entropy available)

======================================================
[ INFO: possible circular locking dependency detected ]
4.4.120-gd63fdf6 #28 Not tainted
-------------------------------------------------------
syzkaller221042/3785 is trying to acquire lock:
 (&mm->mmap_sem){++++++}, at: [<ffffffff81495684>] __might_fault+0xe4/0x1d0 mm/memory.c:3809

but task is already holding lock:
 (ashmem_mutex){+.+.+.}, at: [<ffffffff82c628a7>] ashmem_pin_unpin drivers/staging/android/ashmem.c:701 [inline]
 (ashmem_mutex){+.+.+.}, at: [<ffffffff82c628a7>] ashmem_ioctl+0x367/0xfa0 drivers/staging/android/ashmem.c:778

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       [<ffffffff8123d7ce>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8376a39b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8376a39b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
       [<ffffffff82c61463>] ashmem_mmap+0x53/0x400 drivers/staging/android/ashmem.c:366
       [<ffffffff814b0e4f>] mmap_region+0x94f/0x1250 mm/mmap.c:1664
       [<ffffffff814b1c4d>] do_mmap+0x4fd/0x9d0 mm/mmap.c:1441
       [<ffffffff814700ce>] do_mmap_pgoff include/linux/mm.h:1915 [inline]
       [<ffffffff814700ce>] vm_mmap_pgoff+0x16e/0x1c0 mm/util.c:296
       [<ffffffff814afe1f>] SYSC_mmap_pgoff mm/mmap.c:1491 [inline]
       [<ffffffff814afe1f>] SyS_mmap_pgoff+0x33f/0x560 mm/mmap.c:1449
       [<ffffffff8101beb6>] SYSC_mmap arch/x86/kernel/sys_x86_64.c:95 [inline]
       [<ffffffff8101beb6>] SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:86
       [<ffffffff8377395f>] entry_SYSCALL_64_fastpath+0x1c/0x98

       [<ffffffff8123ab2f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff8123ab2f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff8123ab2f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff8123ab2f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
       [<ffffffff8123d7ce>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff814956ea>] __might_fault+0x14a/0x1d0 mm/memory.c:3810
       [<ffffffff82c628f4>] copy_from_user arch/x86/include/asm/uaccess.h:724 [inline]
       [<ffffffff82c628f4>] ashmem_pin_unpin drivers/staging/android/ashmem.c:706 [inline]
       [<ffffffff82c628f4>] ashmem_ioctl+0x3b4/0xfa0 drivers/staging/android/ashmem.c:778
       [<ffffffff81559daa>] vfs_ioctl fs/ioctl.c:43 [inline]
       [<ffffffff81559daa>] do_vfs_ioctl+0x7aa/0xee0 fs/ioctl.c:607
       [<ffffffff8155a56f>] SYSC_ioctl fs/ioctl.c:622 [inline]
       [<ffffffff8155a56f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:613
       [<ffffffff8377395f>] entry_SYSCALL_64_fastpath+0x1c/0x98

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syzkaller221042/3785:
 #0:  (ashmem_mutex){+.+.+.}, at: [<ffffffff82c628a7>] ashmem_pin_unpin drivers/staging/android/ashmem.c:701 [inline]
 #0:  (ashmem_mutex){+.+.+.}, at: [<ffffffff82c628a7>] ashmem_ioctl+0x367/0xfa0 drivers/staging/android/ashmem.c:778

stack backtrace:
CPU: 1 PID: 3785 Comm: syzkaller221042 Not tainted 4.4.120-gd63fdf6 #28
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 2b4b7b174cad59c5 ffff8801d91bf9b8 ffffffff81d0408d
 ffffffff851a0010 ffffffff851a0010 ffffffff851bda40 ffff8800bbb5a0f8
 ffff8800bbb59800 ffff8801d91bfa00 ffffffff81233ba1 ffff8800bbb5a0f8
Call Trace:
 [<ffffffff81d0408d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d0408d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff81233ba1>] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1226
 [<ffffffff8123ab2f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff8123ab2f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff8123ab2f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff8123ab2f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
 [<ffffffff8123d7ce>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
 [<ffffffff814956ea>] __might_fault+0x14a/0x1d0 mm/memory.c:3810
 [<ffffffff82c628f4>] copy_from_user arch/x86/include/asm/uaccess.h:724 [inline]
 [<ffffffff82c628f4>] ashmem_pin_unpin drivers/staging/android/ashmem.c:706 [inline]
 [<ffffffff82c628f4>] ashmem_ioctl+0x3b4/0xfa0 drivers/staging/android/ashmem.c:778
 [<ffffffff81559daa>] vfs_ioctl fs/ioctl.c:43 [inline]
 [<ffffffff81559daa>] do_vfs_ioctl+0x7aa/0xee0 fs/ioctl.c:607
 [<ffffffff814afbb8>] ? SyS_mmap_pgoff+0x

Crashes (6745):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/24 17:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report syz C ci-android-44-kasan-gce
2018/03/23 00:14 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report syz C ci-android-44-kasan-gce
2018/03/21 22:16 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report syz C ci-android-44-kasan-gce
2018/03/21 02:24 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report syz C ci-android-44-kasan-gce
2018/03/20 17:39 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 72c33b66 .config console log report syz C ci-android-44-kasan-gce
2018/03/18 20:04 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz C ci-android-44-kasan-gce
2018/03/17 16:10 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz C ci-android-44-kasan-gce
2018/03/16 04:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz C ci-android-44-kasan-gce
2018/03/15 12:51 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz C ci-android-44-kasan-gce
2018/03/15 10:52 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce
2018/03/12 21:11 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f505ca4b .config console log report syz C ci-android-44-kasan-gce
2018/03/12 13:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f505ca4b .config console log report ci-android-44-kasan-gce
2018/03/11 11:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/11 06:54 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report syz C ci-android-44-kasan-gce
2018/03/11 06:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/10 08:59 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report syz C ci-android-44-kasan-gce
2018/03/10 05:32 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report syz C ci-android-44-kasan-gce
2018/03/10 04:13 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/09 15:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/09 12:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/09 10:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report ci-android-44-kasan-gce
2018/03/09 00:12 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc acd0caa5 .config console log report ci-android-44-kasan-gce
2018/03/08 08:04 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc d50edb7e .config console log report syz C ci-android-44-kasan-gce
2018/03/07 18:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc a5e76540 .config console log report ci-android-44-kasan-gce
2018/03/07 17:47 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc a5e76540 .config console log report ci-android-44-kasan-gce
2018/03/07 07:30 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc c8a18476 .config console log report ci-android-44-kasan-gce
2018/03/06 12:51 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc aef0b792 .config console log report syz C ci-android-44-kasan-gce
2018/03/01 22:15 https://android.googlesource.com/kernel/common android-4.4 024f962d4b24 2c6f473e .config console log report syz C ci-android-44-kasan-gce
2018/02/27 05:51 https://android.googlesource.com/kernel/common android-4.4 239a415f39e0 b370d4a7 .config console log report ci-android-44-kasan-gce
2018/02/27 01:20 https://android.googlesource.com/kernel/common android-4.4 239a415f39e0 b370d4a7 .config console log report ci-android-44-kasan-gce
2018/02/26 18:30 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:27 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:23 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:21 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:17 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:16 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:15 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:10 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 18:10 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 17:39 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 17:24 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 17:13 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:20 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:18 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:17 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:14 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:13 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:10 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:08 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 16:05 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 15:21 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 14:39 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce
2018/02/26 13:25 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce
2018/02/26 13:12 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce
2018/02/26 10:03 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce
2018/03/24 17:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report syz ci-android-44-kasan-gce-386
2018/03/24 17:12 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report syz ci-android-44-kasan-gce-386
2018/03/23 00:29 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report syz ci-android-44-kasan-gce-386
2018/03/21 22:46 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report syz ci-android-44-kasan-gce-386
2018/03/21 01:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report syz ci-android-44-kasan-gce-386
2018/03/20 17:23 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 72c33b66 .config console log report syz ci-android-44-kasan-gce-386
2018/03/18 19:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/18 05:30 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/17 16:22 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/16 19:33 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/16 04:08 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/15 13:05 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report syz ci-android-44-kasan-gce-386
2018/03/12 21:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f505ca4b .config console log report syz ci-android-44-kasan-gce-386
2018/03/10 06:16 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 36d1c454 .config console log report syz ci-android-44-kasan-gce-386
2018/03/08 08:18 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc d50edb7e .config console log report syz ci-android-44-kasan-gce-386
2018/03/06 12:57 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc aef0b792 .config console log report syz ci-android-44-kasan-gce-386
2018/03/05 07:34 https://android.googlesource.com/kernel/common android-4.4 855ea747806b 2c6f473e .config console log report syz ci-android-44-kasan-gce-386
2018/03/03 11:13 https://android.googlesource.com/kernel/common android-4.4 855ea747806b 2c6f473e .config console log report syz ci-android-44-kasan-gce-386
2018/03/03 09:53 https://android.googlesource.com/kernel/common android-4.4 855ea747806b 2c6f473e .config console log report ci-android-44-kasan-gce-386
2018/03/01 22:29 https://android.googlesource.com/kernel/common android-4.4 024f962d4b24 2c6f473e .config console log report syz ci-android-44-kasan-gce-386
2018/03/01 11:16 https://android.googlesource.com/kernel/common android-4.4 024f962d4b24 c4089507 .config console log report ci-android-44-kasan-gce-386
2018/03/01 00:42 https://android.googlesource.com/kernel/common android-4.4 024f962d4b24 05b5a32c .config console log report ci-android-44-kasan-gce-386
2018/02/28 22:15 https://android.googlesource.com/kernel/common android-4.4 024f962d4b24 05b5a32c .config console log report ci-android-44-kasan-gce-386
2018/02/26 13:23 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce-386
2018/02/26 12:57 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce-386
2018/02/26 09:26 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report syz C ci-android-44-kasan-gce-386
2018/02/26 09:01 https://android.googlesource.com/kernel/common android-4.4 5f7f76a551e7 9fe8aa42 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.