[hfsplus?] possible deadlock in hfsplus_block_allocate

6 views
Skip to first unread message

syzbot

unread,
Dec 22, 2022, 8:15:49 AM12/22/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=1012f2e8480000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=29dfb1f517067a45205c
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+29dfb1...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
syz-executor.3/26342 is trying to acquire lock:
0000000082c572d7 (&sbi->alloc_mutex){+.+.}, at: hfsplus_block_allocate+0xe0/0xa60 fs/hfsplus/bitmap.c:35

but task is already holding lock:
000000004d31a36c (&HFSPLUS_I(inode)->extents_lock){+.+.}, at: hfsplus_file_extend+0x1bb/0xf40 fs/hfsplus/extents.c:457

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.5'.

-> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}:
hfsplus_get_block+0x292/0x960 fs/hfsplus/extents.c:260
block_read_full_page+0x288/0xd10 fs/buffer.c:2259
do_read_cache_page+0x533/0x1170 mm/filemap.c:2828
read_mapping_page include/linux/pagemap.h:402 [inline]
hfsplus_block_allocate+0x197/0xa60 fs/hfsplus/bitmap.c:37
hfsplus_file_extend+0x436/0xf40 fs/hfsplus/extents.c:468
hfsplus_get_block+0x196/0x960 fs/hfsplus/extents.c:245
__block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978
__block_write_begin fs/buffer.c:2028 [inline]
block_write_begin+0x58/0x2e0 fs/buffer.c:2087
cont_write_begin+0x55a/0x820 fs/buffer.c:2440
hfsplus_write_begin+0x87/0x150 fs/hfsplus/inode.c:52
cont_expand_zero fs/buffer.c:2367 [inline]
cont_write_begin+0x2ee/0x820 fs/buffer.c:2430
hfsplus_write_begin+0x87/0x150 fs/hfsplus/inode.c:52
generic_cont_expand_simple+0x106/0x170 fs/buffer.c:2331
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
hfsplus_setattr+0x18b/0x310 fs/hfsplus/inode.c:257
notify_change+0x70b/0xfc0 fs/attr.c:334
do_truncate+0x134/0x1f0 fs/open.c:63
do_sys_ftruncate+0x492/0x560 fs/open.c:194
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&sbi->alloc_mutex){+.+.}:
__mutex_lock_common kernel/locking/mutex.c:937 [inline]
__mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
hfsplus_block_allocate+0xe0/0xa60 fs/hfsplus/bitmap.c:35
hfsplus_file_extend+0x436/0xf40 fs/hfsplus/extents.c:468
hfsplus_bmap_reserve+0x298/0x440 fs/hfsplus/btree.c:357
hfsplus_create_cat+0x1e3/0x1210 fs/hfsplus/catalog.c:272
hfsplus_fill_super+0x14a8/0x19e0 fs/hfsplus/super.c:560
mount_bdev+0x2fc/0x3b0 fs/super.c:1158
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(&HFSPLUS_I(inode)->extents_lock);
lock(&sbi->alloc_mutex);
lock(&HFSPLUS_I(inode)->extents_lock);
netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'.
lock(&sbi->alloc_mutex);

*** DEADLOCK ***

4 locks held by syz-executor.3/26342:
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.5'.
#0: 00000000242aa9a6 (&type->s_umount_key#82/1){+.+.}, at: alloc_super fs/super.c:226 [inline]
#0: 00000000242aa9a6 (&type->s_umount_key#82/1){+.+.}, at: sget_userns+0x20b/0xcd0 fs/super.c:519
#1: 000000008daec34c (&sbi->vh_mutex){+.+.}, at: hfsplus_fill_super+0x1421/0x19e0 fs/hfsplus/super.c:553
#2: 000000004c90a259 (&tree->tree_lock#2){+.+.}, at: hfsplus_find_init+0x1b7/0x220 fs/hfsplus/bfind.c:30
#3: 000000004d31a36c (&HFSPLUS_I(inode)->extents_lock){+.+.}, at: hfsplus_file_extend+0x1bb/0xf40 fs/hfsplus/extents.c:457

