[Android 5.10] KASAN: out-of-bounds Read in ext4_ext_remove_space

4 views
Skip to first unread message

syzbot

unread,
Sep 2, 2023, 9:17:52 AM9/2/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c8ca447a86a2 UPSTREAM: mhi: pci_generic: Fix implicit conv..
git tree: android13-5.10-lts
console+strace: https://syzkaller.appspot.com/x/log.txt?x=122cfbc0680000
kernel config: https://syzkaller.appspot.com/x/.config?x=b36e48adaccc9898
dashboard link: https://syzkaller.appspot.com/bug?extid=346920c4ba6752340f29
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=166f7198680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1620c698680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3f5e073efeb4/disk-c8ca447a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6cc89432ccf5/vmlinux-c8ca447a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f8803a628b73/bzImage-c8ca447a.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/c33b51223213/mount_0.gz

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

EXT4-fs (loop0): Remounting filesystem read-only
EXT4-fs error (device loop0) in ext4_mb_clear_bb:5614: Corrupt filesystem
==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2730 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1fbc/0x4e10 fs/ext4/extents.c:2952
Read of size 18446744073709551544 at addr ffff88811baa3054 by task syz-executor226/292

CPU: 1 PID: 292 Comm: syz-executor226 Not tainted 5.10.192-syzkaller-00409-gc8ca447a86a2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
print_address_description+0x81/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x179/0x1c0 mm/kasan/report.c:452
kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
memmove+0x2d/0x70 mm/kasan/shadow.c:54
ext4_ext_rm_leaf fs/ext4/extents.c:2730 [inline]
ext4_ext_remove_space+0x1fbc/0x4e10 fs/ext4/extents.c:2952
ext4_punch_hole+0x720/0xb10 fs/ext4/inode.c:4205
ext4_fallocate+0x2e8/0x1ca0 fs/ext4/extents.c:4704
vfs_fallocate+0x492/0x570 fs/open.c:310
do_vfs_ioctl+0x1686/0x1a30 fs/ioctl.c:732
__do_sys_ioctl fs/ioctl.c:751 [inline]
__se_sys_ioctl+0x99/0x190 fs/ioctl.c:739
__x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
do_syscall_64+0x34/0x70
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7fbe6877e729
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbe6035a218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fbe688066d8 RCX: 00007fbe6877e729
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007fbe688066d0 R08: 00007fffa8dac757 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbe687d3678
R13: 0000000000000002 R14: 00007fffa8dac670 R15: 6f6f6c2f7665642f

The buggy address belongs to the page:
page:ffffea00046ea8c0 refcount:2 mapcount:0 mapping:ffff888109191c10 index:0x3a pfn:0x11baa3
aops:def_blk_aops ino:0
flags: 0x4000000000002036(referenced|uptodate|lru|active|private)
raw: 4000000000002036 ffffea0004440248 ffffea0004707c88 ffff888109191c10
raw: 000000000000003a ffff88811c496930 00000002ffffffff ffff888100142000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888100142000
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 287, ts 19953384406, free_ts 19753654753
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x166/0x180 mm/page_alloc.c:2462
get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5346
__alloc_pages include/linux/gfp.h:544 [inline]
__alloc_pages_node include/linux/gfp.h:557 [inline]
alloc_pages_node include/linux/gfp.h:571 [inline]
alloc_pages include/linux/gfp.h:590 [inline]
__page_cache_alloc include/linux/pagemap.h:290 [inline]
pagecache_get_page+0x669/0x950 mm/filemap.c:1848
find_or_create_page include/linux/pagemap.h:402 [inline]
grow_dev_page fs/buffer.c:976 [inline]
grow_buffers fs/buffer.c:1045 [inline]
__getblk_slow fs/buffer.c:1072 [inline]
__getblk_gfp+0x221/0x7e0 fs/buffer.c:1370
sb_getblk_gfp include/linux/buffer_head.h:368 [inline]
ext4_ext_grow_indepth fs/ext4/extents.c:1325 [inline]
ext4_ext_create_new_leaf fs/ext4/extents.c:1424 [inline]
ext4_ext_insert_extent+0xf88/0x4d20 fs/ext4/extents.c:2094
ext4_ext_map_blocks+0x1b4c/0x6be0 fs/ext4/extents.c:4302
ext4_map_blocks+0xaa7/0x1ec0 fs/ext4/inode.c:646
_ext4_get_block+0x21b/0x610 fs/ext4/inode.c:793
ext4_get_block+0x39/0x50 fs/ext4/inode.c:810
ext4_block_write_begin+0x61e/0x13b0 fs/ext4/inode.c:1077
ext4_write_begin+0x6fa/0x1730
ext4_da_write_begin+0x49d/0xf60 fs/ext4/inode.c:3021
generic_perform_write+0x2cd/0x570 mm/filemap.c:3506
ext4_buffered_write_iter+0x482/0x610 fs/ext4/file.c:271
ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685
page last free stack trace:
reset_page_owner include/linux/page_owner.h:28 [inline]
free_pages_prepare mm/page_alloc.c:1349 [inline]
free_pcp_prepare mm/page_alloc.c:1421 [inline]
free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336
free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3443
release_pages+0xea0/0xef0 mm/swap.c:1103
free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:356
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
tlb_flush_mmu mm/mmu_gather.c:247 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:326
unmap_region+0x31c/0x370 mm/mmap.c:2807
__do_munmap+0x699/0x8c0 mm/mmap.c:3036
__vm_munmap mm/mmap.c:3059 [inline]
__do_sys_munmap mm/mmap.c:3085 [inline]
__se_sys_munmap+0x120/0x1a0 mm/mmap.c:3081
__x64_sys_munmap+0x5b/0x70 mm/mmap.c:3081
do_syscall_64+0x34/0x70
entry_SYSCALL_64_after_hwframe+0x61/0xc6

Memory state around the buggy address:
ffff88811baa2f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811baa2f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811baa3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88811baa3080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88811baa3100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs error (device loop0): __ext4_get_inode_loc:4426: comm syz-executor226: Invalid inode table block 0 in block_group 0
EXT4-fs error (device loop0) in ext4_reserve_inode_write:5886: Corrupt filesystem
EXT4-fs error (device loop0): ext4_punch_hole:4218: inode #16: comm syz-executor226: mark_inode_dirty error


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