================================================================== BUG: KASAN: use-after-free in userfaultfd_release+0x5c1/0x6e0 fs/userfaultfd.c:824 Read of size 8 at addr ffff88003cb9ad88 by task syz-executor2/15880 netlink: 3 bytes leftover after parsing attributes in process `syz-executor3'. netlink: 3 bytes leftover after parsing attributes in process `syz-executor3'. CPU: 3 PID: 15880 Comm: syz-executor2 Not tainted 4.13.0-next-20170915+ #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 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+0x24e/0x340 mm/kasan/report.c:409 netlink: 3 bytes leftover after parsing attributes in process `syz-executor3'. netlink: 3 bytes leftover after parsing attributes in process `syz-executor3'. __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 userfaultfd_release+0x5c1/0x6e0 fs/userfaultfd.c:824 __fput+0x333/0x7f0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:112 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xa52/0x1b40 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 get_signal+0x7e8/0x17e0 kernel/signal.c:2334 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808 exit_to_usermode_loop+0x224/0x300 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:266 [inline] do_syscall_64+0x65c/0x8c0 arch/x86/entry/common.c:292 entry_SYSCALL64_slow_path+0x25/0x25 RIP: 0033:0x4474f9 RSP: 002b:00007f960699ac08 EFLAGS: 00000282 ORIG_RAX: 0000000000000038 RAX: fffffffffffffdff RBX: 0000000000000000 RCX: 00000000004474f9 RDX: 0000000020f42000 RSI: 0000000020179000 RDI: 0000000000000000 RBP: 00000000007080b0 R08: 0000000020ef4ffc R09: 0000000000000000 R10: 0000000020a6bffc R11: 0000000000000282 R12: 00000000ffffffff R13: 0000000000000450 R14: 00000000006e3510 R15: 0000000020179000 Allocated by task 15898: 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 dup_userfaultfd+0x21c/0x890 fs/userfaultfd.c:653 dup_mmap kernel/fork.c:658 [inline] dup_mm kernel/fork.c:1179 [inline] copy_mm+0xa38/0x1310 kernel/fork.c:1233 copy_process.part.36+0x1eae/0x4af0 kernel/fork.c:1735 copy_process kernel/fork.c:1548 [inline] _do_fork+0x1ef/0xfe0 kernel/fork.c:2027 SYSC_clone kernel/fork.c:2137 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2131 do_syscall_64+0x26c/0x8c0 arch/x86/entry/common.c:287 return_from_SYSCALL_64+0x0/0x7a Freed by task 15898: 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 userfaultfd_ctx_put+0x50c/0x740 fs/userfaultfd.c:165 userfaultfd_event_wait_completion+0x754/0x910 fs/userfaultfd.c:599 dup_fctx fs/userfaultfd.c:687 [inline] dup_userfaultfd_complete+0x2de/0x480 fs/userfaultfd.c:695 dup_mmap kernel/fork.c:726 [inline] dup_mm kernel/fork.c:1179 [inline] copy_mm+0xe9b/0x1310 kernel/fork.c:1233 copy_process.part.36+0x1eae/0x4af0 kernel/fork.c:1735 copy_process kernel/fork.c:1548 [inline] _do_fork+0x1ef/0xfe0 kernel/fork.c:2027 SYSC_clone kernel/fork.c:2137 [inline] SyS_clone+0x37/0x50 kernel/fork.c:2131 do_syscall_64+0x26c/0x8c0 arch/x86/entry/common.c:287 return_from_SYSCALL_64+0x0/0x7a The buggy address belongs to the object at ffff88003cb9ac00 which belongs to the cache userfaultfd_ctx_cache of size 400 The buggy address is located 392 bytes inside of 400-byte region [ffff88003cb9ac00, ffff88003cb9ad90) The buggy address belongs to the page: page:ffffea0000f2e680 count:1 mapcount:0 mapping:ffff88003cb9a000 index:0xffff88003b046100 flags: 0x100000000000100(slab) raw: 0100000000000100 ffff88003cb9a000 ffff88003b046100 0000000100000008 raw: ffffea0000e8dbe0 ffff88003b827250 ffff88006bdb2c80 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88003cb9ac80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88003cb9ad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88003cb9ad80: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88003cb9ae00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88003cb9ae80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================