[Android 5.4] KASAN: use-after-free Write in ext4_insert_dentry

3 views
Skip to first unread message

syzbot

unread,
Apr 6, 2025, 8:10:29 AM4/6/25
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 41adfeb3d639 UPSTREAM: net: sched: Disallow replacing of c..
git tree: android12-5.4
console output: https://syzkaller.appspot.com/x/log.txt?x=114e47e4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=55297da5fb1e8eb8
dashboard link: https://syzkaller.appspot.com/bug?extid=e7a8a8abd0d6128211e1
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=13335b4c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11886b4c580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b16ef58834b3/disk-41adfeb3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/64e4f5416594/vmlinux-41adfeb3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6879282ff460/bzImage-41adfeb3.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/cc7bbc277363/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=1785123f980000)

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

==================================================================
BUG: KASAN: use-after-free in ext4_insert_dentry+0x366/0x6c0 fs/ext4/namei.c:2106
Write of size 247 at addr ffff8881ebea5f24 by task syz-executor205/355

CPU: 0 PID: 355 Comm: syz-executor205 Not tainted 5.4.290-syzkaller-00002-g41adfeb3d639 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x600 mm/kasan/report.c:384
__kasan_report+0xf3/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
check_memory_region_inline mm/kasan/generic.c:141 [inline]
check_memory_region+0x272/0x280 mm/kasan/generic.c:191
memcpy+0x38/0x50 mm/kasan/common.c:124
ext4_insert_dentry+0x366/0x6c0 fs/ext4/namei.c:2106
add_dirent_to_buf+0x3b3/0x780 fs/ext4/namei.c:2150
make_indexed_dir+0xec8/0x1690 fs/ext4/namei.c:2341
ext4_add_entry+0xdc2/0x1240 fs/ext4/namei.c:2445
ext4_add_nondir fs/ext4/namei.c:2765 [inline]
ext4_create+0x2fc/0x5b0 fs/ext4/namei.c:2807
vfs_create+0x426/0x5b0 fs/namei.c:3058
do_mknodat+0x290/0x450 fs/namei.c:3914
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7f3ed1d8df19
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd9a090378 EFLAGS: 00000246 ORIG_RAX: 0000000000000085
RAX: ffffffffffffffda RBX: 00007f3ed1dd70e0 RCX: 00007f3ed1d8df19
RDX: 0000000000000700 RSI: 0000000000000000 RDI: 0000200000000000
RBP: 00007f3ed1dd7095 R08: 00005555612b34c0 R09: 00005555612b34c0
R10: 00005555612b34c0 R11: 0000000000000246 R12: 00007ffd9a0903a0
R13: 00007ffd9a0905c8 R14: 431bde82d7b634db R15: 00007f3ed1dd703b

The buggy address belongs to the page:
page:ffffea0007afa940 refcount:3 mapcount:0 mapping:ffff8881f584a8b8 index:0x3f
def_blk_aops
flags: 0x800000000000202a(referenced|dirty|active|private)
raw: 800000000000202a dead000000000100 dead000000000122 ffff8881f584a8b8
raw: 000000000000003f ffff8881dd260348 00000003ffffffff ffff8881f5cb2000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff8881f5cb2000
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)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4893
__alloc_pages include/linux/gfp.h:503 [inline]
__alloc_pages_node include/linux/gfp.h:516 [inline]
alloc_pages_node include/linux/gfp.h:530 [inline]
__page_cache_alloc include/linux/pagemap.h:218 [inline]
pagecache_get_page+0x460/0x750 mm/filemap.c:1829
find_or_create_page include/linux/pagemap.h:313 [inline]
grow_dev_page fs/buffer.c:950 [inline]
grow_buffers fs/buffer.c:1019 [inline]
__getblk_slow fs/buffer.c:1046 [inline]
__getblk_gfp+0x1ec/0x720 fs/buffer.c:1323
sb_getblk include/linux/buffer_head.h:367 [inline]
ext4_getblk+0x1d3/0x540 fs/ext4/inode.c:992
ext4_bread+0x89/0x390 fs/ext4/inode.c:1035
ext4_append+0x297/0x4d0 fs/ext4/namei.c:83
make_indexed_dir+0x535/0x1690 fs/ext4/namei.c:2267
ext4_add_entry+0xdc2/0x1240 fs/ext4/namei.c:2445
ext4_add_nondir fs/ext4/namei.c:2765 [inline]
ext4_create+0x2fc/0x5b0 fs/ext4/namei.c:2807
vfs_create+0x426/0x5b0 fs/namei.c:3058
do_mknodat+0x290/0x450 fs/namei.c:3914
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085
free_unref_page_list+0x10a/0x590 mm/page_alloc.c:3154
release_pages+0xad8/0xb20 mm/swap.c:842
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:189 [inline]
tlb_flush_mmu mm/mmu_gather.c:196 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:277
exit_mmap+0x2dc/0x520 mm/mmap.c:3193
__mmput+0x8e/0x2c0 kernel/fork.c:1101
exit_mm kernel/exit.c:538 [inline]
do_exit+0xc08/0x2bc0 kernel/exit.c:848
do_group_exit+0x138/0x300 kernel/exit.c:984
__do_sys_exit_group kernel/exit.c:995 [inline]
__se_sys_exit_group kernel/exit.c:993 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:993
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
ffff8881ebea5f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881ebea5f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881ebea6000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8881ebea6080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881ebea6100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


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