================================================================== BUG: KASAN: use-after-free in handle_userfault+0x2076/0x23a0 fs/userfaultfd.c:371 Read of size 8 at addr ffff8801c959d6a0 by task syz-executor7/4254 CPU: 0 PID: 4254 Comm: syz-executor7 Not tainted 4.14.0-rc5-next-20171018+ #36 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 handle_userfault+0x2076/0x23a0 fs/userfaultfd.c:371 do_anonymous_page mm/memory.c:3121 [inline] handle_pte_fault mm/memory.c:3934 [inline] __handle_mm_fault+0x2d46/0x39c0 mm/memory.c:4060 handle_mm_fault+0x334/0x8d0 mm/memory.c:4097 __do_page_fault+0x5bd/0xd60 arch/x86/mm/fault.c:1438 do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1514 page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1066 RIP: 0033:0x452875 RSP: 002b:0000000020013000 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 0000000000758020 RCX: 0000000000452869 RDX: 0000000020059ffc RSI: 0000000020013000 RDI: 0000000000000400 RBP: 0000000000000045 R08: 0000000020058ffd R09: 0000000000000000 R10: 0000000020058ffc R11: 0000000000000212 R12: 00000000006ee718 R13: 00000000ffffffff R14: 00007f402807c6d4 R15: 0000000000000000 Allocated by task 4236: 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:3548 dup_userfaultfd+0x21c/0x890 fs/userfaultfd.c:659 dup_mmap kernel/fork.c:460 [inline] dup_mm kernel/fork.c:1239 [inline] copy_mm+0xa38/0x1310 kernel/fork.c:1293 copy_process.part.39+0x1f10/0x4b20 kernel/fork.c:1797 copy_process kernel/fork.c:1610 [inline] _do_fork+0x1ef/0xfb0 kernel/fork.c:2089 SYSC_clone kernel/fork.c:2199 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2193 do_syscall_64+0x26c/0x8d0 arch/x86/entry/common.c:287 return_from_SYSCALL_64+0x0/0x7a Freed by task 4236: 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:3492 [inline] kmem_cache_free+0x77/0x280 mm/slab.c:3750 userfaultfd_ctx_put+0x501/0x720 fs/userfaultfd.c:165 userfaultfd_event_wait_completion+0x788/0x9c0 fs/userfaultfd.c:605 dup_fctx fs/userfaultfd.c:693 [inline] dup_userfaultfd_complete+0x2de/0x480 fs/userfaultfd.c:701 dup_mmap kernel/fork.c:528 [inline] dup_mm kernel/fork.c:1239 [inline] copy_mm+0xe9b/0x1310 kernel/fork.c:1293 copy_process.part.39+0x1f10/0x4b20 kernel/fork.c:1797 copy_process kernel/fork.c:1610 [inline] _do_fork+0x1ef/0xfb0 kernel/fork.c:2089 SYSC_clone kernel/fork.c:2199 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2193 do_syscall_64+0x26c/0x8d0 arch/x86/entry/common.c:287 return_from_SYSCALL_64+0x0/0x7a The buggy address belongs to the object at ffff8801c959d540 which belongs to the cache userfaultfd_ctx_cache of size 360 The buggy address is located 352 bytes inside of 360-byte region [ffff8801c959d540, ffff8801c959d6a8) The buggy address belongs to the page: page:ffffea0007256740 count:1 mapcount:0 mapping:ffff8801c959d000 index:0xffff8801c959dff7 flags: 0x200000000000100(slab) raw: 0200000000000100 ffff8801c959d000 ffff8801c959dff7 0000000100000009 raw: ffffea000739cea0 ffff8801d6545348 ffff8801d654ec00 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c959d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c959d600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c959d680: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ^ ffff8801c959d700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c959d780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================