syzbot


possible deadlock in blkdev_reread_part

Status: public: reported C repro on 2019/04/12 00:00
Reported-by: syzbot+313976955de89e3514f2@syzkaller.appspotmail.com
First crash: 2539d, last: 1814d
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-44 possible deadlock in blkdev_reread_part C 3896 1816d 2050d 0/2 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.9.75-g06fe41f #16 Not tainted
-------------------------------------------------------
syzkaller027926/3332 is trying to acquire lock:
 (&bdev->bd_mutex){+.+.+.}, at: [<ffffffff81d34f1e>] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189
but task is already holding lock:
 (&lo->lo_ctl_mutex#2){+.+...}, at: [<ffffffff824b6769>] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1515
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
       lo_release+0x6b/0x140 drivers/block/loop.c:1569
       __blkdev_put+0x5f7/0x7e0 fs/block_dev.c:1598
       blkdev_put+0x85/0x550 fs/block_dev.c:1663
       blkdev_close+0x8b/0xb0 fs/block_dev.c:1670
       __fput+0x28c/0x6e0 fs/file_table.c:208
       ____fput+0x15/0x20 fs/file_table.c:244
       task_work_run+0x115/0x190 kernel/task_work.c:116
       tracehook_notify_resume include/linux/tracehook.h:191 [inline]
       exit_to_usermode_loop+0xfc/0x120 arch/x86/entry/common.c:160
       prepare_exit_to_usermode arch/x86/entry/common.c:190 [inline]
       syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
       entry_SYSCALL_64_fastpath+0xe0/0xe2

       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
       __mutex_lock_common kernel/locking/mutex.c:521 [inline]
       mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621
       blkdev_reread_part+0x1e/0x40 block/ioctl.c:189
       loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:634
       loop_set_status+0x995/0xfc0 drivers/block/loop.c:1164
       loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1488
       lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1516
       compat_blkdev_ioctl+0x3e3/0x3bc0 block/compat_ioctl.c:751
       C_SYSC_ioctl fs/compat_ioctl.c:1602 [inline]
       compat_SyS_ioctl+0x15f/0x2050 fs/compat_ioctl.c:1549
       do_syscall_32_irqs_on arch/x86/entry/common.c:322 [inline]
       do_fast_syscall_32+0x2f7/0x890 arch/x86/entry/common.c:384
       entry_SYSENTER_compat+0x74/0x83 arch/x86/entry/entry_64_compat.S:127

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 syzkaller027926/3332:
 #0:  (&lo->lo_ctl_mutex#2){+.+...}, at: [<ffffffff824b6769>] lo_compat_ioctl+0x109/0x140 drivers/block/loop.c:1515

stack backtrace:
CPU: 1 PID: 3332 Comm: syzkaller027926 Not tainted 4.9.75-g06fe41f #16
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801caa97768 ffffffff81d93049 ffffffff85385970 ffffffff85385970
 ffffffff853b2850 ffff8801c980b8d8 ffff8801c980b000 ffff8801caa977b0
 ffffffff81237431 ffff8801c980b8d8 00000000c980b8b0 ffff8801c980b8d8
Call Trace:
 [<ffffffff81d93049>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d93049>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81237431>] print_circular_bug+0x271/0x310 kernel/locking/lockdep.c:1202
 [<ffffffff8123d869>] check_prev_add kernel/locking/lockdep.c:1828 [inline]
 [<ffffffff8123d869>] check_prevs_add kernel/locking/lockdep.c:1938 [inline]
 [<ffffffff8123d869>] validate_chain kernel/locking/lockdep.c:2265 [inline]
 [<ffffffff8123d869>] __lock_acquire+0x2bf9/0x3640 kernel/locking/lockdep.c:3345
 [<ffffffff8123ecee>] lock_acquire+0x12e/0x410 kernel/locking/lockdep.c:3756
 [<ffffffff838a6cdb>] __mutex_lock_common kernel/locking/mutex.c:521 [inline]
 [<ffffffff838a6cdb>] mutex_lock_nested+0xbb/0x870 kernel/locking/mutex.c:621
 [<ffffffff81d34f1e>] blkdev_reread_part+0x1e/0x40 block/ioctl.c:189
 [<ffffffff824b12f8>] loop_reread_partitions+0x78/0xe0 drivers/block/loop.c:634
 [<ffffffff824b1cf5>] loop_set_status+0x995/0xfc0 drivers/block/loop.c:1164
 [<ffffffff824b23ba>] loop_set_status_compat+0x9a/0x100 drivers/block/loop.c:1488
 [<ffffffff824b6774>] lo_compat_ioctl+0x114/0x140 drivers/block/loop.c:1516
 [<ffffffff81d86e13>] compat_blkdev_ioctl+0x3e3/0x3bc0 block/compat_ioctl.c:751
 [<ffffffff8167b72f>] C_SYSC_ioctl fs/compat_ioctl.c:1602 [inline]
 [<ffffffff8167b72f>] compat_SyS_ioctl+0x15f/0x2050 fs/compat_ioctl.c:1549
 [<ffffffff81006fc7>] do_syscall_32_irqs_on arch/x86/entry/common.c:322 [inline]
 [<ffffffff81006fc7>] do_fast_syscall_32+0x2f7/0x890 arch/x86/entry/common.c:384
 [<ffffffff838b2334>] entry_SYSENTER_compat+0x74/0x83 arch/x86/entry/entry_64_compat.S:127

Crashes (6117):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/01/06 21:36 https://android.googlesource.com/kernel/common android-4.9 06fe41f85237 053171ea .config console log report syz C ci-android-49-kasan-gce-386
2017/12/31 16:25 https://android.googlesource.com/kernel/common android-4.9 f3f3457d4582 00193447 .config console log report syz C ci-android-49-kasan-gce-386
2017/12/26 17:13 https://android.googlesource.com/kernel/common android-4.9 250637879165 73aba437 .config console log report syz C ci-android-49-kasan-gce-386
2017/12/12 19:18 https://android.googlesource.com/kernel/common android-4.9 fb66dc2a6e5e 414a185f .config console log report syz C ci-android-49-kasan-gce-386
2019/03/03 05:11 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1c0e457a .config console log report syz C ci-android-49-kasan-gce-386
2018/12/02 17:28 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 e0d8c853 .config console log report syz C ci-android-49-kasan-gce-386
2018/10/18 16:13 https://android.googlesource.com/kernel/common android-4.9 3917c4a8adcc d257b2d2 .config console log report syz C ci-android-49-kasan-gce-386
2018/02/09 23:38 https://android.googlesource.com/kernel/common android-4.9 20c8a0089294 2b6b214c .config console log report syz C ci-android-49-kasan-gce-386
2018/02/09 06:40 https://android.googlesource.com/kernel/common android-4.9 20c8a0089294 9fb5ec43 .config console log report syz C ci-android-49-kasan-gce-386
2018/04/14 15:47 https://android.googlesource.com/kernel/common android-4.9 2ba4887f2937 7a67784c .config console log report syz ci-android-49-kasan-gce-386
2018/04/14 14:33 https://android.googlesource.com/kernel/common android-4.9 2ba4887f2937 7a67784c .config console log report syz ci-android-49-kasan-gce-386
2018/04/14 11:17 https://android.googlesource.com/kernel/common android-4.9 2ba4887f2937 7a67784c .config console log report syz ci-android-49-kasan-gce-386
2018/04/14 03:16 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 7a67784c .config console log report syz ci-android-49-kasan-gce-386
2018/04/13 17:45 https://android.googlesource.com/kernel/common android-4.9 cb023581bd03 0a0c5db6 .config console log report syz ci-android-49-kasan-gce-386
2018/04/13 01:57 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 eb2295de .config console log report syz ci-android-49-kasan-gce-386
2018/04/13 01:18 https://android.googlesource.com/kernel/common android-4.9 f6bec4e8c771 eb2295de .config console log report syz ci-android-49-kasan-gce-386
2019/12/03 19:20 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 ae13a849 .config console log report ci-android-49-kasan-gce-386
2019/12/02 09:56 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 f879db37 .config console log report ci-android-49-kasan-gce-386
2019/12/01 16:37 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/12/01 13:37 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/12/01 07:03 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/12/01 01:46 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a76bf83f .config console log report ci-android-49-kasan-gce-386
2019/11/30 18:31 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 3a75be00 .config console log report ci-android-49-kasan-gce-386
2019/11/30 16:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 3a75be00 .config console log report ci-android-49-kasan-gce-386
2019/11/29 14:55 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d29b9e84 .config console log report ci-android-49-kasan-gce-386
2019/11/29 00:51 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 76357d6f .config console log report ci-android-49-kasan-gce-386
2019/11/28 17:18 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 46869e3e .config console log report ci-android-49-kasan-gce-386
2019/11/28 14:07 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 46869e3e .config console log report ci-android-49-kasan-gce-386
2019/11/28 05:49 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0d63f89c .config console log report ci-android-49-kasan-gce-386
2019/11/27 12:03 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce-386
2019/11/27 09:46 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce-386
2019/11/27 04:13 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce-386
2019/11/26 17:58 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1048481f .config console log report ci-android-49-kasan-gce-386
2019/11/26 06:20 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 f746151a .config console log report ci-android-49-kasan-gce-386
2019/11/25 23:26 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 371caf77 .config console log report ci-android-49-kasan-gce-386
2019/11/24 18:33 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/24 04:59 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/23 22:55 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/23 03:54 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/22 17:39 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/22 14:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 598ca6c8 .config console log report ci-android-49-kasan-gce-386
2019/11/22 08:09 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 8098ea0f .config console log report ci-android-49-kasan-gce-386
2019/11/19 21:29 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5bc70212 .config console log report ci-android-49-kasan-gce-386
2019/11/19 16:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5bc70212 .config console log report ci-android-49-kasan-gce-386
2019/11/19 13:41 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5bc70212 .config console log report ci-android-49-kasan-gce-386
2019/11/19 08:33 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5bc70212 .config console log report ci-android-49-kasan-gce-386
2019/11/19 06:08 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5bc70212 .config console log report ci-android-49-kasan-gce-386
2019/11/18 23:48 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1daed50a .config console log report ci-android-49-kasan-gce-386
2019/11/18 17:21 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1daed50a .config console log report ci-android-49-kasan-gce-386
2019/11/18 10:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/17 19:25 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/17 14:22 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/17 07:08 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/17 02:04 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/16 15:42 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d5696d51 .config console log report ci-android-49-kasan-gce-386
2019/11/15 18:53 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 cdac920b .config console log report ci-android-49-kasan-gce-386
2019/11/14 23:45 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a24fe792 .config console log report ci-android-49-kasan-gce-386
2019/11/14 17:59 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5d15a967 .config console log report ci-android-49-kasan-gce-386
2019/11/14 16:48 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 5d15a967 .config console log report ci-android-49-kasan-gce-386
2019/11/14 07:56 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 048f2d49 .config console log report ci-android-49-kasan-gce-386
2019/11/14 04:57 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 048f2d49 .config console log report ci-android-49-kasan-gce-386
2019/11/14 03:53 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 048f2d49 .config console log report ci-android-49-kasan-gce-386
2019/11/13 21:23 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 048f2d49 .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.