syzbot


KASAN: use-after-free Read in uprobe_perf_close

Status: fixed on 2019/11/11 16:48
Subsystems: trace
[Documentation on labels]
Reported-by: syzbot+cef9473c7fa0fe8ab95e@syzkaller.appspotmail.com
Fix commit: 621b6d2ea297 perf/core: Fix use-after-free in uprobe_perf_close()
First crash: 2426d, last: 2107d
Fix bisection: fixed by (bisect log) :
commit 621b6d2ea297d0fb6030452c5bcd221f12165fcf
Author: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Date: Mon Apr 9 10:03:46 2018 +0000

  perf/core: Fix use-after-free in uprobe_perf_close()

  
Discussions (3)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in uprobe_perf_close 0 (2) 2019/11/07 13:42
Reminder: 19 open syzbot bugs in perf subsystem 2 (2) 2019/07/24 13:22
Reminder: 22 open syzbot bugs in perf subsystem 7 (7) 2019/07/03 11:34

Sample crash report:
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in uprobe_perf_close+0x45e/0x5f0 kernel/trace/trace_uprobe.c:1033
Read of size 4 at addr ffff8801acc867a4 by task syzkaller802591/4475

CPU: 0 PID: 4475 Comm: syzkaller802591 Not tainted 4.16.0+ #3
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+0x1b9/0x294 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
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 uprobe_perf_close+0x45e/0x5f0 kernel/trace/trace_uprobe.c:1033
 trace_uprobe_register+0x355/0xcd0 kernel/trace/trace_uprobe.c:1195
 perf_trace_event_close kernel/trace/trace_event_perf.c:186 [inline]
 perf_uprobe_destroy+0xa0/0x130 kernel/trace/trace_event_perf.c:335
 _free_event+0x3ff/0x13b0 kernel/events/core.c:4445
 put_event+0x48/0x60 kernel/events/core.c:4528
 perf_event_release_kernel+0x8bd/0xf90 kernel/events/core.c:4634
 perf_release+0x37/0x50 kernel/events/core.c:4644
 __fput+0x34d/0x890 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xf89/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 SYSC_exit_group kernel/exit.c:979 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:977
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x445c39
RSP: 002b:00007ffc11b5b758 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00000000006dbc20 RCX: 0000000000445c39
RDX: 0000000000445c39 RSI: 0000000000000001 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000002
R13: 00000000006dbc24 R14: 0000000000000001 R15: 0000000000002710

Allocated by task 4475:
 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:772 [inline]
 copy_process.part.38+0x16bf/0x6e90 kernel/fork.c:1633
 copy_process kernel/fork.c:1608 [inline]
 _do_fork+0x291/0x12a0 kernel/fork.c:2089
 SYSC_clone kernel/fork.c:2196 [inline]
 SyS_clone+0x37/0x50 kernel/fork.c:2190
 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 0:
 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+0x166/0x1d0 kernel/fork.c:391
 __put_task_struct+0x2d2/0x600 kernel/fork.c:659
 put_task_struct include/linux/sched/task.h:96 [inline]
 delayed_put_task_struct+0x367/0x470 kernel/exit.c:180
 __rcu_reclaim kernel/rcu/rcu.h:178 [inline]
 rcu_do_batch kernel/rcu/tree.c:2675 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2930 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2897 [inline]
 rcu_process_callbacks+0x941/0x15f0 kernel/rcu/tree.c:2914
 __do_softirq+0x2e0/0xaf5 kernel/softirq.c:285

The buggy address belongs to the object at ffff8801acc86780
 which belongs to the cache task_struct of size 5952
The buggy address is located 36 bytes inside of
 5952-byte region [ffff8801acc86780, ffff8801acc87ec0)
