================================================================== BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:222 [inline] BUG: KASAN: use-after-free in put_task_struct include/linux/sched/task.h:95 [inline] BUG: KASAN: use-after-free in _free_event+0x48d/0x1440 kernel/events/core.c:4451 Write of size 4 at addr ffff8801948e6720 by task syz-executor6/10444 CPU: 1 PID: 10444 Comm: syz-executor6 Not tainted 4.18.0-rc4+ #50 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+0x1c9/0x2b4 lib/dump_stack.c:113 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278 atomic_dec_and_test include/asm-generic/atomic-instrumented.h:222 [inline] put_task_struct include/linux/sched/task.h:95 [inline] _free_event+0x48d/0x1440 kernel/events/core.c:4451 free_event+0xb4/0x180 kernel/events/core.c:4472 perf_event_release_kernel+0x7d5/0x1050 kernel/events/core.c:4633 perf_release+0x37/0x50 kernel/events/core.c:4647 __fput+0x355/0x8b0 fs/file_table.c:209 ____fput+0x15/0x20 fs/file_table.c:243 task_work_run+0x1ec/0x2a0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:192 [inline] exit_to_usermode_loop+0x313/0x370 arch/x86/entry/common.c:166 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_32_irqs_on arch/x86/entry/common.c:341 [inline] do_fast_syscall_32+0xcd5/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f27cb9 Code: 55 08 8b 88 64 cd ff ff 8b 98 68 cd ff ff 89 c8 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 1c 24 c3 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:000000000845eacc EFLAGS: 00000216 ORIG_RAX: 0000000000000006 RAX: 0000000000000000 RBX: 0000000000000017 RCX: 0000000000000000 RDX: 0000000000000018 RSI: 000000000845eb1c RDI: 000000000845f7ac RBP: 000000000845f188 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10447: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490 kmem_cache_alloc_node+0x144/0x780 mm/slab.c:3644 alloc_task_struct_node kernel/fork.c:157 [inline] dup_task_struct kernel/fork.c:779 [inline] copy_process.part.39+0x16b5/0x7220 kernel/fork.c:1641 copy_process kernel/fork.c:1616 [inline] _do_fork+0x291/0x12a0 kernel/fork.c:2099 __do_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:240 [inline] __se_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:236 [inline] __ia32_compat_sys_x86_clone+0xbc/0x140 arch/x86/ia32/sys_ia32.c:236 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 Freed by task 10447: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kmem_cache_free+0x86/0x2d0 mm/slab.c:3756 free_task_struct kernel/fork.c:162 [inline] free_task+0x16e/0x1f0 kernel/fork.c:390 copy_process.part.39+0x15c9/0x7220 kernel/fork.c:2034 copy_process kernel/fork.c:1616 [inline] _do_fork+0x291/0x12a0 kernel/fork.c:2099 __do_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:240 [inline] __se_compat_sys_x86_clone arch/x86/ia32/sys_ia32.c:236 [inline] __ia32_compat_sys_x86_clone+0xbc/0x140 arch/x86/ia32/sys_ia32.c:236 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 The buggy address belongs to the object at ffff8801948e6700 which belongs to the cache task_struct(65:syz6) of size 5952 The buggy address is located 32 bytes inside of 5952-byte region [ffff8801948e6700, ffff8801948e7e40) The buggy address belongs to the page: page:ffffea0006523980 count:1 mapcount:0 mapping:ffff8801b0500900 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffffea0006ac5088 ffff8801aae1de48 ffff8801b0500900 raw: 0000000000000000 ffff8801948e6700 0000000100000001 ffff8801b85323c0 page dumped because: kasan: bad access detected page->mem_cgroup:ffff8801b85323c0 Memory state around the buggy address: ffff8801948e6600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801948e6680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801948e6700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801948e6780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801948e6800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================