[v5.15] possible deadlock in __ocfs2_write_remove_suid

0 views
Skip to first unread message

syzbot

unread,
Oct 13, 2025, 11:29:32 AM (3 days ago) Oct 13
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 29e53a5b1c4f Linux 5.15.194
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=11b999e2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=baf61a8eca78f35c11be
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8cd4e3ff852c/disk-29e53a5b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/21e1f773622c/vmlinux-29e53a5b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8f418c0a25cc/bzImage-29e53a5b.xz

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

loop3: detected capacity change from 0 to 32768
ocfs2: Mounting device (7,3) on (node local, slot 0) with writeback data mode.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.3.169/4841 is trying to acquire lock:
ffff88807a9c4650 (sb_internal#5){.+.+}-{0:0}, at: __ocfs2_write_remove_suid+0x1a0/0x760 fs/ocfs2/file.c:1388

but task is already holding lock:
ffff88805f20dbe0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_inode_lock_for_extent_tree+0xd6/0x190 fs/ocfs2/file.c:2213

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&oi->ip_alloc_sem){++++}-{3:3}:
down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
ocfs2_read_virt_blocks+0x23f/0x8a0 fs/ocfs2/extent_map.c:984
ocfs2_read_dir_block fs/ocfs2/dir.c:508 [inline]
ocfs2_find_entry_el fs/ocfs2/dir.c:715 [inline]
ocfs2_find_entry+0x3d1/0x1f90 fs/ocfs2/dir.c:1091
ocfs2_rename+0x1d36/0x3690 fs/ocfs2/namei.c:1568
vfs_rename+0xbbf/0x10d0 fs/namei.c:4832
do_renameat2+0xa83/0xf70 fs/namei.c:4985
__do_sys_renameat2 fs/namei.c:5018 [inline]
__se_sys_renameat2 fs/namei.c:5015 [inline]
__x64_sys_renameat2+0xce/0xe0 fs/namei.c:5015
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (jbd2_handle){++++}-{0:0}:
start_this_handle+0x1338/0x15a0 fs/jbd2/transaction.c:464
jbd2__journal_start+0x2b7/0x5a0 fs/jbd2/transaction.c:521
jbd2_journal_start+0x26/0x30 fs/jbd2/transaction.c:560
ocfs2_start_trans+0x374/0x6c0 fs/ocfs2/journal.c:376
ocfs2_shutdown_local_alloc+0x1fd/0xa10 fs/ocfs2/localalloc.c:416
ocfs2_dismount_volume+0x1de/0x880 fs/ocfs2/super.c:1885
generic_shutdown_super+0x130/0x300 fs/super.c:475
kill_block_super+0x7c/0xe0 fs/super.c:1427
deactivate_locked_super+0x93/0xf0 fs/super.c:335
cleanup_mnt+0x418/0x4d0 fs/namespace.c:1139
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&journal->j_trans_barrier){.+.+}-{3:3}:
down_read+0x44/0x2e0 kernel/locking/rwsem.c:1498
ocfs2_start_trans+0x368/0x6c0 fs/ocfs2/journal.c:374
ocfs2_shutdown_local_alloc+0x1fd/0xa10 fs/ocfs2/localalloc.c:416
ocfs2_dismount_volume+0x1de/0x880 fs/ocfs2/super.c:1885
generic_shutdown_super+0x130/0x300 fs/super.c:475
kill_block_super+0x7c/0xe0 fs/super.c:1427
deactivate_locked_super+0x93/0xf0 fs/super.c:335
cleanup_mnt+0x418/0x4d0 fs/namespace.c:1139
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (sb_internal#5){.+.+}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1811 [inline]
sb_start_intwrite include/linux/fs.h:1928 [inline]
ocfs2_start_trans+0x269/0x6c0 fs/ocfs2/journal.c:372
__ocfs2_write_remove_suid+0x1a0/0x760 fs/ocfs2/file.c:1388
ocfs2_write_remove_suid fs/ocfs2/file.c:1429 [inline]
ocfs2_prepare_inode_for_write fs/ocfs2/file.c:2314 [inline]
ocfs2_file_write_iter+0x963/0x1cf0 fs/ocfs2/file.c:2454
call_write_iter include/linux/fs.h:2172 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
sb_internal#5 --> jbd2_handle --> &oi->ip_alloc_sem

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&oi->ip_alloc_sem);
lock(jbd2_handle);
lock(&oi->ip_alloc_sem);
lock(sb_internal#5);

*** DEADLOCK ***

4 locks held by syz.3.169/4841:
#0: ffff88802a2e9c70 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2bf/0x370 fs/file.c:1056
#1: ffff88807a9c4460 (sb_writers#28){.+.+}-{0:0}, at: vfs_write+0x28a/0xd00 fs/read_write.c:590
#2: ffff88805f20df48 (&sb->s_type->i_mutex_key#43){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#2: ffff88805f20df48 (&sb->s_type->i_mutex_key#43){+.+.}-{3:3}, at: ocfs2_file_write_iter+0x401/0x1cf0 fs/ocfs2/file.c:2402
#3: ffff88805f20dbe0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_inode_lock_for_extent_tree+0xd6/0x190 fs/ocfs2/file.c:2213

stack backtrace:
CPU: 1 PID: 4841 Comm: syz.3.169 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012
lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1811 [inline]
sb_start_intwrite include/linux/fs.h:1928 [inline]
ocfs2_start_trans+0x269/0x6c0 fs/ocfs2/journal.c:372
__ocfs2_write_remove_suid+0x1a0/0x760 fs/ocfs2/file.c:1388
ocfs2_write_remove_suid fs/ocfs2/file.c:1429 [inline]
ocfs2_prepare_inode_for_write fs/ocfs2/file.c:2314 [inline]
ocfs2_file_write_iter+0x963/0x1cf0 fs/ocfs2/file.c:2454
call_write_iter include/linux/fs.h:2172 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x712/0xd00 fs/read_write.c:594
ksys_write+0x14d/0x250 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f67675dbec9
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:00007f6765843038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f6767832fa0 RCX: 00007f67675dbec9
RDX: 0000000000000009 RSI: 0000200000000140 RDI: 0000000000000004
RBP: 00007f676765ef91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f6767833038 R14: 00007f6767832fa0 R15: 00007ffe1944e5d8
</TASK>
syz.3.169 (4841) used greatest stack depth: 20840 bytes left


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