syzbot


possible deadlock in blkdev_reread_part

Status: upstream: reported C repro on 2019/04/11 12:33
Reported-by: syzbot+8717dc3c67074f156de2@syzkaller.appspotmail.com
First crash: 2051d, last: 625d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 possible deadlock in blkdev_reread_part C 6117 1815d 2050d 0/3 public: reported C repro on 2019/04/12 00:00
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 2156d 2577d 11/28 fixed on 2019/01/15 20:25

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.302-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor397/7973 is trying to acquire lock:
 (&bdev->bd_mutex){+.+.}, at: [<ffffffff830c4cbb>] blkdev_reread_part+0x1b/0x40 block/ioctl.c:192

but task is already holding lock:
 (&nbd->config_lock){+.+.}, at: [<ffffffff838e743f>] nbd_ioctl+0x11f/0xad0 drivers/block/nbd.c:1369

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&nbd->config_lock){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       nbd_open+0x1ac/0x370 drivers/block/nbd.c:1422
       __blkdev_get+0x306/0x1090 fs/block_dev.c:1470
       blkdev_get+0x88/0x890 fs/block_dev.c:1611
       blkdev_open+0x1cc/0x250 fs/block_dev.c:1772
       do_dentry_open+0x44b/0xec0 fs/open.c:777
       vfs_open+0x105/0x220 fs/open.c:888
       do_last fs/namei.c:3428 [inline]
       path_openat+0x628/0x2970 fs/namei.c:3571
       do_filp_open+0x179/0x3c0 fs/namei.c:3605
       do_sys_open+0x296/0x410 fs/open.c:1081
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #1 (nbd_index_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       nbd_open+0x1e/0x370 drivers/block/nbd.c:1409
       __blkdev_get+0x306/0x1090 fs/block_dev.c:1470
       blkdev_get+0x88/0x890 fs/block_dev.c:1611
       blkdev_open+0x1cc/0x250 fs/block_dev.c:1772
       do_dentry_open+0x44b/0xec0 fs/open.c:777
       vfs_open+0x105/0x220 fs/open.c:888
       do_last fs/namei.c:3428 [inline]
       path_openat+0x628/0x2970 fs/namei.c:3571
       do_filp_open+0x179/0x3c0 fs/namei.c:3605
       do_sys_open+0x296/0x410 fs/open.c:1081
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #0 (&bdev->bd_mutex){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       blkdev_reread_part+0x1b/0x40 block/ioctl.c:192
       nbd_bdev_reset drivers/block/nbd.c:1076 [inline]
       nbd_clear_sock_ioctl drivers/block/nbd.c:1282 [inline]
       __nbd_ioctl drivers/block/nbd.c:1306 [inline]
       nbd_ioctl+0x802/0xad0 drivers/block/nbd.c:1376
       __blkdev_driver_ioctl block/ioctl.c:297 [inline]
       blkdev_ioctl+0x540/0x1830 block/ioctl.c:594
       block_ioctl+0xd9/0x120 fs/block_dev.c:1893
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

other info that might help us debug this:

Chain exists of:
  &bdev->bd_mutex --> nbd_index_mutex --> &nbd->config_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&nbd->config_lock);
                               lock(nbd_index_mutex);
                               lock(&nbd->config_lock);
  lock(&bdev->bd_mutex);

 *** DEADLOCK ***

1 lock held by syz-executor397/7973:
 #0:  (&nbd->config_lock){+.+.}, at: [<ffffffff838e743f>] nbd_ioctl+0x11f/0xad0 drivers/block/nbd.c:1369

