[v5.15] KASAN: out-of-bounds Read in ext4_ext_remove_space

1 view
Skip to first unread message

syzbot

unread,
Jan 21, 2024, 11:07:18 AMJan 21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: ddcaf4999061 Linux 5.15.147
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1507c273e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c65db3d25098c3c
dashboard link: https://syzkaller.appspot.com/bug?extid=023ffea00bea0075efe3
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=14b558d7e80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10a270abe80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/fe87fb57528f/disk-ddcaf499.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f64608a2759c/vmlinux-ddcaf499.xz
kernel image: https://storage.googleapis.com/syzbot-assets/84cae5bc6ed5/bzImage-ddcaf499.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/d23cbf5e0a91/mount_0.gz

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

EXT4-fs error (device loop4) in ext4_mb_clear_bb:6150: Corrupt filesystem
==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2735 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1e04/0x4db0 fs/ext4/extents.c:2957
Read of size 18446744073709551544 at addr ffff88806ed60054 by task syz-executor127/11206

CPU: 1 PID: 11206 Comm: syz-executor127 Not tainted 5.15.147-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+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
memmove+0x25/0x60 mm/kasan/shadow.c:54
ext4_ext_rm_leaf fs/ext4/extents.c:2735 [inline]
ext4_ext_remove_space+0x1e04/0x4db0 fs/ext4/extents.c:2957
ext4_punch_hole+0x7c0/0xc10 fs/ext4/inode.c:4088
ext4_fallocate+0x30a/0x20c0 fs/ext4/extents.c:4711
vfs_fallocate+0x54a/0x6b0 fs/open.c:308
do_vfs_ioctl+0x2317/0x2b70 fs/ioctl.c:853
__do_sys_ioctl fs/ioctl.c:872 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7ff963baaf49
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:00007ff963b46218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff963c326d8 RCX: 00007ff963baaf49
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007ff963c326d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff963bff578
R13: 000000000000006e R14: 00007fff38cf1b00 R15: 6f6f6c2f7665642f
</TASK>

The buggy address belongs to the page:
page:ffffea0001bb5800 refcount:2 mapcount:0 mapping:ffff8881408988b0 index:0x20 pfn:0x6ed60
memcg:ffff888011e3c000
aops:def_blk_aops ino:700004
flags: 0xfff00000022036(referenced|uptodate|lru|active|private|mappedtodisk|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000022036 ffffea0001c9dac8 ffffea0001c64888 ffff8881408988b0
raw: 0000000000000020 ffff8880715a6d98 00000002ffffffff ffff888011e3c000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 3771, ts 861945196801, free_ts 856704191485
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
__page_cache_alloc+0xd4/0x4a0 mm/filemap.c:1022
page_cache_ra_unbounded+0x2b1/0x930 mm/readahead.c:216
do_page_cache_ra mm/readahead.c:269 [inline]
force_page_cache_ra+0x378/0x3e0 mm/readahead.c:301
page_cache_sync_readahead include/linux/pagemap.h:833 [inline]
filemap_get_pages mm/filemap.c:2551 [inline]
filemap_read+0x71c/0x2980 mm/filemap.c:2634
blkdev_read_iter+0x12a/0x180 block/fops.c:560
call_read_iter include/linux/fs.h:2140 [inline]
new_sync_read fs/read_write.c:404 [inline]
vfs_read+0xa9f/0xe10 fs/read_write.c:485
ksys_read+0x1a2/0x2c0 fs/read_write.c:623
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
__vunmap+0x8d4/0xa20 mm/vmalloc.c:2621
free_work+0x57/0x80 mm/vmalloc.c:95
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
ffff88806ed5ff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88806ed5ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88806ed60000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88806ed60080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88806ed60100: 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