================================================================== 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 ffff88808e4df688 by task syz-executor.5/21873 CPU: 1 PID: 21873 Comm: syz-executor.5 Not tainted 5.0.0+ #60 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:PageHuge+0x6/0x170 mm/hugetlb.c:1338 Code: 04 00 eb 8a e8 ab 5e 04 00 e9 5e ff ff ff e8 a1 5e 04 00 e9 31 ff ff ff e8 97 5e 04 00 e9 01 ff ff ff 66 90 55 48 89 e5 41 55 <41> 54 53 48 89 fb e8 5f c5 cc ff 48 89 da 48 b8 00 00 00 00 00 fc RSP: 0018:ffff8880994476a0 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff815decc4 RDX: 1ffffd40004faf1f RSI: 0000000000000004 RDI: ffffea00027d78c0 RBP: ffff8880994476a8 R08: 1ffff11015d25bcf R09: ffffed1015d25bd0 R10: ffffed1015d25bcf R11: ffff8880ae92de7b R12: ffffea00027d78c0 R13: ffffea00027d78c8 R14: 0000000000000000 R15: dead000000000100 page_remove_file_rmap mm/rmap.c:1220 [inline] page_remove_rmap+0x545/0x12c0 mm/rmap.c:1302 zap_pte_range mm/memory.c:1090 [inline] zap_pmd_range mm/memory.c:1192 [inline] zap_pud_range mm/memory.c:1221 [inline] zap_p4d_range mm/memory.c:1242 [inline] unmap_page_range+0xd70/0x2330 mm/memory.c:1263 unmap_single_vma+0x19d/0x300 mm/memory.c:1308 unmap_vmas+0x115/0x250 mm/memory.c:1339 exit_mmap+0x2c2/0x530 mm/mmap.c:3139 __mmput kernel/fork.c:1047 [inline] mmput+0x15f/0x4c0 kernel/fork.c:1068 exit_mm kernel/exit.c:545 [inline] do_exit+0x838/0x2fd0 kernel/exit.c:862 do_group_exit+0x135/0x370 kernel/exit.c:979 get_signal+0x399/0x1d50 kernel/signal.c:2575 do_signal+0x87/0x1940 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x458079 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:00007f1bf1049cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 000000000073bfa8 RCX: 0000000000458079 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000073bfa8 RBP: 000000000073bfa0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000073bfac R13: 00007ffc7267d26f R14: 00007f1bf104a9c0 R15: 000000000073bfac Allocated by task 21857: save_stack+0x45/0xd0 mm/kasan/common.c:73 set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc mm/kasan/common.c:495 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:468 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:509 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3615 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/0x3eb0 kernel/bpf/syscall.c:2685 __se_sys_bpf kernel/bpf/syscall.c:2662 [inline] __x64_sys_bpf+0x73/0xb0 kernel/bpf/syscall.c:2662 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 5: 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:457 kasan_slab_free+0xe/0x10 mm/kasan/common.c:465 __cache_free mm/slab.c:3494 [inline] kfree+0xcf/0x230 mm/slab.c:3811 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/0x1790 kernel/workqueue.c:2173 worker_thread+0x98/0xe40 kernel/workqueue.c:2319 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 ffff88808e4df580 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff88808e4df580, ffff88808e4df780) The buggy address belongs to the page: page:ffffea00023937c0 count:1 mapcount:0 mapping:ffff88812c3f0940 index:0xffff88808e4df800 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea0002463448 ffffea000295b088 ffff88812c3f0940 raw: ffff88808e4df800 ffff88808e4df080 0000000100000005 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808e4df580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88808e4df600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88808e4df680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88808e4df700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88808e4df780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================