================================================================== BUG: KASAN: use-after-free in dev_map_notification+0x5d5/0x5e0 kernel/bpf/devmap.c:403 Read of size 4 at addr ffff88003ca6b910 by task syz-executor2/7506 CPU: 0 PID: 7506 Comm: syz-executor2 Not tainted 4.13.0-rc4-next-20170811 #2 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 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429 dev_map_notification+0x5d5/0x5e0 kernel/bpf/devmap.c:403 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 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xa52/0x1b30 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:968 get_signal+0x7e8/0x17e0 kernel/signal.c:2330 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+0x42f/0x500 arch/x86/entry/common.c:266 entry_SYSCALL_64_fastpath+0xbc/0xbe RIP: 0033:0x446739 RSP: 002b:00007f4b90688c08 EFLAGS: 00000282 ORIG_RAX: 0000000000000010 RAX: 0000000000000000 RBX: 000000000000001c RCX: 0000000000446739 RDX: 00000000204c8fd8 RSI: 00000000400454ca RDI: 000000000000001c RBP: 0000000000708000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000282 R12: 00000000ffffffff R13: 0000000000002d00 R14: 00000000006e4dc0 R15: 00000000400454ca Allocated by task 7516: 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 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627 kzalloc include/linux/slab.h:493 [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 797: 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] kfree+0xca/0x250 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 ffff88003ca6b900 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 16 bytes inside of 192-byte region [ffff88003ca6b900, ffff88003ca6b9c0) The buggy address belongs to the page: page:ffffea0000f29ac0 count:1 mapcount:0 mapping:ffff88003ca6b000 index:0x0 flags: 0x100000000000100(slab) raw: 0100000000000100 ffff88003ca6b000 0000000000000000 0000000100000010 raw: ffffea0000f769e0 ffffea0000f2dca0 ffff88003e800040 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88003ca6b800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88003ca6b880: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88003ca6b900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88003ca6b980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88003ca6ba00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================