syzbot


possible deadlock in __get_super (4)

Status: upstream: reported C repro on 2022/12/25 20:02
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+becf4e31e71a2e4f7a56@syzkaller.appspotmail.com
First crash: 480d, last: 433d
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 930d 930d 0/1 auto-closed as invalid on 2022/01/29 13:10
linux-4.19 possible deadlock in __get_super (3) 1 708d 708d 0/1 auto-obsoleted due to no activity on 2022/09/09 09:07
linux-4.19 possible deadlock in __get_super 2 1212d 1271d 0/1 auto-closed as invalid on 2021/04/22 12:47
linux-4.14 possible deadlock in __get_super reiserfs C 4 433d 1257d 0/1 upstream: reported C repro on 2020/11/08 14:16

Sample crash report:
REISERFS (device loop1): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop1): using ordered data mode
reiserfs: using flush barriers
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor222/8096 is trying to acquire lock:
REISERFS (device loop3): found reiserfs format "3.5" with non-standard journal
000000003e4e5bbb (&type->s_umount_key#46){++++}, at: __get_super.part.0+0x209/0x2e0 fs/super.c:698

but task is already holding lock:
000000005f62cb59 (&bdev->bd_mutex){+.+.}, at: blkdev_reread_part+0x1b/0x40 block/ioctl.c:192

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&bdev->bd_mutex){+.+.}:
REISERFS (device loop3): using ordered data mode
       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
reiserfs: using flush barriers
       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
REISERFS (device loop1): journal params: device loop1, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30

-> #0 (&type->s_umount_key#46){++++}:
       down_read+0x36/0x80 kernel/locking/rwsem.c:24
       __get_super.part.0+0x209/0x2e0 fs/super.c:698
REISERFS (device loop1): checking transaction log (loop1)
       __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:1592
       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
REISERFS (device loop3): journal params: device loop3, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
       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/0x1a80 block/ioctl.c:601
REISERFS (device loop3): checking transaction log (loop3)
       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#46);
REISERFS (device loop1): Using r5 hash to sort names
                               lock(&bdev->bd_mutex);
  lock(&type->s_umount_key#46);

 *** DEADLOCK ***

1 lock held by syz-executor222/8096:
 #0: 000000005f62cb59 (&bdev->bd_mutex){+.+.}, at: blkdev_reread_part+0x1b/0x40 block/ioctl.c:192
REISERFS (device loop1): using 3.5.x disk format

stack backtrace:
CPU: 0 PID: 8096 Comm: syz-executor222 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
REISERFS (device loop3): Using r5 hash to sort names
REISERFS (device loop3): using 3.5.x disk format
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 down_read+0x36/0x80 kernel/locking/rwsem.c:24
REISERFS (device loop1): Created .reiserfs_priv - reserved for xattr storage.
 __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:1592
REISERFS (device loop3): Created .reiserfs_priv - reserved for xattr storage.
 drop_partitions.isra.0+0x9c/0x190 block/partition-generic.c:454
REISERFS (device loop0): found reiserfs format "3.5" with non-standard journal
 rescan_partitions+0xab/0x970 block/partition-generic.c:527
 __blkdev_reread_part+0x189/0x220 block/ioctl.c:173
REISERFS (device loop0): using ordered data mode
 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
reiserfs: using flush barriers
 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/0x1a80 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:0x7f35f808fb89
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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:00007ffced4b2268 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f35f808fb89
RDX: 0000000020004640 RSI: 0000000000004c04 RDI: 0000000000000004
RBP: 0000000000000000 R08: 00000000000010f0 R09: 00007ffced4b2290
R10: 000000000000ffff R11: 0000000000000246 R12: 00007f35f804e9a0
R13: 00007ffced4b22c0 R14: 00007ffced4b22a0 R15: 0000000000000000
REISERFS (device loop5): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop5): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop5): journal params: device loop5, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop5): checking transaction log (loop5)
REISERFS (device loop5): Using r5 hash to sort names
REISERFS (device loop5): using 3.5.x disk format
REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage.

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/10 23:11 linux-4.19.y 3f8a27f9e27b e29a17f5 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in __get_super
2023/01/10 23:18 linux-4.19.y 3f8a27f9e27b 48bc529a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __get_super
2022/12/25 20:02 linux-4.19.y 3f8a27f9e27b 9da18ae8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in __get_super
* Struck through repros no longer work on HEAD.