syzbot


possible deadlock in blkdev_reread_part

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+b63369398b0e8bf87f29@syzkaller.appspotmail.com
First crash: 2529d, last: 1816d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in blkdev_reread_part C 48668 625d 2051d 0/1 upstream: reported C repro on 2019/04/11 12:33
android-49 possible deadlock in blkdev_reread_part C 6117 1814d 2050d 0/3 public: reported C repro on 2019/04/12 00:00
upstream possible deadlock in blkdev_reread_part block C 5736 2155d 2576d 11/28 fixed on 2019/01/15 20:25

Sample crash report:
======================================================
[ INFO: possible circular locking dependency detected ]
4.4.107-g610c835 #4 Not tainted
-------------------------------------------------------
syzkaller581102/3315 is trying to acquire lock:
 (&bdev->bd_mutex){+.+.+.}, at: [<ffffffff81cab7ee>] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189

but task is already holding lock:
 (&lo->lo_ctl_mutex#2){+.+.+.}, at: [<ffffffff82420ea9>] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1526

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

       [<ffffffff8123a61e>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8376a89b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8376a89b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
       [<ffffffff82421e5b>] lo_release+0x6b/0x140 drivers/block/loop.c:1580
       [<ffffffff815d2557>] __blkdev_put+0x5f7/0x7e0 fs/block_dev.c:1535
       [<ffffffff815d35b5>] blkdev_put+0x85/0x550 fs/block_dev.c:1600
       [<ffffffff815d3b0b>] blkdev_close+0x8b/0xb0 fs/block_dev.c:1607
       [<ffffffff81521163>] __fput+0x233/0x6d0 fs/file_table.c:208
       [<ffffffff81521685>] ____fput+0x15/0x20 fs/file_table.c:244
       [<ffffffff811890a4>] task_work_run+0x104/0x180 kernel/task_work.c:115
       [<ffffffff81003625>] tracehook_notify_resume include/linux/tracehook.h:191 [inline]
       [<ffffffff81003625>] exit_to_usermode_loop+0x145/0x170 arch/x86/entry/common.c:251
       [<ffffffff81006545>] prepare_exit_to_usermode arch/x86/entry/common.c:282 [inline]
       [<ffffffff81006545>] syscall_return_slowpath+0x1b5/0x1f0 arch/x86/entry/common.c:347
       [<ffffffff83773e9e>] int_ret_from_sys_call+0x25/0x9f

       [<ffffffff8123797f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
       [<ffffffff8123797f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
       [<ffffffff8123797f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
       [<ffffffff8123797f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
       [<ffffffff8123a61e>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
       [<ffffffff8376a89b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       [<ffffffff8376a89b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
       [<ffffffff81cab7ee>] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189
       [<ffffffff8241ba48>] loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:645
       [<ffffffff8241c445>] loop_set_status+0x995/0xfc0 drivers/block/loop.c:1175
       [<ffffffff8241cb0a>] loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1499
       [<ffffffff82420eb4>] lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1527
       [<ffffffff81cf85a4>] compat_blkdev_ioctl+0x3d4/0x3b10 block/compat_ioctl.c:751
       [<ffffffff8161d5ca>] C_SYSC_ioctl fs/compat_ioctl.c:1592 [inline]
       [<ffffffff8161d5ca>] compat_SyS_ioctl+0x28a/0x2540 fs/compat_ioctl.c:1544
       [<ffffffff81006d84>] do_syscall_32_irqs_on arch/x86/entry/common.c:390 [inline]
       [<ffffffff81006d84>] do_fast_syscall_32+0x314/0x890 arch/x86/entry/common.c:457
       [<ffffffff837754d7>] sysenter_flags_fixed+0xd/0x17

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&lo->lo_ctl_mutex#2);
                               lock(&bdev->bd_mutex);
                               lock(&lo->lo_ctl_mutex#2);
  lock(&bdev->bd_mutex);

 *** DEADLOCK ***

1 lock held by syzkaller581102/3315:
 #0:  (&lo->lo_ctl_mutex#2){+.+.+.}, at: [<ffffffff82420ea9>] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1526

stack backtrace:
CPU: 0 PID: 3315 Comm: syzkaller581102 Not tainted 4.4.107-g610c835 #4
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 0000000000000000 c7dcb8468e4110f6 ffff8800b46175e8 ffffffff81d0457d
 ffffffff85178be0 ffffffff85178be0 ffffffff851a3fc0 ffff8801d0c20898
 ffff8801d0c20000 ffff8800b4617630 ffffffff812309f1 ffff8801d0c20898
Call Trace:
 [<ffffffff81d0457d>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d0457d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
 [<ffffffff812309f1>] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1226
 [<ffffffff8123797f>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
 [<ffffffff8123797f>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
 [<ffffffff8123797f>] validate_chain kernel/locking/lockdep.c:2144 [inline]
 [<ffffffff8123797f>] __lock_acquire+0x371f/0x4b50 kernel/locking/lockdep.c:3213
 [<ffffffff8123a61e>] lock_acquire+0x15e/0x460 kernel/locking/lockdep.c:3592
 [<ffffffff8376a89b>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff8376a89b>] mutex_lock_nested+0xbb/0x850 kernel/locking/mutex.c:621
 [<ffffffff81cab7ee>] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189
 [<ffffffff8241ba48>] loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:645
 [<ffffffff8241c445>] loop_set_status+0x995/0xfc0 drivers/block/loop.c:1175
 [<ffffffff8241cb0a>] loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1499
 [<ffffffff82420eb4>] lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1527
 [<ffffffff81cf85a4>] compat_blkdev_ioctl+0x3d4/0x3b10 block/compat_ioctl.c:751
 [<ffffffff8161d5ca>] C_SYSC_ioctl fs/compat_ioctl.c:1592 [inline]
 [<ffffffff8161d5ca>] compat_SyS_ioctl+0x28a/0x2540 fs/compat_ioctl.c:1544
 [<ffffffff81006d84>] do_syscall_32_irqs_on arch/x86/entry/common.c:390 [inline]
 [<ffffffff81006d84>] do_fast_syscall_32+0x314/0x890 arch/x86/entry/common.c:457
 [<ffffffff837754d7>] sysenter_flags_fixed+0xd/0x17

Crashes (3896):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/04 18:11 https://android.googlesource.com/kernel/common android-4.4 610c835673f3 00193447 .config console log report syz C ci-android-44-kasan-gce-386
2018/01/01 06:51 https://android.googlesource.com/kernel/common android-4.4 610c835673f3 00193447 .config console log report syz C ci-android-44-kasan-gce-386
2017/12/26 22:24 https://android.googlesource.com/kernel/common android-4.4 610c835673f3 73aba437 .config console log report syz C ci-android-44-kasan-gce-386
2017/12/19 19:58 https://android.googlesource.com/kernel/common android-4.4 170051828437 af9163c7 .config console log report syz C ci-android-44-kasan-gce-386
2019/03/03 04:55 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 1c0e457a .config console log report syz C ci-android-44-kasan-gce-386
2018/12/02 08:18 https://android.googlesource.com/kernel/common android-4.4 4c4bedf5b3fd 5a581673 .config console log report syz C ci-android-44-kasan-gce-386
2018/10/18 16:12 https://android.googlesource.com/kernel/common android-4.4 7a95540418be d257b2d2 .config console log report syz C ci-android-44-kasan-gce-386
2018/04/14 18:02 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 7a67784c .config console log report syz ci-android-44-kasan-gce-386
2018/04/14 17:43 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 7a67784c .config console log report syz ci-android-44-kasan-gce-386
2018/04/14 16:36 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 7a67784c .config console log report syz ci-android-44-kasan-gce-386
2018/04/14 06:15 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 7a67784c .config console log report syz ci-android-44-kasan-gce-386
2018/04/13 18:19 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 0a0c5db6 .config console log report syz ci-android-44-kasan-gce-386
2018/04/13 07:23 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 eb2295de .config console log report syz ci-android-44-kasan-gce-386
2018/04/13 02:59 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 eb2295de .config console log report syz ci-android-44-kasan-gce-386
2018/04/13 02:46 https://android.googlesource.com/kernel/common android-4.4 38f41ec1cb31 eb2295de .config console log report syz ci-android-44-kasan-gce-386
2019/12/02 11:41 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f879db37 .config console log report ci-android-44-kasan-gce-386
2019/12/02 00:43 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f879db37 .config console log report ci-android-44-kasan-gce-386
2019/12/01 17:05 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/12/01 13:03 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/11/30 23:30 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b a76bf83f .config console log report ci-android-44-kasan-gce-386
2019/11/30 20:24 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 3a75be00 .config console log report ci-android-44-kasan-gce-386
2019/11/30 15:00 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 3a75be00 .config console log report ci-android-44-kasan-gce-386
2019/11/30 05:37 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 3a75be00 .config console log report ci-android-44-kasan-gce-386
2019/11/29 21:17 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 20:12 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 18:48 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 17:05 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 15:52 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 12:56 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b d29b9e84 .config console log report ci-android-44-kasan-gce-386
2019/11/29 09:02 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/29 07:30 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/29 05:23 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/29 03:02 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/29 00:13 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 76357d6f .config console log report ci-android-44-kasan-gce-386
2019/11/28 20:38 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 46869e3e .config console log report ci-android-44-kasan-gce-386
2019/11/28 17:55 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 46869e3e .config console log report ci-android-44-kasan-gce-386
2019/11/28 16:24 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 46869e3e .config console log report ci-android-44-kasan-gce-386
2019/11/28 12:39 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 46869e3e .config console log report ci-android-44-kasan-gce-386
2019/11/28 09:37 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/28 09:14 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/28 07:26 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/28 03:21 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/27 23:54 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/27 17:27 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 0d63f89c .config console log report ci-android-44-kasan-gce-386
2019/11/27 11:09 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 1048481f .config console log report ci-android-44-kasan-gce-386
2019/11/27 00:10 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 1048481f .config console log report ci-android-44-kasan-gce-386
2019/11/26 15:43 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b f746151a .config console log report ci-android-44-kasan-gce-386
2019/11/25 23:32 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 371caf77 .config console log report ci-android-44-kasan-gce-386
2019/11/25 13:38 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 371caf77 .config console log report ci-android-44-kasan-gce-386
2019/11/24 21:54 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/24 09:56 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 23:57 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 06:22 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/23 01:40 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/22 19:45 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/22 14:44 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 598ca6c8 .config console log report ci-android-44-kasan-gce-386
2019/11/22 04:37 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/22 00:45 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/21 19:51 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
2019/11/21 14:02 https://android.googlesource.com/kernel/common android-4.4 62872f952d6b 8098ea0f .config console log report ci-android-44-kasan-gce-386
* Struck through repros no longer work on HEAD.