======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.0/5320 is trying to acquire lock:
ffff88801fdc6890 (&new->rf_sem){+.+.}-{4:4}, at: __ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ffff88801fdc6890 (&new->rf_sem){+.+.}-{4:4}, at: ocfs2_lock_refcount_tree+0x1b7/0xa40 fs/ocfs2/refcounttree.c:463
but task is already holding lock:
ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1029 [inline]
ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_wipe_inode fs/ocfs2/inode.c:854 [inline]
ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_delete_inode fs/ocfs2/inode.c:1157 [inline]
ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_evict_inode+0xe97/0x43b0 fs/ocfs2/inode.c:1299
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}:
down_write+0x96/0x200 kernel/locking/rwsem.c:1625
inode_lock include/linux/fs.h:1029 [inline]
ocfs2_del_inode_from_orphan+0x12e/0x7a0 fs/ocfs2/namei.c:2728
ocfs2_dio_end_io_write fs/ocfs2/aops.c:2379 [inline]
ocfs2_dio_end_io+0xf9c/0x1370 fs/ocfs2/aops.c:2418
dio_complete+0x25b/0x790 fs/direct-io.c:281
__blockdev_direct_IO+0x2e5d/0x34e0 fs/direct-io.c:1303
ocfs2_direct_IO+0x251/0x2c0 fs/ocfs2/aops.c:2455
generic_file_direct_write+0x1db/0x3e0 mm/filemap.c:4259
__generic_file_write_iter+0x11d/0x230 mm/filemap.c:4428
ocfs2_file_write_iter+0x1663/0x1e70 fs/ocfs2/file.c:2476
iter_file_splice_write+0x9a1/0x10f0 fs/splice.c:736
do_splice_from fs/splice.c:936 [inline]
direct_splice_actor+0x101/0x160 fs/splice.c:1159
splice_direct_to_actor+0x53a/0xc70 fs/splice.c:1103
do_splice_direct_actor fs/splice.c:1202 [inline]
do_splice_direct+0x195/0x290 fs/splice.c:1228
do_sendfile+0x535/0x7d0 fs/read_write.c:1372
__do_sys_sendfile64 fs/read_write.c:1433 [inline]
__se_sys_sendfile64+0x144/0x1a0 fs/read_write.c:1419
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0x560 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #1 (&ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE]){+.+.}-{4:4}:
down_write+0x96/0x200 kernel/locking/rwsem.c:1625
inode_lock include/linux/fs.h:1029 [inline]
ocfs2_reserve_suballoc_bits+0x16d/0x4840 fs/ocfs2/suballoc.c:882
ocfs2_reserve_new_metadata_blocks+0x415/0x9a0 fs/ocfs2/suballoc.c:1078
ocfs2_add_refcount_flag+0x372/0xe60 fs/ocfs2/refcounttree.c:3674
ocfs2_reflink_remap_extent fs/ocfs2/refcounttree.c:4554 [inline]
ocfs2_reflink_remap_blocks+0xbb2/0x1a30 fs/ocfs2/refcounttree.c:4681
ocfs2_remap_file_range+0x451/0x6f0 fs/ocfs2/file.c:2747
vfs_copy_file_range+0xd80/0x1370 fs/read_write.c:1600
__do_sys_copy_file_range fs/read_write.c:1683 [inline]
__se_sys_copy_file_range+0x2fb/0x480 fs/read_write.c:1650
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x15f/0x560 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&new->rf_sem){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
down_write+0x96/0x200 kernel/locking/rwsem.c:1625
__ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ocfs2_lock_refcount_tree+0x1b7/0xa40 fs/ocfs2/refcounttree.c:463
ocfs2_commit_truncate+0xb64/0x2310 fs/ocfs2/alloc.c:7375
ocfs2_truncate_for_delete fs/ocfs2/inode.c:701 [inline]
ocfs2_wipe_inode fs/ocfs2/inode.c:868 [inline]
ocfs2_delete_inode fs/ocfs2/inode.c:1157 [inline]
ocfs2_evict_inode+0x1023/0x43b0 fs/ocfs2/inode.c:1299
evict+0x61e/0xb10 fs/inode.c:841
ocfs2_dentry_iput+0x24d/0x390 fs/ocfs2/dcache.c:407
__dentry_kill+0x1a2/0x690 fs/dcache.c:718
finish_dput+0xc9/0x480 fs/dcache.c:927
__fput+0x691/0xa60 fs/file_table.c:518
task_work_run+0x1d9/0x270 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0xf3/0x4d0 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
do_syscall_64+0x33e/0x560 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
other info that might help us debug this:
Chain exists of:
&new->rf_sem --> &ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE] --> &ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]);
lock(&ocfs2_sysfile_lock_key[EXTENT_ALLOC_SYSTEM_INODE]);
lock(&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]);
lock(&new->rf_sem);
*** DEADLOCK ***
2 locks held by syz.0.0/5320:
#0: ffff88804212cbc0 (&osb->nfs_sync_rwlock){.+.+}-{4:4}, at: ocfs2_nfs_sync_lock+0x106/0x270 fs/ocfs2/dlmglue.c:2875
#1: ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:1029 [inline]
#1: ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_wipe_inode fs/ocfs2/inode.c:854 [inline]
#1: ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_delete_inode fs/ocfs2/inode.c:1157 [inline]
#1: ffff8880470d4fa0 (&ocfs2_sysfile_lock_key[ORPHAN_DIR_SYSTEM_INODE]){+.+.}-{4:4}, at: ocfs2_evict_inode+0xe97/0x43b0 fs/ocfs2/inode.c:1299
stack backtrace:
CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_circular_bug+0x2e1/0x300 kernel/locking/lockdep.c:2043
check_noncircular+0x12e/0x150 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain kernel/locking/lockdep.c:3908 [inline]
__lock_acquire+0x15a5/0x2cf0 kernel/locking/lockdep.c:5237
lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
down_write+0x96/0x200 kernel/locking/rwsem.c:1625
__ocfs2_lock_refcount_tree fs/ocfs2/refcounttree.c:428 [inline]
ocfs2_lock_refcount_tree+0x1b7/0xa40 fs/ocfs2/refcounttree.c:463
ocfs2_commit_truncate+0xb64/0x2310 fs/ocfs2/alloc.c:7375
ocfs2_truncate_for_delete fs/ocfs2/inode.c:701 [inline]
ocfs2_wipe_inode fs/ocfs2/inode.c:868 [inline]
ocfs2_delete_inode fs/ocfs2/inode.c:1157 [inline]
ocfs2_evict_inode+0x1023/0x43b0 fs/ocfs2/inode.c:1299
evict+0x61e/0xb10 fs/inode.c:841
ocfs2_dentry_iput+0x24d/0x390 fs/ocfs2/dcache.c:407
__dentry_kill+0x1a2/0x690 fs/dcache.c:718
finish_dput+0xc9/0x480 fs/dcache.c:927
__fput+0x691/0xa60 fs/file_table.c:518
task_work_run+0x1d9/0x270 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0xf3/0x4d0 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
do_syscall_64+0x33e/0x560 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5baed9ce59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc06a9f748 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007ffc06a9f830 RCX: 00007f5baed9ce59
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 0000000000014b09 R08: 0000000000000001 R09: 0000000000000000
R10: 00007f5baebff02c R11: 0000000000000246 R12: 00007ffc06a9f870
R13: 00007f5baf015fac R14: 0000000000015346 R15: 00007f5baf015fa0
------------[ cut here ]------------
memset: detected buffer overflow: 384 byte write of buffer size 16
WARNING: lib/string_helpers.c:1037 at __fortify_report+0x6b/0xa0 lib/string_helpers.c:1036, CPU#0: syz.0.0/5320
Modules linked in:
CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__fortify_report+0x89/0xa0 lib/string_helpers.c:1036
Code: e8 8c 26 7e fd 48 8d 3d 35 75 87 0b 45 84 e4 49 8b 37 48 c7 c0 c0 17 28 8c 48 c7 c1 e0 17 28 8c 48 0f 44 c8 4c 89 f2 49 89 d8 <67> 48 0f b9 3a 5b 41 5c 41 5e 41 5f 5d c3 cc cc cc cc cc cc cc cc
RSP: 0018:ffffc90007646848 EFLAGS: 00010202
RAX: ffffffff8c2817c0 RBX: 0000000000000010 RCX: ffffffff8c2817e0
RDX: 0000000000000180 RSI: ffffffff8c281680 RDI: ffffffff903be6f0
RBP: 000000000000000f R08: 0000000000000010 R09: 1ffffffff2061ffe
R10: dffffc0000000000 R11: fffffbfff2061fff R12: 0000000000000001
R13: 1ffff1100ae6bd50 R14: 0000000000000180 R15: ffffffff8c2814b8
FS: 0000555589cd8540(0000) GS:ffff88808c87b000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5ba33ff000 CR3: 000000004063a000 CR4: 0000000000352ef0
Call Trace:
__fortify_panic+0x9/0x10 lib/string_helpers.c:1043
fortify_memset_chk include/linux/fortify-string.h:495 [inline]
ocfs2_remove_refcount_extent fs/ocfs2/refcounttree.c:2134 [inline]
ocfs2_decrease_refcount_rec fs/ocfs2/refcounttree.c:2203 [inline]
__ocfs2_decrease_refcount+0x1990/0x19e0 fs/ocfs2/refcounttree.c:2249
ocfs2_decrease_refcount+0x59c/0x7d0 fs/ocfs2/refcounttree.c:2312
ocfs2_remove_btree_range+0x125b/0x1610 fs/ocfs2/alloc.c:5800
ocfs2_commit_truncate+0xbb8/0x2310 fs/ocfs2/alloc.c:7383
ocfs2_truncate_for_delete fs/ocfs2/inode.c:701 [inline]
ocfs2_wipe_inode fs/ocfs2/inode.c:868 [inline]
ocfs2_delete_inode fs/ocfs2/inode.c:1157 [inline]
ocfs2_evict_inode+0x1023/0x43b0 fs/ocfs2/inode.c:1299
evict+0x61e/0xb10 fs/inode.c:841
ocfs2_dentry_iput+0x24d/0x390 fs/ocfs2/dcache.c:407
__dentry_kill+0x1a2/0x690 fs/dcache.c:718
finish_dput+0xc9/0x480 fs/dcache.c:927
__fput+0x691/0xa60 fs/file_table.c:518
task_work_run+0x1d9/0x270 kernel/task_work.c:233
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
__exit_to_user_mode_loop kernel/entry/common.c:67 [inline]
exit_to_user_mode_loop+0xf3/0x4d0 kernel/entry/common.c:98
__exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline]
syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline]
do_syscall_64+0x33e/0x560 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5baed9ce59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc06a9f748 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007ffc06a9f830 RCX: 00007f5baed9ce59
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 0000000000014b09 R08: 0000000000000001 R09: 0000000000000000
R10: 00007f5baebff02c R11: 0000000000000246 R12: 00007ffc06a9f870
R13: 00007f5baf015fac R14: 0000000000015346 R15: 00007f5baf015fa0
----------------
Code disassembly (best guess):
0: e8 8c 26 7e fd call 0xfd7e2691
5: 48 8d 3d 35 75 87 0b lea 0xb877535(%rip),%rdi # 0xb877541
c: 45 84 e4 test %r12b,%r12b
f: 49 8b 37 mov (%r15),%rsi
12: 48 c7 c0 c0 17 28 8c mov $0xffffffff8c2817c0,%rax
19: 48 c7 c1 e0 17 28 8c mov $0xffffffff8c2817e0,%rcx
20: 48 0f 44 c8 cmove %rax,%rcx
24: 4c 89 f2 mov %r14,%rdx
27: 49 89 d8 mov %rbx,%r8
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: 5b pop %rbx
30: 41 5c pop %r12
32: 41 5e pop %r14
34: 41 5f pop %r15
36: 5d pop %rbp
37: c3 ret
38: cc int3
39: cc int3
3a: cc int3
3b: cc int3
3c: cc int3
3d: cc int3
3e: cc int3
3f: cc int3