[v6.6] possible deadlock in udf_free_blocks

1 view
Skip to first unread message

syzbot

unread,
Jun 21, 2025, 7:39:29 AM6/21/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6282921b6825 Linux 6.6.94
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10f3d30c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=96da6b2210cda427
dashboard link: https://syzkaller.appspot.com/bug?extid=96085947cb5d4acdaa1c
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a3bf0d8e22b2/disk-6282921b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d1d442f782d0/vmlinux-6282921b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a8378f4b7e1b/bzImage-6282921b.xz

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

============================================
WARNING: possible recursive locking detected
6.6.94-syzkaller #0 Not tainted
--------------------------------------------
syz.3.12/5930 is trying to acquire lock:
ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_free_blocks fs/udf/balloc.c:392 [inline]
ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_free_blocks+0x8ff/0x16e0 fs/udf/balloc.c:694

but task is already holding lock:
ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:598 [inline]
ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xea7/0x1a70 fs/udf/balloc.c:742

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.3.12/5930:
#0: ffff8880580a2418 (sb_writers#17){.+.+}-{0:0}, at: do_sendfile+0x5b9/0xf70 fs/read_write.c:1253
#1: ffff88805f3c95f0 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff88805f3c95f0 (&sb->s_type->i_mutex_key#22){+.+.}-{3:3}, at: udf_file_write_iter+0x6e/0x620 fs/udf/file.c:95
#2: ffff88805f3c9408 (&ei->i_data_sem#2){++++}-{3:3}, at: udf_map_block+0x284/0x4500 fs/udf/inode.c:443
#3: ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_new_block fs/udf/balloc.c:598 [inline]
#3: ffff88807c326d28 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_new_block+0xea7/0x1a70 fs/udf/balloc.c:742

stack backtrace:
CPU: 0 PID: 5930 Comm: syz.3.12 Not tainted 6.6.94-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_deadlock kernel/locking/lockdep.c:3062 [inline]
validate_chain kernel/locking/lockdep.c:3856 [inline]
__lock_acquire+0x5d40/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
udf_table_free_blocks fs/udf/balloc.c:392 [inline]
udf_free_blocks+0x8ff/0x16e0 fs/udf/balloc.c:694
udf_delete_aext+0x4e0/0xbc0 fs/udf/inode.c:2373
udf_table_new_block fs/udf/balloc.c:662 [inline]
udf_new_block+0x12fa/0x1a70 fs/udf/balloc.c:742
inode_getblk fs/udf/inode.c:899 [inline]
udf_map_block+0x1389/0x4500 fs/udf/inode.c:451
__udf_get_block+0x53/0x250 fs/udf/inode.c:465
__block_write_begin_int+0x566/0x1ad0 fs/buffer.c:2124
__block_write_begin fs/buffer.c:2173 [inline]
block_write_begin+0x9a/0x1e0 fs/buffer.c:2234
udf_write_begin+0x1c0/0x430 fs/udf/inode.c:261
generic_perform_write+0x2fb/0x5b0 mm/filemap.c:4016
udf_file_write_iter+0x2c0/0x620 fs/udf/file.c:111
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
iter_file_splice_write+0x66f/0xc50 fs/splice.c:736
do_splice_from fs/splice.c:933 [inline]
direct_splice_actor+0xe8/0x130 fs/splice.c:1142
splice_direct_to_actor+0x2f0/0x870 fs/splice.c:1088
do_splice_direct+0x1b7/0x2c0 fs/splice.c:1194
do_sendfile+0x5dc/0xf70 fs/read_write.c:1254
__do_sys_sendfile64 fs/read_write.c:1322 [inline]
__se_sys_sendfile64+0x13f/0x190 fs/read_write.c:1308
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fe5f758e929
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:00007fe5f832c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fe5f77b5fa0 RCX: 00007fe5f758e929
RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000005
RBP: 00007fe5f7610b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0001000000201005 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe5f77b5fa0 R15: 00007ffd3ee4aaa8
</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,
Jun 22, 2025, 12:51:31 AM6/22/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 6282921b6825 Linux 6.6.94
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=131f4dd4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=96da6b2210cda427
dashboard link: https://syzkaller.appspot.com/bug?extid=96085947cb5d4acdaa1c
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=137cb30c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1407f30c580000
mounted in repro: https://storage.googleapis.com/syzbot-assets/9305065d9b97/mount_0.gz

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

