================================================================== BUG: KASAN: use-after-free in dev_map_notification+0x4db/0x5e0 kernel/bpf/devmap.c:406 Read of size 8 at addr ffff8801c3489a80 by task syz-executor1/6028 CPU: 0 PID: 6028 Comm: syz-executor1 Not tainted 4.13.0-rc4-next-20170811 #1 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+0x7f/0x260 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x24e/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 dev_map_notification+0x4db/0x5e0 kernel/bpf/devmap.c:406 notifier_call_chain+0x136/0x2c0 kernel/notifier.c:93 __raw_notifier_call_chain kernel/notifier.c:394 [inline] raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401 call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1671 call_netdevice_notifiers net/core/dev.c:1687 [inline] rollback_registered_many+0x91c/0xe80 net/core/dev.c:7140 rollback_registered+0x1be/0x3c0 net/core/dev.c:7182 unregister_netdevice_queue+0x2e3/0x5d0 net/core/dev.c:8170 unregister_netdevice include/linux/netdevice.h:2429 [inline] __tun_detach+0x1020/0x1390 drivers/net/tun.c:570 tun_detach drivers/net/tun.c:581 [inline] tun_chr_close+0x44/0x60 drivers/net/tun.c:2392 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:246 task_work_run+0x199/0x270 kernel/task_work.c:112 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x26d/0x2d0 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath+0x42f/0x500 arch/x86/entry/common.c:266 entry_SYSCALL_64_fastpath+0xbc/0xbe RIP: 0033:0x4512e9 RSP: 002b:00007fe383352c08 EFLAGS: 00000216 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000718000 RCX: 00000000004512e9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00000000000003c0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000216 R12: 00000000004dc552 R13: 00000000ffffffff R14: 0000000000000005 R15: 0000000000000000 Allocated by task 6025: 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+0xaa/0xd0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x108/0x700 mm/slab.c:3627 kmalloc include/linux/slab.h:493 [inline] kzalloc include/linux/slab.h:666 [inline] dev_map_alloc+0x201/0xa30 kernel/bpf/devmap.c:92 find_and_alloc_map kernel/bpf/syscall.c:100 [inline] map_create kernel/bpf/syscall.c:324 [inline] SYSC_bpf kernel/bpf/syscall.c:1422 [inline] SyS_bpf+0xe1b/0x46a0 kernel/bpf/syscall.c:1403 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 3247: 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+0x6e/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3503 [inline] kfree+0xd3/0x260 mm/slab.c:3820 dev_map_free+0x45a/0x5a0 kernel/bpf/devmap.c:192 bpf_map_free_deferred+0xac/0xd0 kernel/bpf/syscall.c:208 process_one_work+0xbf3/0x1bc0 kernel/workqueue.c:2098 worker_thread+0x223/0x1860 kernel/workqueue.c:2233 kthread+0x35e/0x430 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 The buggy address belongs to the object at ffff8801c3489a00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 128 bytes inside of 192-byte region [ffff8801c3489a00, ffff8801c3489ac0) The buggy address belongs to the page: page:ffffea00062b7df8 count:1 mapcount:0 mapping:ffff8801c3489000 index:0x0 flags: 0x200000000000100(slab) raw: 0200000000000100 ffff8801c3489000 0000000000000000 0000000100000010 raw: ffffea00063dfd98 ffffea00067d1a08 ffff8801dbc00000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c3489980: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801c3489a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c3489a80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff8801c3489b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c3489b80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================