syzbot


KASAN: use-after-free Read in __do_page_fault

Status: fixed on 2018/02/14 17:52
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+6a5269ce759a7bb12754ed9622076dc93f65a1f6@syzkaller.appspotmail.com
Fix commit: cb0631fd3cf9 x86/mm: fix use-after-free of vma during userfaultfd fault
First crash: 2426d, last: 2382d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in __do_page_fault syz 15719 2361d 2405d 0/3 closed as invalid on 2019/01/01 20:10

Sample crash report:
BUG: KASAN: use-after-free in arch_local_irq_enable arch/x86/include/asm/paravirt.h:787 [inline]
BUG: KASAN: use-after-free in __do_page_fault+0xc03/0xd60 arch/x86/mm/fault.c:1357
Read of size 8 at addr ffff8801ca265050 by task syz-executor5/4072

CPU: 1 PID: 4072 Comm: syz-executor5 Not tainted 4.14.0-rc3+ #117
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 arch_local_irq_enable arch/x86/include/asm/paravirt.h:787 [inline]
 __do_page_fault+0xc03/0xd60 arch/x86/mm/fault.c:1357
 do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1520
 page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1066
RIP: 0033:0x44bcf0
RSP: 002b:00007ff13b67e758 EFLAGS: 00010202
RAX: 00007ff13b67e800 RBX: 0000000000718000 RCX: 000000000000000e
RDX: 0000000000000400 RSI: 0000000020012fe0 RDI: 00007ff13b67e800
RBP: 0000000000005e10 R08: 0000000000000400 R09: 0000000000000000
R10: 00000000000f4245 R11: 0000000000000246 R12: 00000000004bbc27
R13: 00000000ffffffff R14: 0000000020012fee R15: 0000000000000000

Allocated by task 4072:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3561
 kmem_cache_zalloc include/linux/slab.h:656 [inline]
 mmap_region+0x7ee/0x15a0 mm/mmap.c:1658
 do_mmap+0x6a1/0xd50 mm/mmap.c:1468
 do_mmap_pgoff include/linux/mm.h:2150 [inline]
 vm_mmap_pgoff+0x1de/0x280 mm/util.c:333
 SYSC_mmap_pgoff mm/mmap.c:1518 [inline]
 SyS_mmap_pgoff+0x23b/0x5f0 mm/mmap.c:1476
 SYSC_mmap arch/x86/kernel/sys_x86_64.c:99 [inline]
 SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:90
 entry_SYSCALL_64_fastpath+0x1f/0xbe

Freed by task 4079:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x77/0x280 mm/slab.c:3763
 remove_vma+0x162/0x1b0 mm/mmap.c:176
 remove_vma_list mm/mmap.c:2475 [inline]
 do_munmap+0x82a/0xdf0 mm/mmap.c:2714
 mmap_region+0x59e/0x15a0 mm/mmap.c:1631
 do_mmap+0x6a1/0xd50 mm/mmap.c:1468
 do_mmap_pgoff include/linux/mm.h:2150 [inline]
 vm_mmap_pgoff+0x1de/0x280 mm/util.c:333
 SYSC_mmap_pgoff mm/mmap.c:1518 [inline]
 SyS_mmap_pgoff+0x23b/0x5f0 mm/mmap.c:1476
 SYSC_mmap arch/x86/kernel/sys_x86_64.c:99 [inline]
 SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:90
 entry_SYSCALL_64_fastpath+0x1f/0xbe

The buggy address belongs to the object at ffff8801ca265000
 which belongs to the cache vm_area_struct of size 200
The buggy address is located 80 bytes inside of
 200-byte region [ffff8801ca265000, ffff8801ca2650c8)
The buggy address belongs to the page:
page:ffffea0007289940 count:1 mapcount:0 mapping:ffff8801ca265000 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801ca265000 0000000000000000 000000010000000f
raw: ffffea00072882a0 ffffea00075045e0 ffff8801dae069c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ca264f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8801ca264f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801ca265000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8801ca265080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
 ffff8801ca265100: fc fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (679):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/10/06 04:20 upstream 0f380715e51f c26ea367 .config console log report syz ci-upstream-kasan-gce
