================================================================== BUG: KASAN: use-after-free in dev_map_flush_old kernel/bpf/devmap.c:389 [inline] BUG: KASAN: use-after-free in __dev_map_entry_free+0x2a9/0x330 kernel/bpf/devmap.c:403 Read of size 8 at addr ffff88806c965dc8 by task syz-executor2/16914 CPU: 0 PID: 16914 Comm: syz-executor2 Not tainted 5.0.0-rc2+ #17 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1db/0x2d0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135 dev_map_flush_old kernel/bpf/devmap.c:389 [inline] __dev_map_entry_free+0x2a9/0x330 kernel/bpf/devmap.c:403 __rcu_reclaim kernel/rcu/rcu.h:240 [inline] rcu_do_batch kernel/rcu/tree.c:2452 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2773 [inline] rcu_process_callbacks+0xc4a/0x1680 kernel/rcu/tree.c:2754 __do_softirq+0x30b/0xb11 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1b7/0x760 arch/x86/kernel/apic/apic.c:1062 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807 RIP: 0010:write_comp_data+0x1e/0x70 kernel/kcov.c:122 Code: 48 89 34 d1 48 89 11 5d c3 0f 1f 00 65 4c 8b 04 25 40 ee 01 00 65 8b 05 20 eb 7f 7e a9 00 01 1f 00 75 51 41 8b 80 d8 12 00 00 <83> f8 03 75 45 49 8b 80 e0 12 00 00 45 8b 80 dc 12 00 00 4c 8b 08 RSP: 0018:ffff88808c41edf8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000002 RBX: ffff888054aae818 RCX: ffffffff87648ef9 RDX: 00000000000015a4 RSI: 00000000000015cc RDI: 0000000000000004 RBP: ffff88808c41ee00 R08: ffff888068b262c0 R09: 0000000000000004 R10: 0000000000000000 R11: ffff8880ae62dc7b R12: ffff888068a0b6d8 R13: 00000000000015a4 R14: dffffc0000000000 R15: 000000000000000c reg_copy_dfs_chan_state net/wireless/reg.c:2619 [inline] wiphy_share_dfs_chan_state net/wireless/reg.c:2646 [inline] wiphy_all_share_dfs_chan_state+0x379/0x5f0 net/wireless/reg.c:2661 wiphy_regulatory_register+0xb0/0x210 net/wireless/reg.c:3709 wiphy_register+0x1ae6/0x2760 net/wireless/core.c:882 ieee80211_register_hw+0x15e2/0x3f30 net/mac80211/main.c:1109 mac80211_hwsim_new_radio+0x2018/0x36b0 drivers/net/wireless/mac80211_hwsim.c:2921 hwsim_new_radio_nl+0xca6/0x1430 drivers/net/wireless/mac80211_hwsim.c:3469 genl_family_rcv_msg+0x80d/0x11a0 net/netlink/genetlink.c:601 genl_rcv_msg+0xca/0x16c net/netlink/genetlink.c:626 netlink_rcv_skb+0x17d/0x410 net/netlink/af_netlink.c:2477 genl_rcv+0x29/0x40 net/netlink/genetlink.c:637 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x574/0x770 net/netlink/af_netlink.c:1336 netlink_sendmsg+0xa05/0xf90 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xdd/0x130 net/socket.c:631 ___sys_sendmsg+0x7ec/0x910 net/socket.c:2116 __sys_sendmsg+0x112/0x270 net/socket.c:2154 __do_sys_sendmsg net/socket.c:2163 [inline] __se_sys_sendmsg net/socket.c:2161 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x458089 Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffb066d5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458089 RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000005 RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffb066d66d4 R13: 00000000004c55f4 R14: 00000000004d9328 R15: 00000000ffffffff Allocated by task 16887: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc mm/kasan/common.c:496 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:504 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3609 kmalloc include/linux/slab.h:545 [inline] kzalloc include/linux/slab.h:740 [inline] dev_map_alloc kernel/bpf/devmap.c:102 [inline] dev_map_alloc+0x205/0x800 kernel/bpf/devmap.c:88 find_and_alloc_map kernel/bpf/syscall.c:129 [inline] map_create kernel/bpf/syscall.c:510 [inline] __do_sys_bpf+0x6df/0x4410 kernel/bpf/syscall.c:2603 __se_sys_bpf kernel/bpf/syscall.c:2580 [inline] __x64_sys_bpf+0x73/0xb0 kernel/bpf/syscall.c:2580 do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 8162: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458 kasan_slab_free+0xe/0x10 mm/kasan/common.c:466 __cache_free mm/slab.c:3487 [inline] kfree+0xcf/0x230 mm/slab.c:3806 dev_map_free+0x522/0x6b0 kernel/bpf/devmap.c:192 bpf_map_free_deferred+0xba/0xf0 kernel/bpf/syscall.c:290 process_one_work+0xd0c/0x1ce0 kernel/workqueue.c:2153 worker_thread+0x143/0x14a0 kernel/workqueue.c:2296 kthread+0x357/0x430 kernel/kthread.c:246 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352 The buggy address belongs to the object at ffff88806c965cc0 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff88806c965cc0, ffff88806c965ec0) The buggy address belongs to the page: page:ffffea0001b25940 count:1 mapcount:0 mapping:ffff88812c3f0940 index:0x0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea000245dc88 ffffea0002141888 ffff88812c3f0940 raw: 0000000000000000 ffff88806c965040 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88806c965c80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ffff88806c965d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806c965d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806c965e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806c965e80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================