syzbot


KASAN: use-after-free Read in refcount_sub_and_test_checked (2)

Status: auto-obsoleted due to no activity on 2024/06/24 11:46
Subsystems: perf
[Documentation on labels]
Reported-by: syzbot+b0775615fa4c4479b691@syzkaller.appspotmail.com
First crash: 2187d, last: 1778d
Cause bisection: introduced by (bisect log) :
commit cd67d3272768aa3f44c0f7cc71b82a112dce01fa
Author: Aisheng Dong <aisheng.dong@nxp.com>
Date: Thu Jan 24 13:22:49 2019 +0000

  clk: imx: scu: add fallback compatible string support

Crash: KASAN: use-after-free Write in _free_event (log)
Repro: syz .config
  
Fix bisection: failed (error log, bisect log)
  
Discussions (3)
Title Replies (including bot) Last reply
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
KASAN: use-after-free Read in refcount_sub_and_test_checked (2) 0 (3) 2019/04/19 08:21
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in refcount_sub_and_test_checked net 3 2337d 2338d 8/28 fixed on 2018/08/08 18:10
Last patch testing requests (9)
Created Duration User Patch Repo Result
2024/06/24 10:50 55m retest repro upstream OK log
2024/04/15 08:36 22m retest repro upstream error
2024/01/31 17:01 27m retest repro upstream report log
2023/11/19 22:35 1h35m retest repro upstream report log
2023/09/10 21:22 20m retest repro upstream report log
2023/06/21 16:41 29m retest repro upstream report log
2023/04/12 14:07 18m retest repro upstream report log
2022/12/21 03:31 18m retest repro upstream report log
2022/09/11 23:27 16m retest repro upstream report log
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/03/23 22:33 16m bisect fix upstream error job log
2020/02/13 01:38 33m bisect fix upstream OK (0) job log log
2020/01/14 01:06 32m bisect fix upstream OK (0) job log log
2019/11/09 16:46 32m bisect fix upstream OK (0) job log log
2019/08/19 08:30 33m bisect fix upstream OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
BUG: KASAN: use-after-free in refcount_sub_and_test_checked+0x87/0x200 lib/refcount.c:182
Read of size 4 at addr ffff8880a8d5e060 by task syz-executor.0/31157

CPU: 0 PID: 31157 Comm: syz-executor.0 Not tainted 5.1.0-rc5+ #74
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:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x123/0x190 mm/kasan/generic.c:191
 kasan_check_read+0x11/0x20 mm/kasan/common.c:102
 atomic_read include/asm-generic/atomic-instrumented.h:26 [inline]
 refcount_sub_and_test_checked+0x87/0x200 lib/refcount.c:182
 refcount_dec_and_test_checked+0x1b/0x20 lib/refcount.c:220
 put_task_struct include/linux/sched/task.h:97 [inline]
 _free_event+0x3d7/0x13b0 kernel/events/core.c:4460
 free_event+0x5f/0xd0 kernel/events/core.c:4481
 perf_event_release_kernel+0x5b2/0xbe0 kernel/events/core.c:4642
 perf_release+0x37/0x50 kernel/events/core.c:4656
 __fput+0x2e5/0x8d0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x14a/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x273/0x2c0 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_64+0x52d/0x610 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4129e1
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 1a 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffc793703e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000000004129e1
RDX: 0000000000000000 RSI: 0000000000000081 RDI: 0000000000000003
RBP: 0000000000741220 R08: 0000000000741218 R09: 000000000002c9b0
R10: 00007ffc793704a0 R11: 0000000000000293 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000003 R15: 000000000073bfac

Allocated by task 31160:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:505
 slab_post_alloc_hook mm/slab.h:437 [inline]
 slab_alloc_node mm/slab.c:3337 [inline]
 kmem_cache_alloc_node+0x131/0x710 mm/slab.c:3647
 alloc_task_struct_node kernel/fork.c:157 [inline]
 dup_task_struct kernel/fork.c:844 [inline]
 copy_process.part.0+0x1d08/0x7980 kernel/fork.c:1752
 copy_process kernel/fork.c:1709 [inline]
 _do_fork+0x257/0xfd0 kernel/fork.c:2226
 __do_sys_clone kernel/fork.c:2333 [inline]
 __se_sys_clone kernel/fork.c:2327 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2327
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 31160:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3500 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3766
 free_task_struct kernel/fork.c:162 [inline]
 free_task+0xdd/0x120 kernel/fork.c:457
 copy_process.part.0+0x1a3a/0x7980 kernel/fork.c:2158
 copy_process kernel/fork.c:1709 [inline]
 _do_fork+0x257/0xfd0 kernel/fork.c:2226
 __do_sys_clone kernel/fork.c:2333 [inline]
 __se_sys_clone kernel/fork.c:2327 [inline]
 __x64_sys_clone+0xbf/0x150 kernel/fork.c:2327
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a8d5e040
 which belongs to the cache task_struct(44:syz0) of size 6080
The buggy address is located 32 bytes inside of
 6080-byte region [ffff8880a8d5e040, ffff8880a8d5f800)
The buggy address belongs to the page:
page:ffffea0002a35780 count:1 mapcount:0 mapping:ffff88808b2adcc0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0002301808 ffffea0002171f08 ffff88808b2adcc0
raw: 0000000000000000 ffff8880a8d5e040 0000000100000001 ffff888085710580
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888085710580

Memory state around the buggy address:
 ffff8880a8d5df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a8d5df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a8d5e000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                       ^
 ffff8880a8d5e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a8d5e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/19 03:44 upstream 6d906f998179 b0e8efcb .config console log report syz ci-upstream-kasan-gce-smack-root
2019/02/20 15:49 net-old 1765f5dcd009 c95f0707 .config console log report ci-upstream-net-this-kasan-gce
2019/01/31 05:53 net-old e15aa3b2b138 aa432daf .config console log report ci-upstream-net-this-kasan-gce
2019/03/03 02:15 net-next-old cf29576fee60 1c0e457a .config console log report ci-upstream-net-kasan-gce
2019/02/14 13:29 net-next-old d4b242a7884f 6a46f448 .config console log report ci-upstream-net-kasan-gce
2019/01/27 11:21 net-next-old a4b829949326 c73f090a .config console log report ci-upstream-net-kasan-gce
2019/01/26 10:32 net-next-old f859a4484703 c73f090a .config console log report ci-upstream-net-kasan-gce
2019/01/19 09:29 net-next-old f04d402f2f00 2103a236 .config console log report ci-upstream-net-kasan-gce
2018/12/30 21:00 net-next-old b71acb0e3721 9942de5f .config console log report ci-upstream-net-kasan-gce
2019/02/15 16:59 linux-next 7a92eb7cc1dc f6f233c0 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.