syzbot


KASAN: use-after-free Read in sched_fork

Status: auto-closed as invalid on 2020/02/28 13:06
Reported-by: syzbot+48ec7a5fa54bdc298bbf@syzkaller.appspotmail.com
First crash: 1639d, last: 1639d

Sample crash report:
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'.
==================================================================
BUG: KASAN: use-after-free in set_task_rq kernel/sched/sched.h:1302 [inline]
BUG: KASAN: use-after-free in __set_task_cpu kernel/sched/sched.h:1325 [inline]
BUG: KASAN: use-after-free in sched_fork+0x887/0x900 kernel/sched/core.c:2352
Read of size 8 at addr ffff8880a856ed38 by task syz-executor.4/10929

CPU: 1 PID: 10929 Comm: syz-executor.4 Not tainted 4.19.81 #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
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 set_task_rq kernel/sched/sched.h:1302 [inline]
 __set_task_cpu kernel/sched/sched.h:1325 [inline]
 sched_fork+0x887/0x900 kernel/sched/core.c:2352
 copy_process.part.0+0x1859/0x7a30 kernel/fork.c:1862
 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
RIP: 0033:0x45c919
Code: ff 48 85 f6 0f 84 d7 8c fb ff 48 83 ee 10 48 89 4e 08 48 89 3e 48 89 d7 4c 89 c2 4d 89 c8 4c 8b 54 24 08 b8 38 00 00 00 0f 05 <48> 85 c0 0f 8c ae 8c fb ff 74 01 c3 31 ed 48 f7 c7 00 00 01 00 75
RSP: 002b:00007ffe5935fce8 EFLAGS: 00000202 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007f920c589700 RCX: 000000000045c919
RDX: 00007f920c5899d0 RSI: 00007f920c588db0 RDI: 00000000003d0f00
RBP: 00007ffe5935ff00 R08: 00007f920c589700 R09: 00007f920c589700
R10: 00007f920c5899d0 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe5935fd9f R14: 00007f920c5899c0 R15: 000000000075bfd4

Allocated by task 10909:
 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+0x12e/0x700 mm/slab.c:3559
 sched_create_group+0x1c/0x70 kernel/sched/core.c:6301
 cpu_cgroup_css_alloc+0xe/0x30 kernel/sched/core.c:6435
 css_create kernel/cgroup/cgroup.c:4825 [inline]
 cgroup_apply_control_enable+0x44d/0xc30 kernel/cgroup/cgroup.c:2949
 cgroup_apply_control+0x20/0x50 kernel/cgroup/cgroup.c:3029
 cgroup_subtree_control_write+0x7ee/0xbd0 kernel/cgroup/cgroup.c:3187
 cgroup_file_write+0x241/0x790 kernel/cgroup/cgroup.c:3465
 kernfs_fop_write+0x2b8/0x480 fs/kernfs/file.c:316
 __vfs_write+0x114/0x810 fs/read_write.c:485
 vfs_write+0x20c/0x560 fs/read_write.c:549
 ksys_write+0x14f/0x2d0 fs/read_write.c:599
 __do_sys_write fs/read_write.c:611 [inline]
 __se_sys_write fs/read_write.c:608 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:608
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 2724:
 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
 sched_free_group+0x25/0x30 kernel/sched/core.c:6293
 cpu_cgroup_css_free+0x9/0x10 kernel/sched/core.c:6467
 css_free_rwork_fn+0xf8/0xd20 kernel/cgroup/cgroup.c:4634
 process_one_work+0x989/0x1750 kernel/workqueue.c:2153
 worker_thread+0x98/0xe40 kernel/workqueue.c:2296
 kthread+0x354/0x420 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff8880a856ec00
 which belongs to the cache task_group of size 768
The buggy address is located 312 bytes inside of
 768-byte region [ffff8880a856ec00, ffff8880a856ef00)
The buggy address belongs to the page:
page:ffffea0002a15b80 count:1 mapcount:0 mapping:ffff88812c3e81c0 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffffea0002922b08 ffffea0001f9ecc8 ffff88812c3e81c0
raw: 0000000000000000 ffff8880a856e180 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a856ec00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a856ec80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a856ed00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff8880a856ed80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a856ee00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/10/31 13:05 linux-4.19.y ef244c308885 a41ca8fa .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.