[syzbot] [jfs?] UBSAN: array-index-out-of-bounds in dbAllocAG

1 view
Skip to first unread message

syzbot

unread,
Apr 23, 2025, 11:21:31 PMApr 23
Hello,

syzbot found the following issue on:

HEAD commit: 8560697b23dc Merge tag '6.15-rc2-smb3-client-fixes' of git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=133fbbac580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2a31f7155996562
dashboard link: https://syzkaller.appspot.com/bug?extid=cffd18309153948f3c3e
compiler: Debian clang version 15.0.6, Debian LLD 15.0.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14708c70580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=115dd204580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-8560697b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2acea3e6b668/vmlinux-8560697b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d2542a0d2bcd/bzImage-8560697b.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/2b4250dbd0ba/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=10708c70580000)

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
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:1397:14
index 65877 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 UID: 0 PID: 5308 Comm: syz-executor181 Not tainted 6.15.0-rc2-syzkaller-00404-g8560697b23dc #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
ubsan_epilogue lib/ubsan.c:231 [inline]
__ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:453
dbAllocAG+0x704/0x1130 fs/jfs/jfs_dmap.c:1397
dbAlloc+0x65c/0xcb0 fs/jfs/jfs_dmap.c:873
xtSplitUp+0x554/0x21c0 fs/jfs/jfs_xtree.c:745
xtInsert+0x5ba/0x11a0 fs/jfs/jfs_xtree.c:593
extAlloc+0xae7/0x10a0 fs/jfs/jfs_extent.c:150
jfs_get_block+0x41d/0xe60 fs/jfs/inode.c:248
get_more_blocks fs/direct-io.c:648 [inline]
do_direct_IO fs/direct-io.c:936 [inline]
__blockdev_direct_IO+0x1add/0x4540 fs/direct-io.c:1243
blockdev_direct_IO include/linux/fs.h:3422 [inline]
jfs_direct_IO+0xf7/0x1e0 fs/jfs/inode.c:331
generic_file_direct_write+0x1e8/0x400 mm/filemap.c:4037
__generic_file_write_iter+0x126/0x230 mm/filemap.c:4206
generic_file_write_iter+0x10e/0x5e0 mm/filemap.c:4246
new_sync_write fs/read_write.c:591 [inline]
vfs_write+0x70f/0xd10 fs/read_write.c:684
ksys_write+0x19d/0x2d0 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xf3/0x210 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f2346650b59
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffd3c588a8 EFLAGS: 00000206 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0073746e6576652e RCX: 00007f2346650b59
RDX: 00000000fffffdaf RSI: 0000200000000000 RDI: 0000000000000005
RBP: 652e79726f6d656d R08: 00005555682c24c0 R09: 00005555682c24c0
R10: 00005555682c24c0 R11: 0000000000000206 R12: 00007fffd3c588d0
R13: 00007fffd3c58af8 R14: 431bde82d7b634db R15: 00007f234669903b
</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 syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

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

Arnaud Lecomte

unread,
Apr 24, 2025, 12:47:20 AMApr 24
#syz test

--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -1385,6 +1385,12 @@ dbAllocAG(struct bmap * bmp, int agno, s64 nblocks, int l2nb, s64 * results)
(1 << (L2LPERCTL - (bmp->db_agheight << 1))) / bmp->db_agwidth;
ti = bmp->db_agstart + bmp->db_agwidth * (agno & (agperlev - 1));

+ if (ti >= le32_to_cpu(dcp->nleafs)) {
+ jfs_error(bmp->db_ipbmap->i_sb, "Corrupt dmapctl page: ti out of bounds\n");
+ release_metapage(mp);
+ return -EIO;
+ }
+
/* dmap control page trees fan-out by 4 and a single allocation
* group may be described by 1 or 2 subtrees within the ag level
* dmap control page, depending upon the ag size. examine the ag's

syzbot

unread,
Apr 24, 2025, 1:10:05 AMApr 24
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: [email protected]
Tested-by: [email protected]

Tested on:

commit: a79be02b Fix mis-uses of 'cc-option' for warning disab..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=120ae574580000
kernel config: https://syzkaller.appspot.com/x/.config?x=45c3bf6fd4cb6a10
dashboard link: https://syzkaller.appspot.com/bug?extid=cffd18309153948f3c3e
compiler: Debian clang version 15.0.6, Debian LLD 15.0.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=1252e574580000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Apr 24, 2025, 11:59:22 AMApr 24
> #syz test

This crash does not have a reproducer. I cannot test it.

>
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -1182,6 +1182,8 @@ xfs_dialloc_ag_inobt(
> if (error)
> goto error1;
> } else {
> + pag->pagl_leftrec = NULLAGINO;
> + pag->pagl_rightrec = NULLAGINO;
> /* search left with tcur, back up 1 record */
> error = xfs_ialloc_next_rec(tcur, &trec, &doneleft, 1);
> if (error)
>
Reply all
Reply to author
Forward
0 new messages