[reiserfs?] possible deadlock in __get_super (4)

6 views
Skip to first unread message

syzbot

unread,
Dec 25, 2022, 3:02:38 PM12/25/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16301ff8480000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=becf4e31e71a2e4f7a56
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+becf4e...@syzkaller.appspotmail.com

REISERFS warning (device nbd0): sh-2006 read_super_block: bread failed (dev nbd0, block 8, size 1024)
print_req_error: I/O error, dev nbd0, sector 128
REISERFS warning (device nbd0): sh-2006 read_super_block: bread failed (dev nbd0, block 64, size 1024)
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/3470 is trying to acquire lock:
000000007c9b8ab2 (&type->s_umount_key#49){++++}, at: __get_super.part.0+0x209/0x2e0 fs/super.c:698

but task is already holding lock:
00000000b149477b (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x1d0/0x1480 fs/block_dev.c:1478

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#49){++++}:
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:1592
drop_partitions.isra.0+0x9c/0x190 block/partition-generic.c:454
rescan_partitions+0xab/0x970 block/partition-generic.c:527
bdev_disk_changed+0x179/0x1b0 fs/block_dev.c:1435
__blkdev_get+0x1282/0x1480 fs/block_dev.c:1561
blkdev_get+0x48f/0x940 fs/block_dev.c:1627
blkdev_get_by_path+0x48/0xd0 fs/block_dev.c:1708
mount_bdev+0x5b/0x3b0 fs/super.c:1116
mount_fs+0xa3/0x310 fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2492 [inline]
do_mount+0x115c/0x2f50 fs/namespace.c:2822
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
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#49);
lock(&bdev->bd_mutex);
lock(&type->s_umount_key#49);

*** DEADLOCK ***

1 lock held by syz-executor.0/3470:
#0: 00000000b149477b (&bdev->bd_mutex){+.+.}, at: __blkdev_get+0x1d0/0x1480 fs/block_dev.c:1478

stack backtrace:
CPU: 1 PID: 3470 Comm: syz-executor.0 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
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
lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
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:1592
drop_partitions.isra.0+0x9c/0x190 block/partition-generic.c:454
rescan_partitions+0xab/0x970 block/partition-generic.c:527
bdev_disk_changed+0x179/0x1b0 fs/block_dev.c:1435
__blkdev_get+0x1282/0x1480 fs/block_dev.c:1561
blkdev_get+0x48f/0x940 fs/block_dev.c:1627
blkdev_get_by_path+0x48/0xd0 fs/block_dev.c:1708
mount_bdev+0x5b/0x3b0 fs/super.c:1116
mount_fs+0xa3/0x310 fs/super.c:1261
vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
vfs_kern_mount fs/namespace.c:951 [inline]
do_new_mount fs/namespace.c:2492 [inline]
do_mount+0x115c/0x2f50 fs/namespace.c:2822
ksys_mount+0xcf/0x130 fs/namespace.c:3038
__do_sys_mount fs/namespace.c:3052 [inline]
__se_sys_mount fs/namespace.c:3049 [inline]
__x64_sys_mount+0xba/0x150 fs/namespace.c:3049
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f79c46790a9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f79c2ba9168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f79c4799120 RCX: 00007f79c46790a9
RDX: 0000000020000240 RSI: 0000000020000200 RDI: 0000000020000000
RBP: 00007f79c46d4ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffea2520f4f R14: 00007f79c2ba9300 R15: 0000000000022000
REISERFS warning (device nbd0): sh-2021 reiserfs_fill_super: can not find reiserfs on nbd0
netlink: 'syz-executor.3': attribute type 33 has an invalid length.
REISERFS warning (device nbd0): reiserfs_fill_super: Cannot allocate commit workqueue
netlink: 'syz-executor.3': attribute type 33 has an invalid length.
audit: type=1800 audit(1671998514.540:752): pid=3658 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="bus" dev="sda1" ino=14407 res=0
audit: type=1800 audit(1671998514.630:753): pid=3697 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="bus" dev="sda1" ino=14407 res=0
audit: type=1800 audit(1671998515.280:754): pid=3710 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="bus" dev="sda1" ino=14401 res=0
F2FS-fs (loop2): invalid crc value
F2FS-fs (loop2): Found nat_bits in checkpoint
F2FS-fs (loop2): f2fs_check_nid_range: out-of-range nid=2, run fsck to fix.
F2FS-fs (loop2): Mounted with checkpoint version = 48b305e4
audit: type=1800 audit(1671998515.930:755): pid=3689 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="loop2" ino=10 res=0
audit: type=1804 audit(1671998515.950:756): pid=3689 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir71973728/syzkaller.KuDzts/602/file0/bus" dev="loop2" ino=10 res=1


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Feb 10, 2023, 6:11:45 PM2/10/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17e8fa1b480000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=becf4e31e71a2e4f7a56
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1473821b480000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=122549c0c80000
mounted in repro: https://storage.googleapis.com/syzbot-assets/30d1610fb72d/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+becf4e...@syzkaller.appspotmail.com

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.

Reply all
Reply to author
Forward
0 new messages