syzbot


KASAN: use-after-free Write in _free_event

Status: auto-closed as invalid on 2020/01/26 08:58
Reported-by: syzbot+672b9572a3ebe193b4b1@syzkaller.appspotmail.com
First crash: 1900d, last: 1893d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in _free_event perf C 112 2102d 2340d 12/28 fixed on 2019/08/14 02:14

Sample crash report:
audit: type=1800 audit(1569661025.743:65): pid=31867 uid=0 auid=4294967295 ses=4294967295 subj=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 op=collect_data cause=failed comm="syz-executor.4" name="bus" dev="sda1" ino=17425 res=0
==================================================================
BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [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+0x39b/0x1220 kernel/events/core.c:4460
Write of size 4 at addr ffff88804d35e260 by task syz-executor.0/31862

CPU: 0 PID: 31862 Comm: syz-executor.0 Not tainted 4.19.75 #0
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:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 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:259 [inline]
 put_task_struct include/linux/sched/task.h:95 [inline]
 _free_event+0x39b/0x1220 kernel/events/core.c:4460
 put_event+0x47/0x60 kernel/events/core.c:4547
 perf_event_release_kernel+0x6d1/0xd80 kernel/events/core.c:4662
 perf_release+0x37/0x50 kernel/events/core.c:4672
 __fput+0x2dd/0x8b0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x994/0x2fa0 kernel/exit.c:876
 do_group_exit+0x135/0x370 kernel/exit.c:979
 __do_sys_exit_group kernel/exit.c:990 [inline]
 __se_sys_exit_group kernel/exit.c:988 [inline]
 __x64_sys_exit_group+0x44/0x50 kernel/exit.c:988
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459a29
Code: fd b7 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffa999fe78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000000000000000b RCX: 0000000000459a29
RDX: 0000000000413651 RSI: 0000000000a74ef0 RDI: 0000000000000000
RBP: 00000000004bf121 R08: 000000000000000c R09: 00007fffa999ff80
R10: 00005555564a9940 R11: 0000000000000246 R12: 000000000075bfc8
R13: 0000000000000002 R14: 0000000000000001 R15: 000000000075bfd4

Allocated by task 31862:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc_node+0x144/0x710 mm/slab.c:3649
 alloc_task_struct_node kernel/fork.c:157 [inline]
 dup_task_struct kernel/fork.c:802 [inline]
 copy_process.part.0+0x1ce0/0x7a30 kernel/fork.c:1732
 copy_process kernel/fork.c:1689 [inline]
 _do_fork+0x257/0xfd0 kernel/fork.c:2202
 __do_sys_clone kernel/fork.c:2309 [inline]
 __se_sys_clone kernel/fork.c:2303 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2303
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31867:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3765
 free_task_struct kernel/fork.c:162 [inline]
 free_task+0xdd/0x120 kernel/fork.c:416
 __put_task_struct+0x20f/0x4c0 kernel/fork.c:689
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0x1fb/0x350 kernel/exit.c:181
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2584 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
 rcu_process_callbacks+0xba0/0x1a30 kernel/rcu/tree.c:2881
 __do_softirq+0x25c/0x921 kernel/softirq.c:292

The buggy address belongs to the object at ffff88804d35e240
 which belongs to the cache task_struct(17:syz0) of size 6080
The buggy address is located 32 bytes inside of
 6080-byte region [ffff88804d35e240, ffff88804d35fa00)
The buggy address belongs to the page:
page:ffffea000134d780 count:1 mapcount:0 mapping:ffff888092e0eb00 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea000151d988 ffffea00022ac288 ffff888092e0eb00
raw: 0000000000000000 ffff88804d35e240 0000000100000001 ffff88805870e300
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff88805870e300

Memory state around the buggy address:
 ffff88804d35e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88804d35e180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88804d35e200: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                       ^
 ffff88804d35e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804d35e300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/28 08:57 linux-4.19.y d573e8a79f70 d8074e0b .config console log report ci2-linux-4-19
2019/09/27 11:36 linux-4.19.y d573e8a79f70 2f1548bc .config console log report ci2-linux-4-19
2019/09/24 01:34 linux-4.19.y d573e8a79f70 c68252d2 .config console log report ci2-linux-4-19
2019/09/22 02:31 linux-4.19.y d573e8a79f70 d96e88f3 .config console log report ci2-linux-4-19
2019/09/22 00:02 linux-4.19.y d573e8a79f70 d96e88f3 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.