============================================
WARNING: possible recursive locking detected
6.6.94-syzkaller #0 Not tainted
--------------------------------------------
syz-executor146/5792 is trying to acquire lock:
ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_free_blocks fs/udf/balloc.c:392 [inline]
ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_free_blocks+0x8ff/0x16e0 fs/udf/balloc.c:694

but task is already holding lock:
ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_prealloc_blocks fs/udf/balloc.c:533 [inline]
ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_prealloc_blocks+0x7c3/0xef0 fs/udf/balloc.c:718

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-executor146/5792:
#0: ffff88807b3e8418 (sb_writers#9){.+.+}-{0:0}, at: do_sendfile+0x5b9/0xf70 fs/read_write.c:1253
#1: ffff8880736b8f88 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
#1: ffff8880736b8f88 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: udf_file_write_iter+0x6e/0x620 fs/udf/file.c:95
#2: ffff8880736b8da0 (&ei->i_data_sem#2){++++}-{3:3}, at: udf_map_block+0x284/0x4500 fs/udf/inode.c:443
#3: ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_table_prealloc_blocks fs/udf/balloc.c:533 [inline]
#3: ffff88801db72528 (&sbi->s_alloc_mutex){+.+.}-{3:3}, at: udf_prealloc_blocks+0x7c3/0xef0 fs/udf/balloc.c:718

stack backtrace:
CPU: 0 PID: 5792 Comm: syz-executor146 Not tainted 6.6.94-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<TASK>
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
check_deadlock kernel/locking/lockdep.c:3062 [inline]
validate_chain kernel/locking/lockdep.c:3856 [inline]
__lock_acquire+0x5d40/0x7c80 kernel/locking/lockdep.c:5137
lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x129/0xcc0 kernel/locking/mutex.c:747
udf_table_free_blocks fs/udf/balloc.c:392 [inline]
udf_free_blocks+0x8ff/0x16e0 fs/udf/balloc.c:694
udf_delete_aext+0x4e0/0xbc0 fs/udf/inode.c:2373
udf_table_prealloc_blocks fs/udf/balloc.c:560 [inline]
udf_prealloc_blocks+0xa41/0xef0 fs/udf/balloc.c:718
udf_prealloc_extents fs/udf/inode.c:1057 [inline]
inode_getblk fs/udf/inode.c:915 [inline]
udf_map_block+0x1f44/0x4500 fs/udf/inode.c:451
__udf_get_block+0x53/0x250 fs/udf/inode.c:465
__block_write_begin_int+0x566/0x1ad0 fs/buffer.c:2124
__block_write_begin fs/buffer.c:2173 [inline]
block_write_begin+0x9a/0x1e0 fs/buffer.c:2234
udf_write_begin+0x1c0/0x430 fs/udf/inode.c:261
generic_perform_write+0x2fb/0x5b0 mm/filemap.c:4016
udf_file_write_iter+0x2c0/0x620 fs/udf/file.c:111
do_iter_readv_writev fs/read_write.c:-1 [inline]
do_iter_write+0x79a/0xc70 fs/read_write.c:860
iter_file_splice_write+0x66f/0xc50 fs/splice.c:736
do_splice_from fs/splice.c:933 [inline]
direct_splice_actor+0xe8/0x130 fs/splice.c:1142
splice_direct_to_actor+0x2f0/0x870 fs/splice.c:1088
do_splice_direct+0x1b7/0x2c0 fs/splice.c:1194
do_sendfile+0x5dc/0xf70 fs/read_write.c:1254
__do_sys_sendfile64 fs/read_write.c:1322 [inline]
__se_sys_sendfile64+0x13f/0x190 fs/read_write.c:1308
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fad0826c699
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 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:00007fad08207218 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fad082f56d8 RCX: 00007fad0826c699
RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000005
RBP: 00007fad082f56d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0001000000201005 R11: 0000000000000246 R12: 00007fad082c1d48
R13: 000000000000006e R14: 0031656c69662f2e R15: 00002000000013c0
</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