================================================================== BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5868 [inline] BUG: KASAN: use-after-free in perf_output_read+0xe4d/0xfb0 kernel/events/core.c:5903 Read of size 8 at addr ffff8801d399da08 by task syz-executor4/14774 CPU: 0 PID: 14774 Comm: syz-executor4 Not tainted 4.14.75+ #18 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xb9/0x11b lib/dump_stack.c:53 print_address_description+0x60/0x22b mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409 perf_output_read_group kernel/events/core.c:5868 [inline] perf_output_read+0xe4d/0xfb0 kernel/events/core.c:5903 perf_output_sample+0x10dd/0x1780 kernel/events/core.c:5945 __perf_event_output kernel/events/core.c:6255 [inline] perf_event_output_forward+0x121/0x230 kernel/events/core.c:6268 __perf_event_overflow+0x116/0x320 kernel/events/core.c:7504 perf_swevent_overflow+0x166/0x1f0 kernel/events/core.c:7580 perf_swevent_event+0x19c/0x270 kernel/events/core.c:7613 do_perf_sw_event kernel/events/core.c:7721 [inline] ___perf_sw_event+0x296/0x480 kernel/events/core.c:7752 __perf_sw_event+0x3f/0x70 kernel/events/core.c:7764 perf_sw_event include/linux/perf_event.h:1041 [inline] __do_page_fault+0x77f/0xb60 arch/x86/mm/fault.c:1466 page_fault+0x22/0x50 arch/x86/entry/entry_64.S:1104 RIP: 0010:fault_in_pages_readable include/linux/pagemap.h:613 [inline] RIP: 0010:iov_iter_fault_in_readable+0x2b9/0x370 lib/iov_iter.c:421 RSP: 0018:ffff8801930af9f8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 000000000000007f RCX: 0000000000040000 RDX: ffffffff81b56173 RSI: ffffc90004b9c000 RDI: ffff8801930afcf8 RBP: 1ffff10032615f40 R08: 0000000000001000 R09: ffffea0005d058c0 R10: ffffffff9f87e3a0 R11: ffff880174163fff R12: 0000000000000000 R13: 000000002027553f R14: 0000000000001000 R15: ffff8801930afcf0 generic_perform_write+0x166/0x430 mm/filemap.c:3027 __generic_file_write_iter+0x345/0x540 mm/filemap.c:3162 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3190 call_write_iter include/linux/fs.h:1782 [inline] new_sync_write fs/read_write.c:471 [inline] __vfs_write+0x417/0x5c0 fs/read_write.c:484 vfs_write+0x17f/0x4d0 fs/read_write.c:546 SYSC_write fs/read_write.c:593 [inline] SyS_write+0xc2/0x1a0 fs/read_write.c:585 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x457579 RSP: 002b:00007f6d5a210c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457579 RDX: 00000000fffffda2 RSI: 0000000020000540 RDI: 0000000000000007 RBP: 000000000072bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6d5a2116d4 R13: 00000000004c554e R14: 00000000004d8e68 R15: 00000000ffffffff Allocated by task 13824: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x138/0x300 mm/slub.c:2750 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] trie_alloc+0x19d/0x5f0 kernel/bpf/lpm_trie.c:431 find_and_alloc_map kernel/bpf/syscall.c:102 [inline] map_create kernel/bpf/syscall.c:378 [inline] SYSC_bpf kernel/bpf/syscall.c:1570 [inline] SyS_bpf+0x8ec/0x3640 kernel/bpf/syscall.c:1547 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 4514: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1389 [inline] slab_free_freelist_hook mm/slub.c:1410 [inline] slab_free mm/slub.c:2966 [inline] kfree+0xf5/0x310 mm/slub.c:3897 process_one_work+0x86e/0x15c0 kernel/workqueue.c:2114 worker_thread+0xdc/0x1000 kernel/workqueue.c:2248 kthread+0x348/0x420 kernel/kthread.c:232 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:402 The buggy address belongs to the object at ffff8801d399d900 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff8801d399d900, ffff8801d399db00) The buggy address belongs to the page: page:ffffea00074e6700 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000008100(slab|head) raw: 4000000000008100 0000000000000000 0000000000000000 00000001000c000c raw: dead000000000100 dead000000000200 ffff8801da802c00 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801d399d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d399d980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801d399da00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801d399da80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801d399db00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================