syzbot


possible deadlock in brd_probe

Status: closed as dup on 2021/08/08 13:02
Reported-by: syzbot+fd01c5d29a476390728d@syzkaller.appspotmail.com
First crash: 640d, last: 355d

Cause bisection: introduced by (bisect log) [merge commit]:
commit ee51814888278677cb4384814bbe3c95f6270b50
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri Nov 6 20:21:33 2020 +0000

  Merge tag 's390-5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Crash: BUG: sleeping function called from invalid context in sta_info_move_state (log)
Repro: C syz .config
Duplicate of (1):
Title Repro Cause bisect Fix bisect Count Last Reported
possible deadlock in loop_probe C done 20656 400d 425d
Patch testing requests:
Created Duration User Patch Repo Result
2021/06/18 04:09 17m desmondcheongzx@gmail.com patch upstream OK

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.14.0-rc4-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor343/302 is trying to acquire lock:
ffffffff8ce83d28 (brd_devices_mutex){+.+.}-{3:3}, at: brd_probe+0x30/0xe0 drivers/block/brd.c:431

but task is already holding lock:
ffffffff8ccead28 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x2f/0x1c0 block/genhd.c:657

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (major_names_lock){+.+.}-{3:3}:
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
       __mutex_lock kernel/locking/mutex.c:1104 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
       __register_blkdev+0x2c/0x360 block/genhd.c:216
       register_mtd_blktrans+0x94/0x3d0 drivers/mtd/mtd_blkdevs.c:531
       do_one_initcall+0x197/0x3f0 init/main.c:1282
       do_initcall_level+0x14a/0x1f5 init/main.c:1355
       do_initcalls+0x4b/0x8c init/main.c:1371
       kernel_init_freeable+0x3f1/0x57e init/main.c:1593
       kernel_init+0x19/0x2a0 init/main.c:1485
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #2 (mtd_table_mutex){+.+.}-{3:3}:
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
       __mutex_lock kernel/locking/mutex.c:1104 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
       blktrans_open+0x61/0x430 drivers/mtd/mtd_blkdevs.c:210
       blkdev_get_whole+0x94/0x500 fs/block_dev.c:1253
       blkdev_get_by_dev+0x339/0xdc0 fs/block_dev.c:1417
       blkdev_open+0x132/0x2c0 fs/block_dev.c:1512
       do_dentry_open+0x7cb/0x1020 fs/open.c:826
       do_open fs/namei.c:3374 [inline]
       path_openat+0x27e7/0x36b0 fs/namei.c:3507
       do_filp_open+0x253/0x4d0 fs/namei.c:3534
       do_sys_openat2+0x124/0x460 fs/open.c:1204
       do_sys_open fs/open.c:1220 [inline]
       __do_sys_open fs/open.c:1228 [inline]
       __se_sys_open fs/open.c:1224 [inline]
       __x64_sys_open+0x221/0x270 fs/open.c:1224
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #1 (&disk->open_mutex){+.+.}-{3:3}:
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
       __mutex_lock kernel/locking/mutex.c:1104 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
       blkdev_get_by_dev+0x102/0xdc0 fs/block_dev.c:1410
       disk_scan_partitions block/genhd.c:388 [inline]
       register_disk block/genhd.c:435 [inline]
       __device_add_disk+0x793/0xbd0 block/genhd.c:527
       add_disk include/linux/genhd.h:217 [inline]
       brd_alloc+0x381/0x550 drivers/block/brd.c:416
       brd_init+0x154/0x262 drivers/block/brd.c:499
       do_one_initcall+0x197/0x3f0 init/main.c:1282
       do_initcall_level+0x14a/0x1f5 init/main.c:1355
       do_initcalls+0x4b/0x8c init/main.c:1371
       kernel_init_freeable+0x3f1/0x57e init/main.c:1593
       kernel_init+0x19/0x2a0 init/main.c:1485
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 (brd_devices_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3051 [inline]
       check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174
       validate_chain kernel/locking/lockdep.c:3789 [inline]
       __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015
       lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
       __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
       __mutex_lock kernel/locking/mutex.c:1104 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
       brd_probe+0x30/0xe0 drivers/block/brd.c:431
       blk_request_module+0x19d/0x1c0 block/genhd.c:660
       blkdev_get_no_open+0x44/0x1f0 fs/block_dev.c:1334
       blkdev_get_by_dev+0x89/0xdc0 fs/block_dev.c:1397
       swsusp_check+0x3e/0x210 kernel/power/swap.c:1525
       software_resume+0xc8/0x3d0 kernel/power/hibernate.c:977
       resume_store+0xdc/0x120 kernel/power/hibernate.c:1179
       kernfs_fop_write_iter+0x3b6/0x510 fs/kernfs/file.c:296
       call_write_iter include/linux/fs.h:2114 [inline]
       new_sync_write fs/read_write.c:518 [inline]
       vfs_write+0xa39/0xc90 fs/read_write.c:605
       ksys_write+0x171/0x2a0 fs/read_write.c:658
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

Chain exists of:
  brd_devices_mutex --> mtd_table_mutex --> major_names_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(major_names_lock);
                               lock(mtd_table_mutex);
                               lock(major_names_lock);
  lock(brd_devices_mutex);

 *** DEADLOCK ***

5 locks held by syz-executor343/302:
 #0: ffff88802a58e460 (sb_writers#6){.+.+}-{0:0}, at: vfs_write+0x21b/0xc90 fs/read_write.c:601
 #1: ffff8880175b0488 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1f3/0x510 fs/kernfs/file.c:287
 #2: ffff8881445aca00 (kn->active#90){.+.+}-{0:0}, at: kernfs_fop_write_iter+0x217/0x510 fs/kernfs/file.c:288
 #3: ffffffff8c5d0ce8 (system_transition_mutex/1){+.+.}-{3:3}, at: software_resume+0x7a/0x3d0 kernel/power/hibernate.c:932
 #4: ffffffff8ccead28 (major_names_lock){+.+.}-{3:3}, at: blk_request_module+0x2f/0x1c0 block/genhd.c:657

stack backtrace:
CPU: 0 PID: 302 Comm: syz-executor343 Not tainted 5.14.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
 print_circular_bug+0xb17/0xdc0 kernel/locking/lockdep.c:2009
 check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2131
 check_prev_add kernel/locking/lockdep.c:3051 [inline]
 check_prevs_add+0x4f9/0x5b30 kernel/locking/lockdep.c:3174
 validate_chain kernel/locking/lockdep.c:3789 [inline]
 __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015
 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625
 __mutex_lock_common+0x1ad/0x3770 kernel/locking/mutex.c:959
 __mutex_lock kernel/locking/mutex.c:1104 [inline]
 mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1119
 brd_probe+0x30/0xe0 drivers/block/brd.c:431
 blk_request_module+0x19d/0x1c0 block/genhd.c:660
 blkdev_get_no_open+0x44/0x1f0 fs/block_dev.c:1334
 blkdev_get_by_dev+0x89/0xdc0 fs/block_dev.c:1397
 swsusp_check+0x3e/0x210 kernel/power/swap.c:1525
 software_resume+0xc8/0x3d0 kernel/power/hibernate.c:977
 resume_store+0xdc/0x120 kernel/power/hibernate.c:1179
 kernfs_fop_write_iter+0x3b6/0x510 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2114 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0xa39/0xc90 fs/read_write.c:605
 ksys_write+0x171/0x2a0 fs/read_write.c:658
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x43fe59
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc49f32968 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000089e99 RCX: 000000000043fe59
RDX: 0000000000000012 RSI: 0000000020000140 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000012 R09: 00007ffc49f32b08
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffc49f3297c
R13: 431bde82d7b634db R14: 00000000004ae018 R15: 0000000000400488
PM: Image not found (code -22)

Crashes (15204):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2021/08/06 02:26 upstream 902e7f373fff d2d6e680 .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/07/16 19:25 upstream d936eb238744 f115ae98 .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce 2021/07/15 17:22 upstream 8096acd7442e b9a2f64e .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/06/01 04:47 upstream c2131f7e73c9 032639db .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/04/29 19:01 upstream d72cd4ad4174 77e2b668 .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/04/28 19:03 upstream acd3d2859453 77e2b668 .config log report syz C possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/03/26 23:45 upstream db24726bfefa a8529b82 .config log report syz C possible deadlock in brd_probe
ci-upstream-linux-next-kasan-gce-root 2021/05/28 03:42 linux-next a1f92694393a 858ea628 .config log report syz C possible deadlock in brd_probe
ci-upstream-linux-next-kasan-gce-root 2020/11/16 15:57 linux-next 034307507118 1bf9a662 .config log report syz C
ci-upstream-kasan-gce-smack-root 2021/08/16 16:55 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/16 15:51 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/16 15:48 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/16 14:01 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/16 12:40 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/16 12:07 upstream 7c60610d4767 33c26cb7 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/16 09:03 upstream 7c60610d4767 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/16 04:12 upstream 7c60610d4767 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/16 04:07 upstream 7c60610d4767 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/16 03:07 upstream 7c60610d4767 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/16 02:05 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/16 00:18 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce 2021/08/16 00:13 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 20:36 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 18:20 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 13:39 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 13:10 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/15 12:07 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 09:53 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 08:28 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 07:44 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/15 07:44 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/15 03:09 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 03:06 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/15 00:24 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 23:20 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 23:07 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 22:06 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 20:13 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 19:11 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 18:28 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 17:14 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 13:35 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/14 11:06 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-root 2021/08/14 09:49 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 08:11 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 05:05 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 04:05 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 02:57 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/14 01:49 upstream dfa377c35d70 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-selinux-root 2021/08/13 15:45 upstream f8e6dfc64f61 3fd2ea69 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/13 14:30 upstream f8e6dfc64f61 3fd2ea69 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-smack-root 2021/08/13 13:12 upstream f8e6dfc64f61 3fd2ea69 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce 2021/08/13 10:24 upstream f8fbb47c6e86 3fd2ea69 .config log report info possible deadlock in brd_probe
ci-qemu-upstream 2021/08/04 20:09 upstream d5ad8ec3cfb5 b97d64c9 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-386 2021/08/15 14:49 upstream 0aa78d17099b 2489ab88 .config log report info possible deadlock in brd_probe
ci-upstream-kasan-gce-386 2021/08/15 01:29 upstream ba31f97d43be 2489ab88 .config log report info possible deadlock in brd_probe
ci-qemu-upstream-386 2021/08/01 03:51 upstream f3438b4c4e69 6c236867 .config log report info possible deadlock in brd_probe
ci-upstream-linux-next-kasan-gce-root 2021/08/25 17:29 linux-next 7636510f976d b599f2fc .config log report info possible deadlock in brd_probe
ci-upstream-linux-next-kasan-gce-root 2021/07/20 18:20 linux-next c1a6d08348fc 1b201b48 .config log report info possible deadlock in brd_probe
ci-upstream-linux-next-kasan-gce-root 2021/01/17 14:27 linux-next b3a3cbdec55b 813be542 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/11/13 10:21 linux-next 92edc4aef867 16fca0c8 .config log report info