syzbot


possible deadlock in __get_super

Status: auto-closed as invalid on 2021/04/22 12:47
Reported-by: syzbot+f472d83492acd53a5abf@syzkaller.appspotmail.com
First crash: 1269d, last: 1211d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in __get_super (2) 1 929d 929d 0/1 auto-closed as invalid on 2022/01/29 13:10
linux-4.19 possible deadlock in __get_super (3) 1 706d 706d 0/1 auto-obsoleted due to no activity on 2022/09/09 09:07
linux-4.19 possible deadlock in __get_super (4) reiserfs C 3 432d 479d 0/1 upstream: reported C repro on 2022/12/25 20:02
linux-4.14 possible deadlock in __get_super reiserfs C 4 432d 1256d 0/1 upstream: reported C repro on 2020/11/08 14:16

Sample crash report:
REISERFS warning (device loop1): sh-2006 read_super_block: bread failed (dev loop1, block 2, size 4096)
FAT-fs (loop4): Can't find a valid FAT filesystem
======================================================
WARNING: possible circular locking dependency detected
4.19.163-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/21349 is trying to acquire lock:
00000000290a2116 (&type->s_umount_key#79){++++}, at: __get_super.part.0+0x209/0x2e0 fs/super.c:698

but task is already holding lock:
0000000075e60e71 (&bdev->bd_mutex){+.+.}, at: blkdev_reread_part+0x1b/0x40 block/ioctl.c:192
REISERFS warning (device loop1): sh-2021 reiserfs_fill_super: can not find reiserfs on loop1

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&bdev->bd_mutex){+.+.}:
       blkdev_put+0x30/0x520 fs/block_dev.c:1839
       release_journal_dev fs/reiserfs/journal.c:2601 [inline]
       free_journal_ram+0x44b/0x600 fs/reiserfs/journal.c:1904
       do_journal_release fs/reiserfs/journal.c:1970 [inline]
       journal_release+0x225/0x4d0 fs/reiserfs/journal.c:1981
       reiserfs_put_super+0xe0/0x5c0 fs/reiserfs/super.c:616
       generic_shutdown_super+0x144/0x370 fs/super.c:456
       kill_block_super+0x97/0xf0 fs/super.c:1185
       deactivate_locked_super+0x94/0x160 fs/super.c:329
       deactivate_super+0x174/0x1a0 fs/super.c:360
       cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098
       task_work_run+0x148/0x1c0 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:193 [inline]
       exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
       prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
       do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&type->s_umount_key#79){++++}:
       down_read+0x36/0x80 kernel/locking/rwsem.c:24
       __get_super.part.0+0x209/0x2e0 fs/super.c:698
       __get_super include/linux/spinlock.h:329 [inline]
       get_super+0x2b/0x50 fs/super.c:727
       fsync_bdev+0x14/0xc0 fs/block_dev.c:483
       invalidate_partition+0x74/0xb0 block/genhd.c:1580
       drop_partitions.isra.0+0x9c/0x190 block/partition-generic.c:454
       rescan_partitions+0xab/0x970 block/partition-generic.c:527
       __blkdev_reread_part+0x189/0x220 block/ioctl.c:173
       blkdev_reread_part+0x23/0x40 block/ioctl.c:193
       loop_reread_partitions drivers/block/loop.c:645 [inline]
       loop_set_status+0x103e/0x1800 drivers/block/loop.c:1330
       loop_set_status64+0xb2/0x110 drivers/block/loop.c:1450
       lo_ioctl+0x41f/0x20e0 drivers/block/loop.c:1593
       __blkdev_driver_ioctl block/ioctl.c:303 [inline]
       blkdev_ioctl+0x5cb/0x1a7e block/ioctl.c:601
       block_ioctl+0xe9/0x130 fs/block_dev.c:1906
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:501 [inline]
       do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
       ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
       __do_sys_ioctl fs/ioctl.c:712 [inline]
       __se_sys_ioctl fs/ioctl.c:710 [inline]
       __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&bdev->bd_mutex);
                               lock(&type->s_umount_key#79);
                               lock(&bdev->bd_mutex);
  lock(&type->s_umount_key#79);

 *** DEADLOCK ***

1 lock held by syz-executor.1/21349:
 #0: 0000000075e60e71 (&bdev->bd_mutex){+.+.}, at: blkdev_reread_part+0x1b/0x40 block/ioctl.c:192

stack backtrace:
CPU: 0 PID: 21349 Comm: syz-executor.1 Not tainted 4.19.163-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2fe lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1221
 check_prev_add kernel/locking/lockdep.c:1865 [inline]
 check_prevs_add kernel/locking/lockdep.c:1978 [inline]
 validate_chain kernel/locking/lockdep.c:2419 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3415
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3907
 down_read+0x36/0x80 kernel/locking/rwsem.c:24
 __get_super.part.0+0x209/0x2e0 fs/super.c:698
 __get_super include/linux/spinlock.h:329 [inline]
 get_super+0x2b/0x50 fs/super.c:727
 fsync_bdev+0x14/0xc0 fs/block_dev.c:483
 invalidate_partition+0x74/0xb0 block/genhd.c:1580
 drop_partitions.isra.0+0x9c/0x190 block/partition-generic.c:454
 rescan_partitions+0xab/0x970 block/partition-generic.c:527
 __blkdev_reread_part+0x189/0x220 block/ioctl.c:173
 blkdev_reread_part+0x23/0x40 block/ioctl.c:193
 loop_reread_partitions drivers/block/loop.c:645 [inline]
 loop_set_status+0x103e/0x1800 drivers/block/loop.c:1330
 loop_set_status64+0xb2/0x110 drivers/block/loop.c:1450
 lo_ioctl+0x41f/0x20e0 drivers/block/loop.c:1593
 __blkdev_driver_ioctl block/ioctl.c:303 [inline]
 blkdev_ioctl+0x5cb/0x1a7e block/ioctl.c:601
 block_ioctl+0xe9/0x130 fs/block_dev.c:1906
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45dfb7
Code: 48 83 c4 08 48 89 d8 5b 5d c3 66 0f 1f 84 00 00 00 00 00 48 89 e8 48 f7 d8 48 39 c3 0f 92 c0 eb 92 66 90 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 6d b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f32d9dcb9e8 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045dfb7
RDX: 00007f32d9dcbab0 RSI: 0000000000004c04 RDI: 0000000000000004
RBP: 000000000119bfc0 R08: 00007f32d9dcba18 R09: 0000000000000000
R10: 00007f32d9dcba1c R11: 0000000000000202 R12: 000000000119bf8c
R13: 00007ffce7e930df R14: 00007f32d9dcc9c0 R15: 000000000119bf8c
REISERFS warning (device loop1): sh-2021 reiserfs_fill_super: can not find reiserfs on loop1
FAT-fs (loop4): bogus number of reserved sectors
FAT-fs (loop4): Can't find a valid FAT filesystem
FAT-fs (loop4): bogus number of reserved sectors
FAT-fs (loop4): Can't find a valid FAT filesystem

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/23 12:47 linux-4.19.y 13d2ce42de8c c2c1d1dd .config console log report info ci2-linux-4-19
2020/10/26 10:31 linux-4.19.y ad326970d25c a7aac492 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.