syzbot


possible deadlock in __might_fault

Status: fixed on 2018/04/24 17:23
Fix commit: d3c79a38843b staging: android: ashmem: Fix possible deadlock in ashmem_ioctl
First crash: 2460d, last: 2438d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in __might_fault staging C 8978 2444d 2459d 4/28 fixed on 2018/03/23 18:14
linux-4.19 possible deadlock in __might_fault C done 385 1799d 2050d 1/1 fixed on 2020/01/18 20:51
linux-4.14 possible deadlock in __might_fault C done 295 1809d 2049d 1/1 fixed on 2020/01/09 09:47
android-44 possible deadlock in __might_fault C 6745 2433d 2460d 2/2 fixed on 2018/04/24 18:02
android-414 possible deadlock in __might_fault 136 1822d 2049d 0/1 auto-closed as invalid on 2020/03/25 09:38
upstream possible deadlock in __might_fault (3) usb C 10722 1803d 2275d 0/28 closed as dup on 2018/09/16 01:51
upstream possible deadlock in __might_fault (2) net C 20 2397d 2400d 8/28 fixed on 2018/07/09 18:05

Sample crash report:
======================================================
[ INFO: possible circular locking dependency detected ]
4.9.88-gbb52bba #59 Not tainted
-------------------------------------------------------
syzkaller153371/3744 is trying to acquire lock:
 (&mm->mmap_sem){++++++}, at: [<ffffffff814c2c84>] __might_fault+0xe4/0x1d0 mm/memory.c:4013
but task is already holding lock:
 (ashmem_mutex){+.+.+.}, at: [<ffffffff82d4c6b1>] ashmem_pin_unpin drivers/staging/android/ashmem.c:713 [inline]
 (ashmem_mutex){+.+.+.}, at: [<ffffffff82d4c6b1>] ashmem_ioctl+0x371/0xfe0 drivers/staging/android/ashmem.c:790
which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756
       __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621
       ashmem_mmap+0x53/0x400 drivers/staging/android/ashmem.c:378
       mmap_region+0x7dd/0xfd0 mm/mmap.c:1694
       do_mmap+0x57b/0xbe0 mm/mmap.c:1473
       do_mmap_pgoff include/linux/mm.h:2032 [inline]
       vm_mmap_pgoff+0x16b/0x1b0 mm/util.c:329
       SYSC_mmap_pgoff mm/mmap.c:1523 [inline]
       SyS_mmap_pgoff+0x33f/0x560 mm/mmap.c:1481
       SYSC_mmap arch/x86/kernel/sys_x86_64.c:95 [inline]
       SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:86
       do_syscall_64+0x1a4/0x490 arch/x86/entry/common.c:282
       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+0x2bf9/0x3640 kernel/locking/lockdep.c:3345
       lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756
       __might_fault+0x14a/0x1d0 mm/memory.c:4014
       copy_from_user arch/x86/include/asm/uaccess.h:705 [inline]
       ashmem_pin_unpin drivers/staging/android/ashmem.c:718 [inline]
       ashmem_ioctl+0x3c0/0xfe0 drivers/staging/android/ashmem.c:790
       vfs_ioctl fs/ioctl.c:43 [inline]
       do_vfs_ioctl+0x1aa/0x1140 fs/ioctl.c:679
       SYSC_ioctl fs/ioctl.c:694 [inline]
       SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
       do_syscall_64+0x1a4/0x490 arch/x86/entry/common.c:282
       entry_SYSCALL_64_after_swapgs+0x5d/0xdb

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 syzkaller153371/3744:
 #0:  (ashmem_mutex){+.+.+.}, at: [<ffffffff82d4c6b1>] ashmem_pin_unpin drivers/staging/android/ashmem.c:713 [inline]
 #0:  (ashmem_mutex){+.+.+.}, at: [<ffffffff82d4c6b1>] ashmem_ioctl+0x371/0xfe0 drivers/staging/android/ashmem.c:790

stack backtrace:
CPU: 1 PID: 3744 Comm: syzkaller153371 Not tainted 4.9.88-gbb52bba #59
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d8f57908 ffffffff81d95f19 ffffffff853a5c00 ffffffff853a5c00
 ffffffff853c4f80 ffff8801d8d620d8 ffff8801d8d61800 ffff8801d8f57950
 ffffffff81238bd1 ffff8801d8d620d8 00000000d8d620b0 ffff8801d8d620d8
