================================================================== BUG: KASAN: use-after-free in perf_output_read_group kernel/events/core.c:5883 [inline] BUG: KASAN: use-after-free in perf_output_read+0xee6/0x1050 kernel/events/core.c:5918 Read of size 8 at addr ffff8881d3b5a7e0 by task syz-executor.5/6667 CPU: 1 PID: 6667 Comm: syz-executor.5 Not tainted 4.14.156-syzkaller #0 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0xe5/0x154 lib/dump_stack.c:58 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:5883 [inline] perf_output_read+0xee6/0x1050 kernel/events/core.c:5918 perf_output_sample+0xcea/0x1700 kernel/events/core.c:5960 __perf_event_output kernel/events/core.c:6270 [inline] perf_event_output_backward+0x10b/0x220 kernel/events/core.c:6291 __perf_event_overflow+0x12d/0x340 kernel/events/core.c:7541 perf_swevent_overflow+0x7a/0xf0 kernel/events/core.c:7617 perf_swevent_event+0x19c/0x270 kernel/events/core.c:7650 do_perf_sw_event kernel/events/core.c:7758 [inline] ___perf_sw_event+0x2a4/0x4a0 kernel/events/core.c:7789 __perf_sw_event+0x42/0x80 kernel/events/core.c:7801 perf_sw_event include/linux/perf_event.h:1051 [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:ffff8881d24ffb90 EFLAGS: 00010206 RAX: 0000000000000000 RBX: 0000000000001000 RCX: 00000000000000c0 RDX: 0000000000001000 RSI: ffff8881c7b4cf40 RDI: 000000002049d000 RBP: ffff8881c7b4c000 R08: ffffed1038f69a00 R09: 0000000000000000 R10: ffffed1038f699ff R11: ffff8881c7b4cfff R12: 000000002049c0c0 R13: 00007ffffffff000 R14: 000000002049d0c0 R15: 0000000000001000 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] _copy_to_user+0xaa/0xd0 lib/usercopy.c:28 copy_to_user include/linux/uaccess.h:155 [inline] mem_rw.isra.0+0x1fe/0x2d0 fs/proc/base.c:859 do_loop_readv_writev fs/read_write.c:699 [inline] do_loop_readv_writev fs/read_write.c:686 [inline] do_iter_read+0x3e8/0x5b0 fs/read_write.c:923 vfs_readv+0xe6/0x150 fs/read_write.c:985 do_preadv+0x189/0x230 fs/read_write.c:1069 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45a649 RSP: 002b:00007f44101a2c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 000000000045a649 RDX: 0000000000000001 RSI: 0000000020000180 RDI: 0000000000000007 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 000000002000107c R11: 0000000000000246 R12: 00007f44101a36d4 R13: 00000000004c8070 R14: 00000000004de1d8 R15: 00000000ffffffff Allocated by task 5577: 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] fsnotify_alloc_group+0x41/0x2f0 fs/notify/group.c:129 inotify_new_group fs/notify/inotify/inotify_user.c:605 [inline] SYSC_inotify_init1 fs/notify/inotify/inotify_user.c:651 [inline] SyS_inotify_init1+0x37/0x470 fs/notify/inotify/inotify_user.c:638 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 0xffffffffffffffff Freed by task 5572: 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 fsnotify_final_destroy_group fs/notify/group.c:39 [inline] fsnotify_put_group+0x86/0xa0 fs/notify/group.c:119 fsnotify_destroy_group+0x1c7/0x2f0 fs/notify/group.c:102 inotify_release+0x33/0x40 fs/notify/inotify/inotify_user.c:280 __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 ffff8881d3b5a780 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 96 bytes inside of 512-byte region [ffff8881d3b5a780, ffff8881d3b5a980) The buggy address belongs to the page: page:ffffea00074ed680 count:1 mapcount:0 mapping: (null) index:0xffff8881d3b5ac80 compound_mapcount: 0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 0000000000000000 ffff8881d3b5ac80 00000001000c0009 raw: ffffea00072cb320 ffffea00072661a0 ffff8881da802c00 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d3b5a680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881d3b5a700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881d3b5a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d3b5a800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d3b5a880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================