[v5.15] possible deadlock in __ocfs2_move_extents_range

5 views
Skip to first unread message

syzbot

unread,
Mar 11, 2025, 11:42:29 AM3/11/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c16c81c81336 Linux 5.15.178
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10cde7a8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d302c69e93fb6774
dashboard link: https://syzkaller.appspot.com/bug?extid=3ed15bdbe4f8bfda409a
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/267e46ee7273/disk-c16c81c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/944e289206cf/vmlinux-c16c81c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f8cadf62458e/bzImage-c16c81c8.xz

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

loop4: detected capacity change from 0 to 32768
ocfs2: Mounting device (7,4) on (node local, slot 0) with ordered data mode.
======================================================
WARNING: possible circular locking dependency detected
5.15.178-syzkaller #0 Not tainted
------------------------------------------------------
syz.4.30/4487 is trying to acquire lock:
ffff88805587df48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
ffff88805587df48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8){+.+.}-{3:3}, at: ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
ffff88805587df48 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8){+.+.}-{3:3}, at: __ocfs2_move_extents_range+0x1ecb/0x43f0 fs/ocfs2/move_extents.c:860

but task is already holding lock:
ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: ocfs2_move_extent fs/ocfs2/move_extents.c:632 [inline]
ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: __ocfs2_move_extents_range+0x1674/0x43f0 fs/ocfs2/move_extents.c:860

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:789 [inline]
__ocfs2_flush_truncate_log+0x36e/0x11c0 fs/ocfs2/alloc.c:6037
ocfs2_flush_truncate_log fs/ocfs2/alloc.c:6067 [inline]
ocfs2_try_to_free_truncate_log+0x1b3/0x410 fs/ocfs2/alloc.c:6126
ocfs2_reserve_clusters_with_limit+0x4e6/0xb50 fs/ocfs2/suballoc.c:1180
ocfs2_reserve_clusters fs/ocfs2/suballoc.c:1223 [inline]
ocfs2_lock_allocators+0x306/0x620 fs/ocfs2/suballoc.c:2669
ocfs2_write_begin_nolock+0x28e5/0x4d20 fs/ocfs2/aops.c:1741
ocfs2_write_begin+0x1fd/0x390 fs/ocfs2/aops.c:1905
generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785
__generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912
ocfs2_file_write_iter+0x1980/0x2120 fs/ocfs2/file.c:2472
call_write_iter include/linux/fs.h:2174 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacd/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:789 [inline]
ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
__ocfs2_move_extents_range+0x1ecb/0x43f0 fs/ocfs2/move_extents.c:860
ocfs2_move_extents+0x3ea/0xaa0 fs/ocfs2/move_extents.c:927
ocfs2_ioctl_move_extents+0x5d2/0x800 fs/ocfs2/move_extents.c:1053
ocfs2_ioctl+0x2eb/0x7d0 fs/ocfs2/ioctl.c:931
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#8);

*** DEADLOCK ***

5 locks held by syz.4.30/4487:
#0: ffff88806069c460 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x1f0 fs/namespace.c:421
#1: ffff888061412648 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
#1: ffff888061412648 (&sb->s_type->i_mutex_key#25){+.+.}-{3:3}, at: ocfs2_move_extents+0x1c1/0xaa0 fs/ocfs2/move_extents.c:905
#2: ffff8880614122e0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_move_extents+0x3c7/0xaa0 fs/ocfs2/move_extents.c:925
#3: ffff88805587a648 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
#3: ffff88805587a648 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{3:3}, at: ocfs2_reserve_suballoc_bits+0x18e/0x4c70 fs/ocfs2/suballoc.c:782
#4: ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
#4: ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: ocfs2_move_extent fs/ocfs2/move_extents.c:632 [inline]
#4: ffff8880558789c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#7){+.+.}-{3:3}, at: __ocfs2_move_extents_range+0x1674/0x43f0 fs/ocfs2/move_extents.c:860

stack backtrace:
CPU: 1 PID: 4487 Comm: syz.4.30 Not tainted 5.15.178-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_write+0x38/0x60 kernel/locking/rwsem.c:1551
inode_lock include/linux/fs.h:789 [inline]
ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
__ocfs2_move_extents_range+0x1ecb/0x43f0 fs/ocfs2/move_extents.c:860
ocfs2_move_extents+0x3ea/0xaa0 fs/ocfs2/move_extents.c:927
ocfs2_ioctl_move_extents+0x5d2/0x800 fs/ocfs2/move_extents.c:1053
ocfs2_ioctl+0x2eb/0x7d0 fs/ocfs2/ioctl.c:931
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f5e6e7fb169
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:00007f5e6c664038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f5e6ea13fa0 RCX: 00007f5e6e7fb169
RDX: 00004000000000c0 RSI: 0000000040406f06 RDI: 0000000000000004
RBP: 00007f5e6e87c2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f5e6ea13fa0 R15: 00007fff07157b88
</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,
Mar 14, 2025, 8:05:24 PM3/14/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 344a09659766 Linux 6.1.131
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14ee419b980000
kernel config: https://syzkaller.appspot.com/x/.config?x=14d5dbae75afa499
dashboard link: https://syzkaller.appspot.com/bug?extid=afc4f58a184a4dc71d3c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8c94453bbad3/disk-344a0965.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6bf26518c790/vmlinux-344a0965.xz
kernel image: https://storage.googleapis.com/syzbot-assets/424da9a470eb/Image-344a0965.gz.xz

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

