================================================================== BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5882 [inline] BUG: KASAN: use-after-free in perf_output_read+0xedc/0x1050 kernel/events/core.c:5917 Read of size 8 at addr ffff8881d73cf508 by task syz-executor.1/6593 CPU: 1 PID: 6593 Comm: syz-executor.1 Not tainted 4.14.151+ #0 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xca/0x134 lib/dump_stack.c:53 print_address_description+0x60/0x226 mm/kasan/report.c:187 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316 perf_output_read_group kernel/events/core.c:5882 [inline] perf_output_read+0xedc/0x1050 kernel/events/core.c:5917 perf_output_sample+0xcea/0x1700 kernel/events/core.c:5959 __perf_event_output kernel/events/core.c:6269 [inline] perf_event_output_backward+0x10b/0x220 kernel/events/core.c:6290 __perf_event_overflow+0x12d/0x340 kernel/events/core.c:7520 perf_swevent_overflow+0x7a/0xf0 kernel/events/core.c:7596 perf_swevent_event+0x19c/0x270 kernel/events/core.c:7629 do_perf_sw_event kernel/events/core.c:7737 [inline] ___perf_sw_event+0x2a4/0x4a0 kernel/events/core.c:7768 __perf_sw_event+0x42/0x80 kernel/events/core.c:7780 perf_sw_event include/linux/perf_event.h:1046 [inline] __do_page_fault+0x7b8/0xbb0 arch/x86/mm/fault.c:1461 page_fault+0x22/0x50 arch/x86/entry/entry_64.S:1122 RIP: 0010:copy_user_enhanced_fast_string+0x7/0x10 arch/x86/lib/copy_user_64.S:181 RSP: 0018:ffff8881d389fb30 EFLAGS: 00010206 RAX: 0000000000000000 RBX: 0000000000001000 RCX: 0000000000001000 RDX: 0000000000001000 RSI: ffff88806d624000 RDI: 0000000020377000 RBP: 0000000020377000 R08: ffffed100dac4a00 R09: 0000000000000000 R10: ffffed100dac49ff R11: ffff88806d624fff R12: ffff88806d624000 R13: 00007ffffffff000 R14: 0000000020378000 R15: ffff8881d389fd10 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_to_user arch/x86/include/asm/uaccess_64.h:112 [inline] copyout+0x99/0xc0 lib/iov_iter.c:137 copy_page_to_iter_iovec lib/iov_iter.c:206 [inline] copy_page_to_iter+0x367/0xd50 lib/iov_iter.c:723 shmem_file_read_iter+0x35c/0xa10 mm/shmem.c:2560 call_read_iter include/linux/fs.h:1792 [inline] new_sync_read fs/read_write.c:401 [inline] __vfs_read+0x3fe/0x590 fs/read_write.c:413 vfs_read+0x131/0x330 fs/read_write.c:447 SYSC_read fs/read_write.c:578 [inline] SyS_read+0x102/0x250 fs/read_write.c:571 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x459f49 RSP: 002b:00007f23e36acc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459f49 RDX: 00000000fffffe4c RSI: 0000000020000000 RDI: 000000000000000d RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f23e36ad6d4 R13: 00000000004c6629 R14: 00000000004dd4e0 R15: 00000000ffffffff Allocated by task 6593: save_stack mm/kasan/common.c:76 [inline] set_track mm/kasan/common.c:85 [inline] __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:501 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] alloc_pipe_info+0xb8/0x390 fs/pipe.c:647 get_pipe_inode fs/pipe.c:726 [inline] create_pipe_files+0xd4/0x8b0 fs/pipe.c:759 __do_pipe_flags+0x30/0x210 fs/pipe.c:816 SYSC_pipe2 fs/pipe.c:864 [inline] SyS_pipe2+0x76/0x150 fs/pipe.c:858 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff Freed by task 6593: save_stack mm/kasan/common.c:76 [inline] set_track mm/kasan/common.c:85 [inline] __kasan_slab_free+0x164/0x210 mm/kasan/common.c:463 slab_free_hook mm/slub.c:1407 [inline] slab_free_freelist_hook mm/slub.c:1458 [inline] slab_free mm/slub.c:3039 [inline] kfree+0x108/0x3a0 mm/slub.c:3976 put_pipe_info+0xa8/0xc0 fs/pipe.c:575 pipe_release+0x1a6/0x240 fs/pipe.c:596 __fput+0x25e/0x710 fs/file_table.c:210 task_work_run+0x125/0x1a0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x13b/0x160 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x3a3/0x520 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff The buggy address belongs to the object at ffff8881d73cf400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 264 bytes inside of 512-byte region [ffff8881d73cf400, ffff8881d73cf600) The buggy address belongs to the page: page:ffffea00075cf380 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 0000000000000000 0000000000000000 00000001000c000c raw: ffffea0007462480 0000000700000007 ffff8881da802c00 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d73cf400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d73cf480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881d73cf500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d73cf580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d73cf600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================