2017/10/06 04:19 upstream 0f380715e51f c26ea367 .config console log report syz ci-upstream-kasan-gce
2017/10/04 02:00 upstream 887c8ba753fb c26ea367 .config console log report syz ci-upstream-kasan-gce-386
2017/10/03 20:45 upstream 887c8ba753fb c26ea367 .config console log report syz ci-upstream-kasan-gce-386
2017/10/03 17:26 upstream 887c8ba753fb c26ea367 .config console log report syz ci-upstream-kasan-gce-386
2017/10/27 06:31 linux-next 36ef71cae353 e511d9f8 .config console log report syz ci-upstream-next-kasan-gce
2017/10/06 04:20 linux-next 1418b852174a c26ea367 .config console log report syz ci-upstream-next-kasan-gce
2017/10/06 04:20 mmots fb686cb13e51 c26ea367 .config console log report syz ci-upstream-mmots-kasan-gce
2017/09/29 08:58 linux-next 1418b852174a c26ea367 .config console log report syz ci-upstream-next-kasan-gce
2017/09/29 08:30 mmots 8fd0520d9cec c26ea367 .config console log report syz ci-upstream-mmots-kasan-gce
2017/09/28 15:55 linux-next 00d47fc93ae9 c26ea367 .config console log report syz ci-upstream-next-kasan-gce
2017/09/28 03:24 linux-next 045c5205823f c26ea367 .config console log report syz ci-upstream-next-kasan-gce
2017/09/27 07:58 linux-next 045c5205823f c26ea367 .config console log report syz ci-upstream-next-kasan-gce
2017/10/28 17:54 upstream 781402340475 80c74880 .config console log report ci-upstream-kasan-gce
2017/10/19 17:25 upstream 73d3393ada4f 3704c601 .config console log report ci-upstream-kasan-gce
2017/10/27 11:00 upstream 15f859ae5c43 80c74880 .config console log report ci-upstream-kasan-gce-386
2017/10/26 05:13 upstream f34157878d3b 83d9c302 .config console log report ci-upstream-kasan-gce-386
2017/10/26 03:42 upstream f34157878d3b 83d9c302 .config console log report ci-upstream-kasan-gce-386
2017/10/25 16:57 upstream f34157878d3b 83d9c302 .config console log report ci-upstream-kasan-gce-386
2017/10/15 02:26 upstream e7a36a6ec9cf c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/14 23:57 upstream be1f16ba35d9 c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/13 23:24 upstream e837d9134be8 c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/12 20:31 upstream ff5abbe799e2 c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/12 14:27 upstream ff5abbe799e2 c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/11 00:52 upstream a957fd420ca8 c26ea367 .config console log report ci-upstream-kasan-gce-386
2017/10/29 23:17 linux-next 36ef71cae353 e511d9f8 .config console log report ci-upstream-next-kasan-gce
2017/10/25 03:59 mmots 0f611fb6dcc0 e0a2b195 .config console log report ci-upstream-mmots-kasan-gce
2017/10/15 03:50 linux-next 49827b977a2e 441d64d9 .config console log report ci-upstream-next-kasan-gce
2017/10/13 16:44 mmots 4eb4a4191fe5 441d64d9 .config console log report ci-upstream-mmots-kasan-gce
2017/10/11 15:02 mmots 4eb4a4191fe5 441d64d9 .config console log report ci-upstream-mmots-kasan-gce
2017/10/10 01:46 linux-next 49827b977a2e 441d64d9 .config console log report ci-upstream-next-kasan-gce
2017/10/04 14:11 mmots af6dd9aabb86 c26ea367 .config console log report ci-upstream-mmots-kasan-gce
2017/10/04 09:09 linux-next 1418b852174a c26ea367 .config console log report ci-upstream-next-kasan-gce
* Struck through repros no longer work on HEAD.