======================================================
WARNING: possible circular locking dependency detected
6.1.131-syzkaller #0 Not tainted
------------------------------------------------------
syz.4.16/4517 is trying to acquire lock:
ffff0000e14bdf48
(
&ocfs2_sysfile_lock_key[args->fi_sysfile_type]
#6
){+.+.}-{3:3}
, at: inode_lock include/linux/fs.h:758 [inline]
, at: ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
, at: __ocfs2_move_extents_range+0x1860/0x365c fs/ocfs2/move_extents.c:860

but task is already holding lock:
ffff0000e14b89c8
(
&ocfs2_sysfile_lock_key[args->fi_sysfile_type]
#5
){+.+.}-{3:3}
, at: inode_lock include/linux/fs.h:758 [inline]
, at: ocfs2_move_extent fs/ocfs2/move_extents.c:632 [inline]
, at: __ocfs2_move_extents_range+0x1178/0x365c fs/ocfs2/move_extents.c:860

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}:
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:758 [inline]
__ocfs2_flush_truncate_log+0x310/0x1260 fs/ocfs2/alloc.c:6039
ocfs2_flush_truncate_log+0x4c/0x6c fs/ocfs2/alloc.c:6069
ocfs2_sync_fs+0x110/0x31c fs/ocfs2/super.c:402
sync_filesystem+0x1a0/0x218 fs/sync.c:66
generic_shutdown_super+0x70/0x328 fs/super.c:474
kill_block_super+0x70/0xdc fs/super.c:1470
deactivate_locked_super+0xac/0x124 fs/super.c:332
deactivate_super+0xf0/0x110 fs/super.c:363
cleanup_mnt+0x394/0x41c fs/namespace.c:1186
__cleanup_mnt+0x20/0x30 fs/namespace.c:1193
task_work_run+0x240/0x2f0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
do_notify_resume+0x2080/0x2cb8 arch/arm64/kernel/signal.c:1132
prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #0 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:758 [inline]
ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
__ocfs2_move_extents_range+0x1860/0x365c fs/ocfs2/move_extents.c:860
ocfs2_move_extents+0x388/0x908 fs/ocfs2/move_extents.c:927
ocfs2_ioctl_move_extents+0x634/0x8c4 fs/ocfs2/move_extents.c:1053
ocfs2_ioctl+0x2e0/0xd08 fs/ocfs2/ioctl.c:930
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5);
lock(&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#6);

*** DEADLOCK ***

5 locks held by syz.4.16/4517:
#0: ffff0000dc558460 (sb_writers#14){.+.+}-{0:0}, at: mnt_want_write_file+0x64/0x1e8 fs/namespace.c:437
#1: ffff0000e14bed88 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#1: ffff0000e14bed88 (&sb->s_type->i_mutex_key#20){+.+.}-{3:3}, at: ocfs2_move_extents+0x19c/0x908 fs/ocfs2/move_extents.c:905
#2: ffff0000e14bea20 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_move_extents+0x368/0x908 fs/ocfs2/move_extents.c:925
#3: ffff0000e14ba648 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#3: ffff0000e14ba648 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#3){+.+.}-{3:3}, at: ocfs2_reserve_suballoc_bits+0x164/0x4428 fs/ocfs2/suballoc.c:782
#4: ffff0000e14b89c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:758 [inline]
#4: ffff0000e14b89c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}, at: ocfs2_move_extent fs/ocfs2/move_extents.c:632 [inline]
#4: ffff0000e14b89c8 (&ocfs2_sysfile_lock_key[args->fi_sysfile_type]#5){+.+.}-{3:3}, at: __ocfs2_move_extents_range+0x1178/0x365c fs/ocfs2/move_extents.c:860

stack backtrace:
CPU: 1 PID: 4517 Comm: syz.4.16 Not tainted 6.1.131-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write+0x5c/0x88 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:758 [inline]
ocfs2_move_extent fs/ocfs2/move_extents.c:640 [inline]
__ocfs2_move_extents_range+0x1860/0x365c fs/ocfs2/move_extents.c:860
ocfs2_move_extents+0x388/0x908 fs/ocfs2/move_extents.c:927
ocfs2_ioctl_move_extents+0x634/0x8c4 fs/ocfs2/move_extents.c:1053
ocfs2_ioctl+0x2e0/0xd08 fs/ocfs2/ioctl.c:930
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
Reply all
Reply to author
Forward
0 new messages