==================================================================
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 ffff88808cb18e08 by task syz-executor.0/9359
CPU: 1 PID: 9359 Comm: syz-executor.0 Not tainted 5.0.0-rc4+ #34
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+0x172/0x1f0 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+0x928/0x1390 kernel/rcu/tree.c:2754
__do_softirq+0x266/0x95a 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+0x14a/0x570 arch/x86/kernel/apic/apic.c:1062
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807
RIP: 0010:vsnprintf+0x1c7/0x19b0 lib/vsprintf.c:2459
Code: 4c 89 85 68 ff ff ff e8 77 39 6f fa 41 80 fe 07 4c 8b 85 68 ff ff ff 0f 87 a2 09 00 00 4a 8b 04 c5 b8 fb 1d 88 e9 99 b4 3f 00 94 37 6f fa 44 89 e6 bf 2f 00 00 00 e8 07 39 6f fa 41 83 fc 2f
RSP: 0018:ffff8880649ff728 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13
RAX: ffffffff8700a417 RBX: ffffffff88004c65 RCX: ffffffff8700adfe
RDX: 000000000000000f RSI: 0000000000000012 RDI: 0000000000000001
RBP: ffff8880649ff800 R08: ffff8880a0212380 R09: ffffed10149d6929
R10: ffffed10149d6928 R11: 0000000000000002 R12: 0000000000000020
R13: ffff8880a4eb4943 R14: 000000000000000f R15: ffff8880649ff7d8
kvasprintf+0xea/0x170 lib/kasprintf.c:29
kvasprintf_const+0x65/0x190 lib/kasprintf.c:49
kobject_set_name_vargs+0x5b/0x150 lib/kobject.c:281
kobject_add_varg lib/kobject.c:376 [inline]
kobject_init_and_add+0xc9/0x160 lib/kobject.c:453
rx_queue_add_kobject net/core/net-sysfs.c:926 [inline]
net_rx_queue_update_kobjects+0x1c2/0x4a0 net/core/net-sysfs.c:958
register_queue_kobjects net/core/net-sysfs.c:1529 [inline]
netdev_register_kobject+0x28c/0x390 net/core/net-sysfs.c:1749
register_netdevice+0x878/0xff0 net/core/dev.c:8692
tun_set_iff drivers/net/tun.c:2836 [inline]
__tun_chr_ioctl+0x2cf0/0x3e50 drivers/net/tun.c:3070
tun_chr_ioctl+0x2b/0x40 drivers/net/tun.c:3342
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696
ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457e39
Code: ad b8 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 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb863003c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457e39
RDX: 0000000020000300 RSI: 00000000400454ca RDI: 0000000000000005
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb8630046d4
R13: 00000000004c22da R14: 00000000004d4c20 R15: 00000000ffffffff
Allocated by task 9366:
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+0x1be/0x6e0 kernel/bpf/devmap.c:88
find_and_alloc_map kernel/bpf/syscall.c:129 [inline]
map_create kernel/bpf/syscall.c:526 [inline]
__do_sys_bpf+0x97b/0x3ea0 kernel/bpf/syscall.c:2642
__se_sys_bpf kernel/bpf/syscall.c:2619 [inline]
__x64_sys_bpf+0x73/0xb0 kernel/bpf/syscall.c:2619
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 7721:
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+0x43c/0x540 kernel/bpf/devmap.c:192
bpf_map_free_deferred+0xba/0xf0 kernel/bpf/syscall.c:290
process_one_work+0x98e/0x1760 kernel/workqueue.c:2153
worker_thread+0x98/0xe40 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 ffff88808cb18d00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 264 bytes inside of
512-byte region [ffff88808cb18d00, ffff88808cb18f00)
The buggy address belongs to the page:
page:ffffea000232c600 count:1 mapcount:0 mapping:ffff88812c3f0940 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea0002a57708 ffffea0002a46d88 ffff88812c3f0940
raw: 0000000000000000 ffff88808cb18080 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff88808cb18d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808cb18d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808cb18e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88808cb18e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88808cb18f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================