stack backtrace:
CPU: 0 PID: 26342 Comm: syz-executor.3 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
__mutex_lock_common kernel/locking/mutex.c:937 [inline]
__mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
hfsplus_block_allocate+0xe0/0xa60 fs/hfsplus/bitmap.c:35
hfsplus_file_extend+0x436/0xf40 fs/hfsplus/extents.c:468
hfsplus_bmap_reserve+0x298/0x440 fs/hfsplus/btree.c:357
hfsplus_create_cat+0x1e3/0x1210 fs/hfsplus/catalog.c:272
hfsplus_fill_super+0x14a8/0x19e0 fs/hfsplus/super.c:560
mount_bdev+0x2fc/0x3b0 fs/super.c:1158
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:0x7f3ebfca45da
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007f3ebe214f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 000000000000064d RCX: 00007f3ebfca45da
RDX: 0000000020000600 RSI: 0000000020000080 RDI: 00007f3ebe214fe0
RBP: 00007f3ebe215020 R08: 00007f3ebe215020 R09: 0000000002008090
R10: 0000000002008090 R11: 0000000000000202 R12: 0000000020000600
R13: 0000000020000080 R14: 00007f3ebe214fe0 R15: 0000000020000040
device � entered promiscuous mode
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
device � entered promiscuous mode
device � entered promiscuous mode
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
device � entered promiscuous mode
A link change request failed with some changes committed already. Interface veth0_to_bridge may have been left with an inconsistent configuration, please check.
device � entered promiscuous mode
device � entered promiscuous mode
device � entered promiscuous mode
xt_hashlimit: invalid rate
xt_hashlimit: invalid rate
xt_hashlimit: invalid rate
xt_hashlimit: invalid rate
hfs: unable to load iocharset "iso8859 j�-����T��CE�u) ��� # ���" ��Y�8 ⊇�H[Q\�� � p��r�� }���G�d%��H&;��:z
� �*X�m���������j��J� ����i�H û_ �A�ۘ�h�ۤ�2c��&��� C ÈK��0o~��� �"
hfs: unable to parse mount options
loop1: p1 p3 < >
loop1: p1 start 3892578304 is beyond EOD, truncated
print_req_error: I/O error, dev loop1, sector 3072
print_req_error: I/O error, dev loop1, sector 3072
buffer_io_error: 271 callbacks suppressed
Buffer I/O error on dev loop1p3, logical block 0, async page read
__loop_clr_fd: partition scan of loop1 failed (rc=-16)
hfs: unable to load iocharset "iso8859 j�-����T��CE�u) ��� # ���" ��Y�8 ⊇�H[Q\�� � p��r�� }���G�d%��H&;��:z
� �*X�m���������j��J� ����i�H û_ �A�ۘ�h�ۤ�2c��&��� C ÈK��0o~��� �"
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
hfs: unable to parse mount options
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
print_req_error: I/O error, dev loop1, sector 3072
Buffer I/O error on dev loop1p3, logical block 0, async page read
hfs: unable to load iocharset "iso8859 j�-����T��CE�u) ��� # ���" ��Y�8 ⊇�H[Q\�� � p��r�� }���G�d%��H&;��:z
� �*X�m���������j��J� ����i�H û_ �A�ۘ�h�ۤ�2c��&��� C ÈK��0o~��� �"
Buffer I/O error on dev loop1p3, logical block 0, async page read
hfs: unable to parse mount options
hfs: unable to load iocharset "iso8859 j�-����T��CE�u) ��� # ���" ��Y�8 ⊇�H[Q\�� � p��r�� }���G�d%��H&;��:z
� �*X�m���������j��J� ����i�H û_ �A�ۘ�h�ۤ�2c��&��� C ÈK��0o~��� �"
hfs: unable to parse mount options
loop1: p1 p3 < >
loop1: p1 start 3892578304 is beyond EOD, truncated
loop1: p1 p3 < >
loop1: p1 start 3892578304 is beyond EOD, truncated
loop1: p1 p3 < >
loop1: p1 start 3892578304 is beyond EOD, truncated
loop1: p1 p3 < >
loop1: p1 start 3892578304 is beyond EOD, truncated


---
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.
Reply all
Reply to author
Forward
0 new messages