syzbot


UBSAN: array-index-out-of-bounds in xfs_btree_lookup_get_block

Status: upstream: reported C repro on 2023/05/21 13:02
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+0855e3dcfde89f750ed7@syzkaller.appspotmail.com
First crash: 347d, last: 347d
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2023/05/21 linux-5.15.y (ToT) 9d6bde853685 C [report] UBSAN: array-index-out-of-bounds in xfs_btree_lookup_get_block
2023/05/21 upstream (ToT) 0dd2a6fb1e34 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in xfs_btree_lookup_get_block xfs C error done 7 393d 490d 22/26 fixed on 2023/06/08 14:41
linux-6.1 KASAN: slab-out-of-bounds Read in xfs_btree_lookup_get_block origin:lts-only C done 1 347d 347d 3/3 fixed on 2023/06/21 17:01
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2024/03/28 07:21 1m fix candidate upstream error job log (0)
2024/01/21 22:18 0m fix candidate upstream error job log (0)
2023/12/17 05:37 1m fix candidate upstream error job log (0)
2023/10/13 04:10 0m fix candidate upstream error job log (0)
2023/06/20 23:43 0m bisect fix linux-5.15.y error job log (0)

Sample crash report:
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.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/21 13:01 linux-5.15.y 9d6bde853685 4bce1a3e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 UBSAN: array-index-out-of-bounds in xfs_btree_lookup_get_block
* Struck through repros no longer work on HEAD.