syzbot


possible deadlock in udf_free_blocks

Status: upstream: reported C repro on 2024/12/03 09:21
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+29718837e662d73e2719@syzkaller.appspotmail.com
First crash: 18d, last: 17d
Bug presence (1)
Date Name Commit Repro Result
2024/12/04 upstream (ToT) feffde684ac2 C [report] possible deadlock in udf_free_blocks
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in udf_free_blocks udf C done 67 21h18m 47d 0/28 upstream: reported C repro on 2024/11/04 17:57

Sample crash report:
=======================================================
============================================
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
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: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>

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/04 11:29 linux-6.1.y e4d90d63d385 b50eb251 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in udf_free_blocks
2024/12/04 04:27 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in udf_free_blocks
2024/12/03 09:20 linux-6.1.y e4d90d63d385 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in udf_free_blocks
* Struck through repros no longer work on HEAD.