syzbot


possible deadlock in shmem_file_llseek

Status: fixed on 2018/11/07 15:43
Fix commit: staging: android: ashmem: Fix lockdep issue during llseek
First crash: 2509d, last: 2435d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in shmem_file_llseek mm C 4432 2445d 2509d 4/28 fixed on 2018/03/23 18:14

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

======================================================
[ INFO: possible circular locking dependency detected ]
4.4.114-ga81d322 #4 Not tainted
-------------------------------------------------------
syzkaller539241/4046 is trying to acquire lock:
 (&sb->s_type->i_mutex_key#10){+.+.+.}, at: [<ffffffff81463491>] shmem_file_llseek+0xf1/0x240 mm/shmem.c:1816

but task is already holding lock:
 (ashmem_mutex){+.+.+.}, at: [<ffffffff82c61a56>] ashmem_llseek+0x56/0x1f0 drivers/staging/android/ashmem.c:330

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       [<ffffffff8123d7be>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8376a92b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8376a92b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
       [<ffffffff82c60ea3>] ashmem_mmap+0x53/0x400 drivers/staging/android/ashmem.c:366
       [<ffffffff814b0edf>] mmap_region+0x94f/0x1250 mm/mmap.c:1664
       [<ffffffff814b1cdd>] do_mmap+0x4fd/0x9d0 mm/mmap.c:1441
       [<ffffffff8147015e>] do_mmap_pgoff include/linux/mm.h:1915 [inline]
       [<ffffffff8147015e>] vm_mmap_pgoff+0x16e/0x1c0 mm/util.c:272
       [<ffffffff814afeaf>] SYSC_mmap_pgoff mm/mmap.c:1491 [inline]
       [<ffffffff814afeaf>] 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
       [<ffffffff83773edf>] entry_SYSCALL_64_fastpath+0x1c/0x98

       [<ffffffff8123d7be>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8149577a>] __might_fault+0x14a/0x1d0 mm/memory.c:3810
       [<ffffffff8155a7e2>] copy_to_user arch/x86/include/asm/uaccess.h:760 [inline]
       [<ffffffff8155a7e2>] filldir+0x162/0x2d0 fs/readdir.c:180
       [<ffffffff81597e2e>] dir_emit_dot include/linux/fs.h:3070 [inline]
       [<ffffffff81597e2e>] dir_emit_dots include/linux/fs.h:3081 [inline]
       [<ffffffff81597e2e>] dcache_readdir+0x11e/0x7b0 fs/libfs.c:150
       [<ffffffff8155a428>] iterate_dir+0x1c8/0x420 fs/readdir.c:42
       [<ffffffff8155b11a>] SYSC_getdents fs/readdir.c:215 [inline]
       [<ffffffff8155b11a>] SyS_getdents+0x14a/0x270 fs/readdir.c:196
       [<ffffffff83773edf>] entry_SYSCALL_64_fastpath+0x1c/0x98

       [<ffffffff8123ab1f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff8123ab1f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff8123ab1f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff8123ab1f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
       [<ffffffff8123d7be>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8376a92b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8376a92b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
       [<ffffffff81463491>] shmem_file_llseek+0xf1/0x240 mm/shmem.c:1816
       [<ffffffff8151c642>] vfs_llseek+0xa2/0xd0 fs/read_write.c:260
       [<ffffffff82c61ae7>] ashmem_llseek+0xe7/0x1f0 drivers/staging/android/ashmem.c:342
       [<ffffffff8151e44b>] vfs_llseek fs/read_write.c:260 [inline]
       [<ffffffff8151e44b>] SYSC_lseek fs/read_write.c:285 [inline]
       [<ffffffff8151e44b>] SyS_lseek+0xeb/0x170 fs/read_write.c:276
       [<ffffffff83773edf>] entry_SYSCALL_64_fastpath+0x1c/0x98

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 syzkaller539241/4046:
 #0:  (ashmem_mutex){+.+.+.}, at: [<ffffffff82c61a56>] ashmem_llseek+0x56/0x1f0 drivers/staging/android/ashmem.c:330

stack backtrace:
CPU: 0 PID: 4046 Comm: syzkaller539241 Not tainted 4.4.114-ga81d322 #4
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 929849d1f523ab01 ffff8800b9777ad8 ffffffff81d0394d
 ffffffff851a0240 ffffffff851a9f30 ffffffff851be9f0 ffff8801d729e8f8
 ffff8801d729e000 ffff8800b9777b20 ffffffff81233b91 ffff8801d729e8f8
Call Trace:
 [<ffffffff81d0394d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d0394d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff81233b91>] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1226
 [<ffffffff8123ab1f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff8123ab1f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff8123ab1f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff8123ab1f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
 [<ffffffff8123d7be>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
 [<ffffffff8376a92b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff8376a92b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621

Crashes (1487):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/02/02 20:48 https://android.googlesource.com/kernel/common android-4.4 a81d32264721 632a8c2c .config console log report syz C ci-android-44-kasan-gce
2018/01/25 23:11 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce
2018/01/22 07:42 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b fbbdcd92 .config console log report syz C ci-android-44-kasan-gce
2018/01/21 08:35 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b fbbdcd92 .config console log report syz C ci-android-44-kasan-gce
2018/01/18 07:50 https://android.googlesource.com/kernel/common android-4.4 5f6325b148d0 b8970f31 .config console log report syz C ci-android-44-kasan-gce
2018/01/18 07:14 https://android.googlesource.com/kernel/common android-4.4 5f6325b148d0 b8970f31 .config console log report syz C ci-android-44-kasan-gce
2018/01/18 07:01 https://android.googlesource.com/kernel/common android-4.4 5f6325b148d0 b8970f31 .config console log report syz C ci-android-44-kasan-gce
2018/01/17 05:58 https://android.googlesource.com/kernel/common android-4.4 c2f631bf4969 a46e5318 .config console log report syz C ci-android-44-kasan-gce
2018/01/10 04:54 https://android.googlesource.com/kernel/common android-4.4 618a5108ea9c 1f60c828 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/10 04:49 https://android.googlesource.com/kernel/common android-4.4 618a5108ea9c 1f60c828 .config console log report syz C ci-android-44-kasan-gce
2018/02/02 20:48 https://android.googlesource.com/kernel/common android-4.4 a81d32264721 632a8c2c .config console log report syz C ci-android-44-kasan-gce-386
2018/01/31 15:46 https://android.googlesource.com/kernel/common android-4.4 fe09418d6f88 02553e22 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/30 14:38 https://android.googlesource.com/kernel/common android-4.4 962d1f3fe2f4 a899be78 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/30 08:33 https://android.googlesource.com/kernel/common android-4.4 962d1f3fe2f4 08d47756 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/26 11:02 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 1d18b112 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/25 12:54 https://android.googlesource.com/kernel/common android-4.4 e70c132b2dac 6b2a715e .config console log report syz C ci-android-44-kasan-gce-386
2018/01/23 12:34 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b a5b7566c .config console log report syz C ci-android-44-kasan-gce-386
2018/01/22 09:53 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b fbbdcd92 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/21 13:34 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b fbbdcd92 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/20 15:04 https://android.googlesource.com/kernel/common android-4.4 3fc4284df70b fbbdcd92 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/19 00:33 https://android.googlesource.com/kernel/common android-4.4 ca0ebb4ee237 161c1d64 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/19 00:10 https://android.googlesource.com/kernel/common android-4.4 ca0ebb4ee237 161c1d64 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/18 23:56 https://android.googlesource.com/kernel/common android-4.4 ca0ebb4ee237 161c1d64 .config console log report syz C ci-android-44-kasan-gce-386
2018/03/20 21:58 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 72c33b66 .config console log report syz ci-android-44-kasan-gce-386
2018/03/05 19:48 https://android.googlesource.com/kernel/common android-4.4 855ea747806b bbd5104f .config console log report syz ci-android-44-kasan-gce-386
2018/03/25 06:12 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/25 01:20 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/24 22:17 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/24 08:36 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/24 03:10 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/23 21:02 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/23 19:08 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/23 15:56 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/23 08:18 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/22 20:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/22 17:11 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce
2018/03/22 03:09 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 95c88d7a .config console log report ci-android-44-kasan-gce
2018/03/22 01:33 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 95c88d7a .config console log report ci-android-44-kasan-gce
2018/03/21 22:20 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report ci-android-44-kasan-gce
2018/03/21 18:15 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report ci-android-44-kasan-gce
2018/03/21 09:21 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report ci-android-44-kasan-gce
2018/03/21 05:18 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report ci-android-44-kasan-gce
2018/03/20 18:57 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 72c33b66 .config console log report ci-android-44-kasan-gce
2018/03/20 06:30 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce
2018/03/20 02:35 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce
2018/03/19 23:06 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce
2018/03/19 20:33 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce
2018/03/19 12:18 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce
2018/03/19 06:52 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce
2018/03/18 23:54 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce
2018/03/24 23:23 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/24 20:02 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/24 18:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/24 13:19 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/24 05:59 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/23 13:33 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/23 11:18 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/23 06:35 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/22 22:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/22 18:53 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/22 13:35 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 2e9d9054 .config console log report ci-android-44-kasan-gce-386
2018/03/22 09:08 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 95c88d7a .config console log report ci-android-44-kasan-gce-386
2018/03/22 07:45 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 95c88d7a .config console log report ci-android-44-kasan-gce-386
2018/03/22 05:22 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 95c88d7a .config console log report ci-android-44-kasan-gce-386
2018/03/21 20:31 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report ci-android-44-kasan-gce-386
2018/03/21 13:35 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc f63eeee9 .config console log report ci-android-44-kasan-gce-386
2018/03/21 06:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report ci-android-44-kasan-gce-386
2018/03/21 03:32 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 113a43ff .config console log report ci-android-44-kasan-gce-386
2018/03/20 13:34 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 72c33b66 .config console log report ci-android-44-kasan-gce-386
2018/03/20 09:49 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce-386
2018/03/20 05:25 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce-386
2018/03/19 19:22 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce-386
2018/03/19 14:06 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 7e7d7ed2 .config console log report ci-android-44-kasan-gce-386
2018/03/19 05:16 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce-386
2018/03/19 02:50 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce-386
2018/03/19 01:45 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce-386
2018/03/18 20:34 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce-386
2018/03/18 19:20 https://android.googlesource.com/kernel/common android-4.4 d63fdf61a4dc 08dacaa0 .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.