[v5.15] UBSAN: array-index-out-of-bounds in xfs_btree_lookup_get_block

2 views
Skip to first unread message

syzbot

unread,
May 21, 2023, 9:02:51 AM5/21/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9d6bde853685 Linux 5.15.112
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=128b17d6280000
kernel config: https://syzkaller.appspot.com/x/.config?x=508f7a387ef8f82b
dashboard link: https://syzkaller.appspot.com/bug?extid=0855e3dcfde89f750ed7
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=100083ee280000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=117871d9280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a8ab2bd416bb/disk-9d6bde85.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c358e3d58bb2/vmlinux-9d6bde85.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c82319bbaeb8/Image-9d6bde85.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/321a862bfa3c/mount_0.gz

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

XFS (loop0): Torn write (CRC failure) detected at log block 0x180. Truncating head block from 0x200.
XFS (loop0): Starting recovery (logdev: internal)
================================================================================
UBSAN: array-index-out-of-bounds in fs/xfs/libxfs/xfs_btree.c:1816:7
index 12 is out of range for type 'struct xfs_buf *[9]'
CPU: 1 PID: 3961 Comm: syz-executor145 Not tainted 5.15.112-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__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
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x108/0x15c lib/ubsan.c:282
xfs_btree_lookup_get_block+0x604/0x674 fs/xfs/libxfs/xfs_btree.c:1816
xfs_btree_lookup+0x378/0x1258 fs/xfs/libxfs/xfs_btree.c:1916
xfs_btree_simple_query_range+0xd4/0x5cc fs/xfs/libxfs/xfs_btree.c:4657
xfs_btree_query_range+0x2b4/0x348 fs/xfs/libxfs/xfs_btree.c:4893
xfs_refcount_recover_cow_leftovers+0x2bc/0xb2c fs/xfs/libxfs/xfs_refcount.c:1720
xfs_reflink_recover_cow+0x88/0x190 fs/xfs/xfs_reflink.c:769
xlog_recover_finish+0x134/0x1e4 fs/xfs/xfs_log_recover.c:3513
xfs_log_mount_finish+0x13c/0x434 fs/xfs/xfs_log.c:803
xfs_mountfs+0xecc/0x1778 fs/xfs/xfs_mount.c:878
xfs_fs_fill_super+0xd64/0xf60 fs/xfs/xfs_super.c:1658
get_tree_bdev+0x360/0x54c fs/super.c:1303
xfs_fs_get_tree+0x28/0x38 fs/xfs/xfs_super.c:1705
vfs_get_tree+0x90/0x274 fs/super.c:1508
do_new_mount+0x25c/0x8c8 fs/namespace.c:2994
path_mount+0x590/0x104c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
================================================================================
XFS (loop0): Metadata corruption detected at xfs_btree_lookup_get_block+0x430/0x674 fs/xfs/libxfs/xfs_btree.c:1849, xfs_refcountbt block 0x18
XFS (loop0): Unmount and run xfs_repair
================================================================================
UBSAN: array-index-out-of-bounds in fs/xfs/libxfs/xfs_btree.c:442:7
index 9 is out of range for type 'struct xfs_buf *[9]'
CPU: 1 PID: 3961 Comm: syz-executor145 Not tainted 5.15.112-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__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
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x108/0x15c lib/ubsan.c:282
xfs_btree_del_cursor+0x150/0x2dc fs/xfs/libxfs/xfs_btree.c:442
xfs_refcount_recover_cow_leftovers+0x2cc/0xb2c fs/xfs/libxfs/xfs_refcount.c:1722
xfs_reflink_recover_cow+0x88/0x190 fs/xfs/xfs_reflink.c:769
xlog_recover_finish+0x134/0x1e4 fs/xfs/xfs_log_recover.c:3513
xfs_log_mount_finish+0x13c/0x434 fs/xfs/xfs_log.c:803
xfs_mountfs+0xecc/0x1778 fs/xfs/xfs_mount.c:878
xfs_fs_fill_super+0xd64/0xf60 fs/xfs/xfs_super.c:1658
get_tree_bdev+0x360/0x54c fs/super.c:1303
xfs_fs_get_tree+0x28/0x38 fs/xfs/xfs_super.c:1705
vfs_get_tree+0x90/0x274 fs/super.c:1508
do_new_mount+0x25c/0x8c8 fs/namespace.c:2994
path_mount+0x590/0x104c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584
================================================================================
XFS (loop0): Failed to recover leftover CoW staging extents, err -117.
XFS (loop0): Log I/O Error (0x2) detected at xlog_recover_finish+0x198/0x1e4 fs/xfs/xfs_log_recover.c:3524 (fs/xfs/xfs_log_recover.c:3524). Shutting down filesystem.
XFS (loop0): Please unmount the filesystem and rectify the problem(s)
XFS (loop0): Ending recovery (logdev: internal)
XFS (loop0): Error -5 reserving per-AG metadata reserve pool.


---
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 bug is already fixed, 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 change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages