[v6.1] UBSAN: array-index-out-of-bounds in dbAdjTree

0 views
Skip to first unread message

syzbot

unread,
Dec 9, 2024, 2:51:25 PM12/9/24
Hello,

syzbot found the following issue on:

HEAD commit: e4d90d63d385 Linux 6.1.119
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13b0a3e8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5516a02be29a5649
dashboard link: https://syzkaller.appspot.com/bug?extid=615942eeb2884c9896c4
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/19f991f20183/disk-e4d90d63.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/61eb5f055f38/vmlinux-e4d90d63.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0ddd97416681/bzImage-e4d90d63.xz

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

================================================================================
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2902:18
index -3 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 PID: 5931 Comm: syz.4.200 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x118/0x140 lib/ubsan.c:282
dbAdjTree+0x377/0x520 fs/jfs/jfs_dmap.c:2902
dbAllocBits+0x4e5/0x9a0 fs/jfs/jfs_dmap.c:2193
dbAllocDmap+0x6d/0x150 fs/jfs/jfs_dmap.c:2034
dbAlloc+0x505/0xc90 fs/jfs/jfs_dmap.c:816
extBalloc fs/jfs/jfs_extent.c:326 [inline]
extAlloc+0x4f4/0x1000 fs/jfs/jfs_extent.c:122
jfs_get_block+0x417/0xe50 fs/jfs/inode.c:248
__block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x98/0x1f0 fs/buffer.c:2102
jfs_write_begin+0x2d/0x60 fs/jfs/inode.c:304
generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3845
__generic_file_write_iter+0x176/0x400 mm/filemap.c:3973
generic_file_write_iter+0xab/0x310 mm/filemap.c:4005
__kernel_write_iter+0x2ff/0x710 fs/read_write.c:517
dump_emit_page fs/coredump.c:881 [inline]
dump_user_range+0x43d/0x8e0 fs/coredump.c:908
elf_core_dump+0x3d2b/0x4590 fs/binfmt_elf.c:2313
do_coredump+0x18b7/0x2700 fs/coredump.c:755
get_signal+0x1454/0x17d0 kernel/signal.c:2857
arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871
exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:316
exc_page_fault+0x1c0/0x620 arch/x86/mm/fault.c:1490
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608
RIP: 0033:0x7fe98bf7fee1
Code: 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 83 c8 ff c3 66 2e 0f 1f
RSP: 002b:00000000fffffe10 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fe98c145fa0 RCX: 00007fe98bf7fed9
RDX: 0000000000000000 RSI: 00000000fffffe10 RDI: 0000000000000000
RBP: 00007fe98bff3cc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe98c145fa0 R15: 00007fffaa6d01e8
</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 [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

syzbot

unread,
Dec 10, 2024, 2:28:24 AM12/10/24
syzbot has found a reproducer for the following issue on:

HEAD commit: e4d90d63d385 Linux 6.1.119
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10ec93e8580000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12c8a8f8580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11acd4df980000
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/895a1a868d0d/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/6af5a56f220d/mount_3.gz

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
================================================================================
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2902:18
index -3 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 1 PID: 4246 Comm: syz-executor465 Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x118/0x140 lib/ubsan.c:282
dbAdjTree+0x377/0x520 fs/jfs/jfs_dmap.c:2902
dbAllocBits+0x4e5/0x9a0 fs/jfs/jfs_dmap.c:2193
dbAllocDmap+0x6d/0x150 fs/jfs/jfs_dmap.c:2034
dbAlloc+0x505/0xc90 fs/jfs/jfs_dmap.c:816
extBalloc fs/jfs/jfs_extent.c:326 [inline]
extAlloc+0x4f4/0x1000 fs/jfs/jfs_extent.c:122
jfs_get_block+0x417/0xe50 fs/jfs/inode.c:248
__block_write_begin_int+0x544/0x1a30 fs/buffer.c:1991
__block_write_begin fs/buffer.c:2041 [inline]
block_write_begin+0x98/0x1f0 fs/buffer.c:2102
jfs_write_begin+0x2d/0x60 fs/jfs/inode.c:304
generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3845
__generic_file_write_iter+0x176/0x400 mm/filemap.c:3973
generic_file_write_iter+0xab/0x310 mm/filemap.c:4005
call_write_iter include/linux/fs.h:2265 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x857/0xbc0 fs/read_write.c:584
ksys_write+0x19c/0x2c0 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f1b721cf9f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 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:00007ffd1f697cb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007ffd1f697e88 RCX: 00007f1b721cf9f9
RDX: 00000000fffffcf8 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 00007f1b72252610 R08: 000000002001a240 R09: 00007ffd1f697e88
R10: 0000000000000073 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffd1f697e78 R14: 0000000000000001 R15: 0000000000000001
</TASK>
================================================================================


---
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.

syzbot

unread,
Jan 19, 2025, 9:39:06 AMJan 19
syzbot suspects this issue could be fixed by backporting the following commit:

commit a174706ba4dad895c40b1d2277bade16dfacdcd9
git tree: upstream
Author: Nihar Chaithanya <[email protected]>
Date: Tue Oct 8 20:21:38 2024 +0000

jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=109599df980000
Please keep in mind that other backports might be required as well.

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Jan 21, 2025, 12:10:04 PMJan 21
The commit that was suspected to fix the issue was backported to the fuzzed
kernel trees.

commit 491487eeddccc4bb49f2e59d8c8f35bec89c15ca
Author: <[email protected]>
Date: Tue Oct 8 20:21:38 2024 +0000

jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree

If you believe this is correct, please reply with
#syz fix: jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree

The commit was initially detected here:

commit a174706ba4dad895c40b1d2277bade16dfacdcd9
git tree: upstream
Author: Nihar Chaithanya <[email protected]>
Date: Tue Oct 8 20:21:38 2024 +0000

jfs: add a check to prevent array-index-out-of-bounds in dbAdjTree

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=109599df980000
Reply all
Reply to author
Forward
0 new messages