stack backtrace:
CPU: 1 PID: 7973 Comm: syz-executor397 Not tainted 4.14.302-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 blkdev_reread_part+0x1b/0x40 block/ioctl.c:192
 nbd_bdev_reset drivers/block/nbd.c:1076 [inline]
 nbd_clear_sock_ioctl drivers/block/nbd.c:1282 [inline]
 __nbd_ioctl drivers/block/nbd.c:1306 [inline]
 nbd_ioctl+0x802/0xad0 drivers/block/nbd.c:1376
 __blkdev_driver_ioctl block/ioctl.c:297 [inline]
 blkdev_ioctl+0x540/0x1830 block/ioctl.c:594
 block_ioctl+0xd9/0x120 fs/block_dev.c:1893
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684

Crashes (48668):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/15 04:02 linux-4.14.y c4215ee4771b a63719e7 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2022/11/03 14:05 linux-4.14.y a85772d7ba90 7a2ebf95 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2022/08/19 15:20 linux-4.14.y b641242202ed 26a13b38 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2022/05/11 14:53 linux-4.14.y e3a56aaade89 8d7b3b67 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/08/11 16:12 linux-4.14.y 46914f96189b 6972b106 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/06/14 14:05 linux-4.14.y 3d3abdc8ebd3 1ba81399 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/05/28 23:05 linux-4.14.y ad8397a84e1e 858ea628 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/04/14 23:42 linux-4.14.y 958e517f4e16 fcdb12ba .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/01/19 07:05 linux-4.14.y 2762b48e9611 63631df1 .config console log report syz C ci2-linux-4-14 possible deadlock in blkdev_reread_part
2020/08/05 02:28 linux-4.14.y 7f2c5eb458b8 02034dac .config console log report syz C ci2-linux-4-14
2020/07/10 10:50 linux-4.14.y b850307b279c 56d01184 .config console log report syz C ci2-linux-4-14
2020/04/14 01:28 linux-4.14.y c10b57a567e4 7c54686a .config console log report syz C ci2-linux-4-14
2020/04/07 01:25 linux-4.14.y 4520f06b03ae 99a96044 .config console log report syz C ci2-linux-4-14
2019/09/04 01:46 linux-4.14.y 01fd1694b93c 526709ff .config console log report syz C ci2-linux-4-14
2019/08/12 08:29 linux-4.14.y 3ffe1e79c174 acb51638 .config console log report syz C ci2-linux-4-14
2019/07/21 05:22 linux-4.14.y aea8526edf59 1656845f .config console log report syz C ci2-linux-4-14
2019/07/04 12:07 linux-4.14.y e3c1b27308ae 55565fa0 .config console log report syz C ci2-linux-4-14
2019/07/01 13:07 linux-4.14.y f4cc0ed9b2c7 907bf746 .config console log report syz C ci2-linux-4-14
2019/04/25 19:31 linux-4.14.y 68d7a45eec10 f46aabc8 .config console log report syz C ci2-linux-4-14
2019/04/11 17:43 linux-4.14.y 1ec8f1f0bffe 13030ef8 .config console log report syz C ci2-linux-4-14
2020/02/29 13:19 linux-4.14.y 78d697fc93f9 c88c7b75 .config console log report syz ci2-linux-4-14
2023/03/07 08:45 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/07 07:35 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/07 06:13 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/07 04:35 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/07 02:26 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/07 01:28 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 23:19 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 21:57 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 19:37 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 18:04 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 16:26 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 14:52 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 13:43 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 12:23 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 10:15 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 08:46 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 07:31 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 05:44 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 04:21 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 02:49 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/06 00:40 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 23:25 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 21:19 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 18:25 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 17:14 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 14:36 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 12:58 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 11:48 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 10:47 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 09:29 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 08:05 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 06:47 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 05:07 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 03:28 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/05 02:23 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 23:10 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 22:01 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 20:44 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 19:00 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 17:57 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 15:08 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 13:18 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 10:37 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 08:59 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 07:40 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2023/03/04 06:13 linux-4.14.y 7878a41b6cc1 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in blkdev_reread_part
2021/01/17 14:12 linux-4.14.y 2762b48e9611 813be542 .config console log report info ci2-linux-4-14
2019/04/11 12:07 linux-4.14.y 1ec8f1f0bffe e955ac50 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.