syzbot


KASAN: use-after-free Read in do_handle_mm_fault

Status: auto-obsoleted due to no activity on 2023/05/17 20:19
Reported-by: syzbot+dcfe5483e30f4642d97b@syzkaller.appspotmail.com
First crash: 694d, last: 668d
Cause bisection: failed (error log, bisect log)
  
Fix bisection: fixed by (bisect log) :
commit d1e4288d2a637d4725166c423bda2bf450739d06
Author: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed Jun 1 09:23:40 2022 +0000

  ASoC: fsl_sai: use local device pointer

  

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __handle_mm_fault mm/memory.c:4881 [inline]
BUG: KASAN: use-after-free in do_handle_mm_fault+0x142f/0x2370 mm/memory.c:5141
Read of size 8 at addr ffff88811f824000 by task syz-executor.3/11802

CPU: 1 PID: 11802 Comm: syz-executor.3 Not tainted 5.15.80-syzkaller-00318-g72d681a01da5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3d0 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
 kasan_check_range+0x2aa/0x2e0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 __handle_mm_fault mm/memory.c:4881 [inline]
 do_handle_mm_fault+0x142f/0x2370 mm/memory.c:5141
 do_user_addr_fault+0xb5d/0x1220 arch/x86/mm/fault.c:1377
 handle_page_fault arch/x86/mm/fault.c:1561 [inline]
 exc_page_fault+0x68/0x1a0 arch/x86/mm/fault.c:1617
 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568
RIP: 0033:0x7fd14e202c1f
Code: 83 f8 04 0f 84 07 02 00 00 0f 87 9f 00 00 00 48 83 f8 01 75 49 48 8b 44 24 20 48 0b 44 24 28 0f 84 99 01 00 00 48 8b 44 24 10 <0f> b6 30 48 8b 04 24 48 85 c0 0f 84 6b 02 00 00 48 83 f8 01 0f 85
RSP: 002b:00007fff88f1ae00 EFLAGS: 00010206
RAX: 0000000020000010 RBX: 0000000000000000 RCX: 0000000000000000
RDX: c5d8c15185e84997 RSI: 0000000000000000 RDI: 00005555572042e8
RBP: 00007fff88f1aef8 R08: 0000000000000000 R09: 0000000000000003
R10: 00007fd14ddd7b68 R11: 0000000000000246 R12: 00007fd14e382f8c
R13: 00007fd14ddd7980 R14: 00007fd14e382f80 R15: 0000000000000000
 </TASK>

The buggy address belongs to the page:
page:ffffea00047e0900 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11f824
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea000430ae88 ffff8881f713b960 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT), pid 11803, ts 286888501227, free_ts 286888503341
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
 prep_new_page mm/page_alloc.c:2501 [inline]
 get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
 __alloc_pages_node include/linux/gfp.h:591 [inline]
 alloc_pages_node include/linux/gfp.h:605 [inline]
 alloc_pages include/linux/gfp.h:618 [inline]
 __pte_alloc_one include/asm-generic/pgalloc.h:63 [inline]
 pte_alloc_one+0x73/0x1b0 arch/x86/mm/pgtable.c:33
 do_fault_around mm/memory.c:4338 [inline]
 do_read_fault mm/memory.c:4376 [inline]
 do_fault mm/memory.c:4523 [inline]
 handle_pte_fault+0xf33/0x11d0 mm/memory.c:4738
 do_handle_mm_fault+0x2073/0x2370 mm/memory.c:5141
 handle_mm_fault include/linux/mm.h:1824 [inline]
 faultin_page mm/gup.c:976 [inline]
 __get_user_pages+0xb2f/0x1240 mm/gup.c:1197
 populate_vma_page_range mm/gup.c:1529 [inline]
 __mm_populate+0x372/0x560 mm/gup.c:1638
 mm_populate include/linux/mm.h:2680 [inline]
 vm_mmap_pgoff+0x263/0x420 mm/util.c:559
 ksys_mmap_pgoff+0x15d/0x1e0 mm/mmap.c:1633
 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline]
 __se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline]
 __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:86
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 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:26 [inline]
 free_pages_prepare mm/page_alloc.c:1364 [inline]
 free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435
 free_unref_page_prepare mm/page_alloc.c:3433 [inline]
 free_unref_page+0x9c/0x370 mm/page_alloc.c:3513
 free_the_page mm/page_alloc.c:706 [inline]
 __free_pages+0xd8/0x100 mm/page_alloc.c:5621
 pte_free include/asm-generic/pgalloc.h:102 [inline]
 do_fault mm/memory.c:4531 [inline]
 handle_pte_fault+0xe90/0x11d0 mm/memory.c:4738
 do_handle_mm_fault+0x2073/0x2370 mm/memory.c:5141
 handle_mm_fault include/linux/mm.h:1824 [inline]
 faultin_page mm/gup.c:976 [inline]
 __get_user_pages+0xb2f/0x1240 mm/gup.c:1197
 populate_vma_page_range mm/gup.c:1529 [inline]
 __mm_populate+0x372/0x560 mm/gup.c:1638
 mm_populate include/linux/mm.h:2680 [inline]
 vm_mmap_pgoff+0x263/0x420 mm/util.c:559
 ksys_mmap_pgoff+0x15d/0x1e0 mm/mmap.c:1633
 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline]
 __se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline]
 __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:86
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88811f823f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811f823f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811f824000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88811f824080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88811f824100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/21 13:50 android13-5.15-lts 72d681a01da5 cc0f9968 .config console log report syz [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in do_handle_mm_fault
2023/01/22 20:12 android13-5.15-lts 72d681a01da5 cc0f9968 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in do_handle_mm_fault
2023/01/15 02:39 android13-5.15-lts c73b4619ad86 a63719e7 .config console log report info ci2-android-5-15 KASAN: use-after-free Read in do_handle_mm_fault
2022/12/28 13:34 android13-5.15-lts c73b4619ad86 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in do_handle_mm_fault
* Struck through repros no longer work on HEAD.