[syzbot] [ocfs2?] UBSAN: array-index-out-of-bounds in ocfs2_grow_tree (2)

syzbot <[email protected]>
Newsgroups dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hello,

syzbot found the following issue on:

HEAD commit:    faeab166167f Merge tag 'pinctrl-v7.1-1' of git://git.kerne..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1765ffca580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d120b114be21f79
dashboard link: https://syzkaller.appspot.com/bug?extid=be16e33db01e6644db7a
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

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

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-faeab166.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/756ff8e81a3b/vmlinux-faeab166.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3c4cb66569b5/bzImage-faeab166.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

loop0: detected capacity change from 0 to 32768
=======================================================
WARNING: The mand mount option has been deprecated and
         and is ignored by this kernel. Remove the mand
         option from the mount to silence this warning.
=======================================================
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
(syz.0.0,5330,0):ocfs2_check_set_options:1244 ERROR: Invalid heartbeat mount options
loop0: detected capacity change from 32768 to 32767
(syz.0.0,5330,0):ocfs2_validate_inode_block:1449 ERROR: Invalid dinode #17058: Corrupt state (nlink = 0 or mode = 0) detected!
(syz.0.0,5330,0):ocfs2_assign_bh:2417 ERROR: status = -117
(syz.0.0,5330,0):ocfs2_inode_lock_full_nested:2512 ERROR: status = -117
(syz.0.0,5330,0):ocfs2_reflink_inodes_lock:4747 ERROR: status = -117
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in fs/ocfs2/alloc.c:1112:9
index -1 is out of range for type 'struct ocfs2_extent_rec[] __counted_by(l_count)' (aka 'struct ocfs2_extent_rec[]')
CPU: 0 UID: 0 PID: 5330 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:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233
 __ubsan_handle_out_of_bounds+0xe8/0xf0 lib/ubsan.c:455
 ocfs2_sum_rightmost_rec fs/ocfs2/alloc.c:1112 [inline]
 ocfs2_shift_tree_depth fs/ocfs2/alloc.c:1433 [inline]
 ocfs2_grow_tree+0x37fc/0x4060 fs/ocfs2/alloc.c:1581
 ocfs2_insert_extent+0xc67/0x1700 fs/ocfs2/alloc.c:4764
 ocfs2_add_clusters_in_btree+0x678/0xff0 fs/ocfs2/alloc.c:4866
 ocfs2_add_inode_data+0xe7/0x140 fs/ocfs2/file.c:551
 ocfs2_write_cluster fs/ocfs2/aops.c:1117 [inline]
 ocfs2_write_cluster_by_desc+0x566/0x1de0 fs/ocfs2/aops.c:1221
 ocfs2_write_begin_nolock+0x3305/0x41a0 fs/ocfs2/aops.c:1797
 ocfs2_write_begin+0x1c5/0x320 fs/ocfs2/aops.c:1885
 generic_perform_write+0x2e2/0x8f0 mm/filemap.c:4324
 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
 vfs_copy_file_range+0xb02/0x1370 fs/read_write.c:1634
 __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/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5a2459c819
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:00007f5a25523fe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000146
RAX: ffffffffffffffda RBX: 00007f5a24815fa0 RCX: 00007f5a2459c819
RDX: 0000000000000004 RSI: 00002000000001c0 RDI: 0000000000000005
RBP: 00007f5a24632c91 R08: ffffffffa003e45b R09: 0700000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5a24816038 R14: 00007f5a24815fa0 R15: 00007ffc179ae578
 </TASK>
---[ end trace ]---


---
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 [email protected].

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.