[v6.1] possible deadlock in udf_free_blocks

6 views
Skip to first unread message

syzbot

unread,
Dec 3, 2024, 4:21:27 AM12/3/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e4d90d63d385 Linux 6.1.119
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14d06fc0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5516a02be29a5649
dashboard link: https://syzkaller.appspot.com/bug?extid=29718837e662d73e2719
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/19f991f20183/disk-e4d90d63.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/61eb5f055f38/vmlinux-e4d90d63.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0ddd97416681/bzImage-e4d90d63.xz

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

============================================
WARNING: possible recursive locking detected
6.1.119-syzkaller #0 Not tainted
--------------------------------------------
syz.2.12/4437 is trying to acquire lock:
ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_free_blocks fs/udf/balloc.c:395 [inline]
ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_free_blocks+0x9ad/0x21e0 fs/udf/balloc.c:686

but task is already holding lock:
ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:594 [inline]
ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xf84/0x2130 fs/udf/balloc.c:734

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&sbi->s_alloc_mutex);
lock(&sbi->s_alloc_mutex);

*** DEADLOCK ***

May be due to missing lock nesting notation

4 locks held by syz.2.12/4437:
#0: ffff88805656a460 (sb_writers#16){.+.+}-{0:0}, at: do_sendfile+0x5f4/0xff0 fs/read_write.c:1254
#1: ffff888074bd8f78 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#1: ffff888074bd8f78 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: udf_file_write_iter+0x75/0x670 fs/udf/file.c:145
#2: ffff888074bd8da0 (&ei->i_data_sem#2){++++}-{3:3}, at: udf_get_block+0x153/0x5360 fs/udf/inode.c:346
#3: ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:594 [inline]
#3: ffff88802713dd28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xf84/0x2130 fs/udf/balloc.c:734

stack backtrace:
CPU: 1 PID: 4437 Comm: syz.2.12 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_deadlock_bug kernel/locking/lockdep.c:2983 [inline]
check_deadlock kernel/locking/lockdep.c:3026 [inline]
validate_chain+0x4711/0x5950 kernel/locking/lockdep.c:3812
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
udf_table_free_blocks fs/udf/balloc.c:395 [inline]
udf_free_blocks+0x9ad/0x21e0 fs/udf/balloc.c:686
udf_delete_aext+0x68a/0xda0 fs/udf/inode.c:2211
udf_table_new_block fs/udf/balloc.c:654 [inline]
udf_new_block+0x184d/0x2130 fs/udf/balloc.c:734
inode_getblk fs/udf/inode.c:769 [inline]
udf_get_block+0x1a69/0x5360 fs/udf/inode.c:359
__block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x98/0x1f0 fs/buffer.c:2102
udf_write_begin+0x2d/0x60 fs/udf/inode.c:212
generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3845
__generic_file_write_iter+0x297/0x400 mm/filemap.c:3941
udf_file_write_iter+0x291/0x670 fs/udf/file.c:164
do_iter_write+0x6e6/0xc40 fs/read_write.c:861
iter_file_splice_write+0x830/0xfc0 fs/splice.c:685
do_splice_from fs/splice.c:763 [inline]
direct_splice_actor+0xe3/0x1c0 fs/splice.c:950
splice_direct_to_actor+0x4c7/0xc30 fs/splice.c:896
do_splice_direct+0x2a5/0x3e0 fs/splice.c:1002
do_sendfile+0x619/0xff0 fs/read_write.c:1255
__do_sys_sendfile64 fs/read_write.c:1323 [inline]
__se_sys_sendfile64+0x178/0x1e0 fs/read_write.c:1309
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f8e8cf7ff19
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8e8de59058 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f8e8d145fa0 RCX: 00007f8e8cf7ff19
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000005
RBP: 00007f8e8cff3986 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000800000009 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8e8d145fa0 R15: 00007fff16a37b98
</TASK>


---
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.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Dec 4, 2024, 6:30:24 AM12/4/24
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: e4d90d63d385 Linux 6.1.119
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16b39fc0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5516a02be29a5649
dashboard link: https://syzkaller.appspot.com/bug?extid=29718837e662d73e2719
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12ea60f8580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17d248df980000
mounted in repro: https://storage.googleapis.com/syzbot-assets/f549f7df845b/mount_0.gz

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

=======================================================
============================================
WARNING: possible recursive locking detected
6.1.119-syzkaller #0 Not tainted
--------------------------------------------
syz-executor756/4248 is trying to acquire lock:
ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_free_blocks fs/udf/balloc.c:395 [inline]
ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_free_blocks+0x9ad/0x21e0 fs/udf/balloc.c:686

but task is already holding lock:
ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:594 [inline]
ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xf84/0x2130 fs/udf/balloc.c:734

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&sbi->s_alloc_mutex);
lock(&sbi->s_alloc_mutex);

*** DEADLOCK ***

May be due to missing lock nesting notation

4 locks held by syz-executor756/4248:
#0: ffff8880771aa460 (sb_writers#9){.+.+}-{0:0}, at: do_sendfile+0x5f4/0xff0 fs/read_write.c:1254
#1: ffff8880746d0f78 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#1: ffff8880746d0f78 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: udf_file_write_iter+0x75/0x670 fs/udf/file.c:145
#2: ffff8880746d0da0 (&ei->i_data_sem#2){++++}-{3:3}, at: udf_get_block+0x153/0x5360 fs/udf/inode.c:346
#3: ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:594 [inline]
#3: ffff888030c42128 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xf84/0x2130 fs/udf/balloc.c:734

stack backtrace:
CPU: 0 PID: 4248 Comm: syz-executor756 Not tainted 6.1.119-syzkaller #0
RIP: 0033:0x7f4bf89c64d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 81 1c 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4bf897c218 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f4bf8a476c8 RCX: 00007f4bf89c64d9
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000005
RBP: 00007f4bf8a476c0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000800000009 R11: 0000000000000246 R12: 00007f4bf8a13cb0
R13: 00007f4bf8a13047 R14: 0030656c69662f2e R15: 0031656c69662f2e
</TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
Reply all
Reply to author
Forward
0 new messages