Call Trace:
 [<ffffffff81d95f19>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d95f19>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81238bd1>] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1202
 [<ffffffff8123f009>] check_prev_add kernel/locking/lockdep.c:1828 [inline]
 [<ffffffff8123f009>] check_prevs_add kernel/locking/lockdep.c:1938 [inline]
 [<ffffffff8123f009>] validate_chain kernel/locking/lockdep.c:2265 [inline]
 [<ffffffff8123f009>] __lock_acquire+0x2bf9/0x3640 kernel/locking/lockdep.c:3345
 [<ffffffff8124048e>] lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756
 [<ffffffff814c2cea>] __might_fault+0x14a/0x1d0 mm/memory.c:4014
 [<ffffffff82d4c700>] copy_from_user arch/x86/include/asm/uaccess.h:705 [inline]
 [<ffffffff82d4c700>] ashmem_pin_unpin drivers/staging/android/ashmem.c:718 [inline]
 [<ffffffff82d4c700>] ashmem_ioctl+0x3c0/0xfe0 drivers/staging/android/ashmem.c:790
 [<ffffffff815af06a>] vfs_ioctl fs/ioctl.c:43 [inline]
 [<ffffffff815af06a>] do_vfs_ioctl+0x1aa/0x1140 fs/ioctl.c:679
 [<ffffffff815b008f>] SYSC_ioctl fs/ioctl.c:694 [inline]
 [<ffffffff815b008f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685
 [<ffffffff81006504>] do_syscall_64+0x1a4/0x490 arch/x86/entry/common.c:282
 [<ffffffff838b7a53>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Crashes (10264):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/18 19:40 https://android.googlesource.com/kernel/common android-4.9 bb52bba67e35 08dacaa0 .config console log report syz C ci-android-49-kasan-gce
2018/03/17 16:22 https://android.googlesource.com/kernel/common android-4.9 fc8bd0f6ffec 08dacaa0 .config console log report syz C ci-android-49-kasan-gce
2018/03/16 04:21 https://android.googlesource.com/kernel/common android-4.9 d6f27745679a 08dacaa0 .config console log report syz C ci-android-49-kasan-gce
2018/03/15 13:04 https://android.googlesource.com/kernel/common android-4.9 3a3a0844ac38 08dacaa0 .config console log report syz C ci-android-49-kasan-gce
2018/03/12 21:23 https://android.googlesource.com/kernel/common android-4.9 a2904940bde8 f505ca4b .config console log report syz C ci-android-49-kasan-gce
2018/03/10 06:12 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 36d1c454 .config console log report syz C ci-android-49-kasan-gce
2018/03/08 08:18 https://android.googlesource.com/kernel/common android-4.9 d3a2afb9382e d50edb7e .config console log report syz C ci-android-49-kasan-gce
2018/03/06 12:31 https://android.googlesource.com/kernel/common android-4.9 b324a701539e aef0b792 .config console log report syz C ci-android-49-kasan-gce
2018/03/01 22:29 https://android.googlesource.com/kernel/common android-4.9 4c4262aa50dc 2c6f473e .config console log report syz C ci-android-49-kasan-gce
2018/02/26 21:18 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 b370d4a7 .config console log report syz C ci-android-49-kasan-gce
2018/02/26 09:34 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce
2018/02/26 12:25 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce-386
2018/02/26 12:00 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce-386
2018/02/26 11:46 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce-386
2018/02/26 09:50 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report syz C ci-android-49-kasan-gce-386
2018/03/18 19:21 https://android.googlesource.com/kernel/common android-4.9 bb52bba67e35 08dacaa0 .config console log report syz ci-android-49-kasan-gce-386
2018/03/17 16:23 https://android.googlesource.com/kernel/common android-4.9 fc8bd0f6ffec 08dacaa0 .config console log report syz ci-android-49-kasan-gce-386
2018/03/16 04:22 https://android.googlesource.com/kernel/common android-4.9 d6f27745679a 08dacaa0 .config console log report syz ci-android-49-kasan-gce-386
2018/03/15 13:08 https://android.googlesource.com/kernel/common android-4.9 3a3a0844ac38 08dacaa0 .config console log report syz ci-android-49-kasan-gce-386
2018/03/12 21:24 https://android.googlesource.com/kernel/common android-4.9 a2904940bde8 f505ca4b .config console log report syz ci-android-49-kasan-gce-386
2018/03/10 06:15 https://android.googlesource.com/kernel/common android-4.9 00db063b0f88 36d1c454 .config console log report syz ci-android-49-kasan-gce-386
2018/03/08 08:18 https://android.googlesource.com/kernel/common android-4.9 d3a2afb9382e d50edb7e .config console log report syz ci-android-49-kasan-gce-386
2018/03/06 12:46 https://android.googlesource.com/kernel/common android-4.9 b324a701539e aef0b792 .config console log report syz ci-android-49-kasan-gce-386
2018/03/05 07:46 https://android.googlesource.com/kernel/common android-4.9 b324a701539e 2c6f473e .config console log report syz ci-android-49-kasan-gce-386
2018/03/03 11:37 https://android.googlesource.com/kernel/common android-4.9 e0b05e693a9d 2c6f473e .config console log report syz ci-android-49-kasan-gce-386
2018/03/01 22:28 https://android.googlesource.com/kernel/common android-4.9 4c4262aa50dc 2c6f473e .config console log report syz ci-android-49-kasan-gce-386
2018/02/26 12:07 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 12:07 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:52 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:51 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:47 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:46 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:40 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:40 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:34 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:18 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 11:11 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:59 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:50 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:37 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:32 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:32 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:28 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:17 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:10 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:07 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:04 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:02 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 10:00 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:55 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:55 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:52 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:52 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:49 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:46 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:33 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:17 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:15 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/02/26 09:07 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce
2018/03/06 04:15 https://android.googlesource.com/kernel/common android-4.9 b324a701539e aef0b792 .config console log report ci-android-49-kasan-gce-386
2018/02/26 11:56 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce-386
2018/02/26 11:20 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce-386
2018/02/26 09:25 https://android.googlesource.com/kernel/common android-4.9 a9d027374a35 9fe8aa42 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.