The buggy address belongs to the page:
page:ffffea0006b32180 count:1 mapcount:0 mapping:ffff8801acc86780 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801acc86780 0000000000000000 0000000100000001
raw: ffffea0006b2c220 ffff8801dad0e248 ffff8801dad48200 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801acc86680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801acc86700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801acc86780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff8801acc86800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801acc86880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (54):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/15 07:09 upstream 18b7fd1c93e5 7a67784c .config console log report syz C ci-upstream-kasan-gce-root
2018/04/14 10:00 upstream 1bad9ce155a7 7a67784c .config console log report syz C ci-upstream-kasan-gce-root
2018/04/03 02:17 upstream 86bbbebac193 676bd07e .config console log report syz C ci-upstream-kasan-gce
2018/04/03 02:00 upstream 86bbbebac193 676bd07e .config console log report syz C ci-upstream-kasan-gce-root
2018/04/03 01:34 upstream 86bbbebac193 676bd07e .config console log report syz C ci-upstream-kasan-gce-386
2019/02/15 20:10 linux-next 7a92eb7cc1dc f6f233c0 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/08/15 08:08 upstream d0055f351e64 0e6dcb88 .config console log report ci-upstream-kasan-gce-root
2018/04/15 20:11 upstream 18b7fd1c93e5 7a67784c .config console log report ci-upstream-kasan-gce-root
2018/04/15 15:14 upstream 18b7fd1c93e5 7a67784c .config console log report ci-upstream-kasan-gce-root
2018/04/15 06:19 upstream 18b7fd1c93e5 7a67784c .config console log report ci-upstream-kasan-gce-root
2018/04/15 01:24 upstream 18b7fd1c93e5 7a67784c .config console log report ci-upstream-kasan-gce
2018/04/14 20:27 upstream 48023102b707 7a67784c .config console log report ci-upstream-kasan-gce
2018/04/14 15:04 upstream 48023102b707 7a67784c .config console log report ci-upstream-kasan-gce-root
2018/04/14 02:40 upstream 1bad9ce155a7 7a67784c .config console log report ci-upstream-kasan-gce-root
2018/04/13 19:07 upstream 16e205cf42da 0a0c5db6 .config console log report ci-upstream-kasan-gce-root
2018/04/13 17:25 upstream 16e205cf42da 0a0c5db6 .config console log report ci-upstream-kasan-gce-root
2018/04/12 11:00 upstream b284d4d5a678 9cd56d71 .config console log report ci-upstream-kasan-gce-root
2018/04/12 05:11 upstream b284d4d5a678 9cd56d71 .config console log report ci-upstream-kasan-gce-root
2018/04/12 03:50 upstream b284d4d5a678 9cd56d71 .config console log report ci-upstream-kasan-gce-root
2018/04/12 02:43 upstream b284d4d5a678 9cd56d71 .config console log report ci-upstream-kasan-gce
2018/04/11 12:10 upstream b284d4d5a678 8b8de427 .config console log report ci-upstream-kasan-gce
2018/04/11 12:05 upstream b284d4d5a678 8b8de427 .config console log report ci-upstream-kasan-gce-root
2018/04/11 11:26 upstream b284d4d5a678 8b8de427 .config console log report ci-upstream-kasan-gce
2018/04/11 10:33 upstream b284d4d5a678 8b8de427 .config console log report ci-upstream-kasan-gce-root
2018/04/11 07:48 upstream c18bb396d3d2 8b8de427 .config console log report ci-upstream-kasan-gce-root
2018/04/10 23:19 upstream c18bb396d3d2 8b8de427 .config console log report ci-upstream-kasan-gce
2018/04/09 13:37 upstream 3fd14cdcc05a f13fb445 .config console log report ci-upstream-kasan-gce-root
2018/04/09 00:33 upstream 3fd14cdcc05a 77bd5117 .config console log report ci-upstream-kasan-gce-root
2018/04/08 23:00 upstream 3fd14cdcc05a 77bd5117 .config console log report ci-upstream-kasan-gce
2018/04/07 14:52 upstream 3fd14cdcc05a 66f22a7f .config console log report ci-upstream-kasan-gce-root
2018/04/07 13:33 upstream 3fd14cdcc05a 66f22a7f .config console log report ci-upstream-kasan-gce-root
2018/04/06 21:25 upstream 38c23685b273 4f1152d4 .config console log report ci-upstream-kasan-gce
2018/04/06 18:34 upstream 38c23685b273 4f1152d4 .config console log report ci-upstream-kasan-gce-root
2018/04/06 15:07 upstream 38c23685b273 4f1152d4 .config console log report ci-upstream-kasan-gce-root
2018/04/05 22:57 upstream e02d37bf55a9 a932eae6 .config console log report ci-upstream-kasan-gce
2018/04/05 06:34 upstream 3e968c9f1401 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/05 02:04 upstream 3e968c9f1401 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/04 15:11 upstream 17dec0a94915 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/04 08:46 upstream f2d285669aae 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/04 00:48 upstream f2d285669aae 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/03 22:00 upstream f2d285669aae 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/03 21:52 upstream f2d285669aae 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/03 16:54 upstream 642e7fd23353 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/03 16:33 upstream 642e7fd23353 676bd07e .config console log report ci-upstream-kasan-gce-root
2018/04/03 15:42 upstream 642e7fd23353 676bd07e .config console log report ci-upstream-kasan-gce
2018/04/09 03:44 upstream f2d285669aae 77bd5117 .config console log report ci-upstream-kasan-gce-386
2018/04/08 06:10 upstream f2d285669aae 66f22a7f .config console log report ci-upstream-kasan-gce-386
2018/04/05 15:57 upstream f2d285669aae 5e1ccffc .config console log report ci-upstream-kasan-gce-386
2018/04/03 01:18 upstream 86bbbebac193 676bd07e .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.