[v6.1] KASAN: out-of-bounds Read in ext4_ext_remove_space

0 views
Skip to first unread message

syzbot

unread,
Jan 3, 2024, 10:27:27 AMJan 3
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a507f147e6f0 Linux 6.1.70
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12d46a6ee80000
kernel config: https://syzkaller.appspot.com/x/.config?x=374c4f371d017411
dashboard link: https://syzkaller.appspot.com/bug?extid=2de4e7fee59aa0477fcd
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=1134956ee80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10195379e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/941b73df0eaf/disk-a507f147.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/37f3d867ad6f/vmlinux-a507f147.xz
kernel image: https://storage.googleapis.com/syzbot-assets/aeb318de7a8d/bzImage-a507f147.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/7fcf3d56f965/mount_0.gz

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

==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2737 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1c22/0x4f30 fs/ext4/extents.c:2959
Read of size 18446744073709551544 at addr ffff88806c501054 by task syz-executor329/8785

CPU: 1 PID: 8785 Comm: syz-executor329 Not tainted 6.1.70-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
memmove+0x25/0x60 mm/kasan/shadow.c:54
ext4_ext_rm_leaf fs/ext4/extents.c:2737 [inline]
ext4_ext_remove_space+0x1c22/0x4f30 fs/ext4/extents.c:2959
ext4_punch_hole+0x80b/0xd00 fs/ext4/inode.c:4127
ext4_fallocate+0x30b/0x2160 fs/ext4/extents.c:4708
vfs_fallocate+0x547/0x6b0 fs/open.c:323
do_vfs_ioctl+0x222c/0x2a90 fs/ioctl.c:849
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbb65e70f49
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:00007fbb65deb218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fbb65ef86e8 RCX: 00007fbb65e70f49
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007fbb65ef86e0 R08: 00007ffd2d80c7c7 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbb65ec5578
R13: 000000000000006e R14: 00007ffd2d80c6e0 R15: 6f6f6c2f7665642f
</TASK>

The buggy address belongs to the physical page:
page:ffffea0001b14040 refcount:2 mapcount:0 mapping:ffff8880128875f8 index:0x11 pfn:0x6c501
memcg:ffff888140058000
aops:def_blk_aops ino:700004
flags: 0xfff58000002056(referenced|uptodate|lru|workingset|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff58000002056 ffffea0001e475c8 ffffea0001b454c8 ffff8880128875f8
raw: 0000000000000011 ffff8880739b6000 00000002ffffffff ffff888140058000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 8763, tgid 8762 (syz-executor329), ts 697107977280, free_ts 696324971462
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
prep_new_page mm/page_alloc.c:2520 [inline]
get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5545
folio_alloc+0x1a/0x50 mm/mempolicy.c:2292
filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:971
__filemap_get_folio+0x749/0xe80 mm/filemap.c:1965
pagecache_get_page+0x28/0x250 mm/folio-compat.c:110
find_or_create_page include/linux/pagemap.h:613 [inline]
grow_dev_page fs/buffer.c:946 [inline]
grow_buffers fs/buffer.c:1011 [inline]
__getblk_slow fs/buffer.c:1038 [inline]
__getblk_gfp+0x211/0xa20 fs/buffer.c:1333
sb_getblk_gfp include/linux/buffer_head.h:363 [inline]
ext4_ext_grow_indepth fs/ext4/extents.c:1334 [inline]
ext4_ext_create_new_leaf fs/ext4/extents.c:1435 [inline]
ext4_ext_insert_extent+0xfdf/0x4e50 fs/ext4/extents.c:2102
ext4_ext_map_blocks+0x1d55/0x77c0 fs/ext4/extents.c:4308
ext4_map_blocks+0xa3c/0x1ca0 fs/ext4/inode.c:651
_ext4_get_block+0x23b/0x660 fs/ext4/inode.c:798
ext4_block_write_begin+0x631/0x1400 fs/ext4/inode.c:1100
ext4_write_begin+0x638/0xf80
ext4_da_write_begin+0x30a/0x9c0 fs/ext4/inode.c:2988
generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3808
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1440 [inline]
free_pcp_prepare mm/page_alloc.c:1490 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
free_unref_page_list+0x663/0x900 mm/page_alloc.c:3499
release_pages+0x2836/0x2b40 mm/swap.c:1055
__pagevec_release+0x80/0xf0 mm/swap.c:1075
pagevec_release include/linux/pagevec.h:71 [inline]
folio_batch_release include/linux/pagevec.h:135 [inline]
truncate_inode_pages_range+0x48a/0x1340 mm/truncate.c:373
ext4_punch_hole+0x4f1/0xd00 fs/ext4/inode.c:4089
ext4_fallocate+0x30b/0x2160 fs/ext4/extents.c:4708
vfs_fallocate+0x547/0x6b0 fs/open.c:323
do_vfs_ioctl+0x222c/0x2a90 fs/ioctl.c:849
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
ffff88806c500f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88806c500f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88806c501000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88806c501080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88806c501100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================


---
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 report is already addressed, 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 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
Reply all
Reply to author
Forward
0 new messages