[Android 5.10] KASAN: use-after-free Read in ext4_rename_dir_prepare (2)

2 views
Skip to first unread message

syzbot

unread,
Feb 22, 2023, 6:42:47 PM2/22/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 416c4356f372 Merge 5.10.161 into android12-5.10-lts
git tree: android12-5.10-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=11c909f7480000
kernel config: https://syzkaller.appspot.com/x/.config?x=ba29236d2f217808
dashboard link: https://syzkaller.appspot.com/bug?extid=1a9a1140c275f0b4b9cc
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16818054c80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12c8773b480000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0149809cf436/disk-416c4356.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2bf0b26aed77/vmlinux-416c4356.xz
kernel image: https://storage.googleapis.com/syzbot-assets/224b4978be5c/bzImage-416c4356.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/bfbd8124be5c/mount_0.gz

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

ext4 filesystem being mounted at /root/file0 supports timestamps until 2038 (0x7fffffff)
==================================================================
BUG: KASAN: use-after-free in ext4_rename_dir_prepare+0x42e/0x4a0 fs/ext4/namei.c:3704
Read of size 4 at addr ffff88811cb4c000 by task syz-executor241/367

CPU: 1 PID: 367 Comm: syz-executor241 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/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/0x3c0 mm/kasan/report.c:233
__kasan_report mm/kasan/report.c:419 [inline]
kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
ext4_rename_dir_prepare+0x42e/0x4a0 fs/ext4/namei.c:3704
ext4_cross_rename fs/ext4/namei.c:4212 [inline]
ext4_rename2+0x1f37/0x45a0 fs/ext4/namei.c:4296
vfs_rename+0x95e/0xde0 fs/namei.c:4389
do_renameat2+0x83e/0x1190 fs/namei.c:4536
__do_sys_renameat2 fs/namei.c:4571 [inline]
__se_sys_renameat2 fs/namei.c:4568 [inline]
__x64_sys_renameat2+0xbf/0xd0 fs/namei.c:4568
do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7f85c66e82b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc25e70e38 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f85c66e82b9
RDX: 0000000000000004 RSI: 0000000020000240 RDI: 0000000000000004
RBP: 0000000000000000 R08: 0000000000000002 R09: 00007f85c6756ec0
R10: 0000000020000000 R11: 0000000000000246 R12: 00007ffc25e70e60
R13: 0000000000000000 R14: 431bde82d7b634db R15: 0000000000000000

The buggy address belongs to the page:
page:ffffea000472d300 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11cb4c
flags: 0x8000000000000000()
raw: 8000000000000000 ffffea000472d348 ffff8881f715acc0 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x3100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO|0x2000000), pid 360, ts 48288182492, free_ts 48295631287
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2386 [inline]
prep_new_page mm/page_alloc.c:2392 [inline]
get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073
__alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160
__alloc_pages include/linux/gfp.h:529 [inline]
__alloc_pages_node include/linux/gfp.h:542 [inline]
alloc_pages_node include/linux/gfp.h:556 [inline]
alloc_pages include/linux/gfp.h:575 [inline]
do_anonymous_page+0x307/0x1050 mm/memory.c:3922
handle_pte_fault+0x4cd/0x9d0 mm/memory.c:4735
__handle_mm_fault mm/memory.c:4895 [inline]
handle_mm_fault+0xf22/0x19f0 mm/memory.c:5259
do_user_addr_fault+0x67e/0xce0 arch/x86/mm/fault.c:1396
handle_page_fault arch/x86/mm/fault.c:1462 [inline]
exc_page_fault+0x71/0x1b0 arch/x86/mm/fault.c:1518
asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571
page last free stack trace:
reset_page_owner include/linux/page_owner.h:28 [inline]
free_pages_prepare mm/page_alloc.c:1332 [inline]
free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1406
free_unref_page_prepare mm/page_alloc.c:3293 [inline]
free_unref_page_list+0x11d/0x660 mm/page_alloc.c:3367
release_pages+0xc24/0xc60 mm/swap.c:1082
free_pages_and_swap_cache+0x97/0xb0 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+0x8a0/0xa80 mm/mmu_gather.c:247
tlb_finish_mmu+0xd2/0x1f0 mm/mmu_gather.c:326
unmap_region+0x346/0x390 mm/mmap.c:2798
__do_munmap+0x696/0x8c0 mm/mmap.c:3027
__vm_munmap mm/mmap.c:3050 [inline]
__do_sys_munmap mm/mmap.c:3076 [inline]
__se_sys_munmap+0x121/0x1b0 mm/mmap.c:3072
__x64_sys_munmap+0x5b/0x70 mm/mmap.c:3072
do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xc6

Memory state around the buggy address:
ffff88811cb4bf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88811cb4bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88811cb4c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88811cb4c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811cb4c100: 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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages