[syzbot] [btrfs?] KMSAN: uninit-value in extent_fiemap

From: syzbot
Date: Mon Mar 06 2023 - 13:02:45 EST


Hello,

syzbot found the following issue on:

HEAD commit: 49a9a20768f5 kmsan: allow using __msan_instrument_asm_stor..
git tree: https://github.com/google/kmsan.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=1597ff87880000
kernel config: https://syzkaller.appspot.com/x/.config?x=d901b2d28729cb6a
dashboard link: https://syzkaller.appspot.com/bug?extid=8d245945ddc97769435f
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project.git 610139d2d9ce6746b3c617fb3e2f7886272d26ff), GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: i386

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4a944f9f50fb/disk-49a9a207.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a2ec5594e201/vmlinux-49a9a207.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3aafc1a9ba37/bzImage-49a9a207.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+8d245945ddc97769435f@xxxxxxxxxxxxxxxxxxxxxxxxx

BTRFS info (device loop0): using xxhash64 (xxhash64-generic) checksum algorithm
BTRFS info (device loop0): using free space tree
BTRFS info (device loop0): enabling ssd optimizations
=====================================================
BUG: KMSAN: uninit-value in extent_fiemap+0x2ece/0x6040 fs/btrfs/extent_io.c:3966
extent_fiemap+0x2ece/0x6040 fs/btrfs/extent_io.c:3966
btrfs_fiemap+0x20c/0x260 fs/btrfs/inode.c:8126
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x2daa/0x3c20 fs/ioctl.c:810
__do_compat_sys_ioctl fs/ioctl.c:962 [inline]
__se_compat_sys_ioctl+0x68c/0xfa0 fs/ioctl.c:910
__ia32_compat_sys_ioctl+0x8f/0xd0 fs/ioctl.c:910
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:246
entry_SYSENTER_compat_after_hwframe+0x70/0x82

Uninit was stored to memory at:
read_extent_buffer fs/btrfs/extent_io.c:5185 [inline]
btrfs_item_key fs/btrfs/ctree.h:2201 [inline]
btrfs_item_key_to_cpu fs/btrfs/ctree.h:2306 [inline]
extent_fiemap+0x2092/0x6040 fs/btrfs/extent_io.c:3965
btrfs_fiemap+0x20c/0x260 fs/btrfs/inode.c:8126
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x2daa/0x3c20 fs/ioctl.c:810
__do_compat_sys_ioctl fs/ioctl.c:962 [inline]
__se_compat_sys_ioctl+0x68c/0xfa0 fs/ioctl.c:910
__ia32_compat_sys_ioctl+0x8f/0xd0 fs/ioctl.c:910
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:246
entry_SYSENTER_compat_after_hwframe+0x70/0x82

Uninit was created at:
__alloc_pages+0x9f1/0xe80 mm/page_alloc.c:5581
__alloc_pages_bulk+0x1a99/0x2690 mm/page_alloc.c:5506
alloc_pages_bulk_array include/linux/gfp.h:201 [inline]
btrfs_alloc_page_array fs/btrfs/extent_io.c:1317 [inline]
btrfs_clone_extent_buffer+0x48d/0x1230 fs/btrfs/extent_io.c:4303
fiemap_search_slot fs/btrfs/extent_io.c:3688 [inline]
extent_fiemap+0x1cf4/0x6040 fs/btrfs/extent_io.c:3940
btrfs_fiemap+0x20c/0x260 fs/btrfs/inode.c:8126
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x2daa/0x3c20 fs/ioctl.c:810
__do_compat_sys_ioctl fs/ioctl.c:962 [inline]
__se_compat_sys_ioctl+0x68c/0xfa0 fs/ioctl.c:910
__ia32_compat_sys_ioctl+0x8f/0xd0 fs/ioctl.c:910
do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
__do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178
do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
do_SYSENTER_32+0x1b/0x20 arch/x86/entry/common.c:246
entry_SYSENTER_compat_after_hwframe+0x70/0x82

CPU: 0 PID: 6991 Comm: syz-executor.0 Not tainted 6.1.0-rc7-syzkaller-63931-g49a9a20768f5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
=====================================================


---
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 syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.