syzbot


KASAN: stack-out-of-bounds Read in __cgroup_account_cputime_field

Status: fixed on 2018/08/07 13:43
Subsystems: cgroups
[Documentation on labels]
Fix commit: 99ba2b5aba24 bpf: sockhash, disallow bpf_tcp_close and update in parallel
First crash: 2101d, last: 2101d

Sample crash report:
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
BUG: KASAN: stack-out-of-bounds in cgroup_base_stat_cputime_account_begin kernel/cgroup/rstat.c:349 [inline]
BUG: KASAN: stack-out-of-bounds in __cgroup_account_cputime_field+0xe1/0xf0 kernel/cgroup/rstat.c:376
Read of size 8 at addr ffff8801adb15a38 by task syz-executor6/15691
kasan: GPF could be caused by NULL-ptr deref or user memory access

CPU: 0 PID: 15691 Comm: syz-executor6 Not tainted 4.18.0-rc3+ #58
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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
general protection fault: 0000 [#1] SMP KASAN
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
CPU: 1 PID: 15712 Comm: syz-executor2 Not tainted 4.18.0-rc3+ #58
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__read_once_size include/linux/compiler.h:188 [inline]
RIP: 0010:compound_head include/linux/page-flags.h:142 [inline]
RIP: 0010:PageSwapCache include/linux/page-flags.h:338 [inline]
RIP: 0010:free_swap_cache mm/swap_state.c:290 [inline]
RIP: 0010:free_pages_and_swap_cache+0x119/0x510 mm/swap_state.c:318
 cgroup_base_stat_cputime_account_begin kernel/cgroup/rstat.c:349 [inline]
 __cgroup_account_cputime_field+0xe1/0xf0 kernel/cgroup/rstat.c:376
Code: 
 cgroup_account_cputime_field include/linux/cgroup.h:744 [inline]
 task_group_account_field kernel/sched/cputime.c:108 [inline]
 account_system_index_time+0x2fb/0x5c0 kernel/sched/cputime.c:171
48 
c1 
e8 
03 
80 
3c 
 account_system_time+0x7f/0xb0 kernel/sched/cputime.c:199
18 
 account_process_tick+0x76/0x240 kernel/sched/cputime.c:498
00 
0f 85 4f 
 update_process_times+0x21/0x70 kernel/time/timer.c:1634
03 
 tick_sched_handle+0x9f/0x180 kernel/time/tick-sched.c:164
00 
 tick_sched_timer+0x45/0x130 kernel/time/tick-sched.c:1274
00 
 __run_hrtimer kernel/time/hrtimer.c:1398 [inline]
 __hrtimer_run_queues+0x3eb/0x10c0 kernel/time/hrtimer.c:1460
4d 
8b 
2e 
48 
8b 
85 f0 
fe 
ff 
ff 
c6 
00 
 hrtimer_interrupt+0x2f3/0x750 kernel/time/hrtimer.c:1518
00 49 
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1025 [inline]
 smp_apic_timer_interrupt+0x165/0x730 arch/x86/kernel/apic/apic.c:1050
8d 45 
08 
48 
89 
85 
c8 fe 
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:863
ff 
 </IRQ>
ff 

48 
Allocated by task 4478:
c1 
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
e8 
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc+0x14e/0x760 mm/slab.c:3727
03 
 kmalloc include/linux/slab.h:518 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 cgroup_create kernel/cgroup/cgroup.c:4823 [inline]
 cgroup_mkdir+0x302/0x1170 kernel/cgroup/cgroup.c:4948
<80> 3c 
 kernfs_iop_mkdir+0x159/0x1e0 fs/kernfs/dir.c:1099
 vfs_mkdir+0x42e/0x6b0 fs/namei.c:3827
18 00 
 do_mkdirat+0x27b/0x310 fs/namei.c:3850
 __do_sys_mkdir fs/namei.c:3866 [inline]
 __se_sys_mkdir fs/namei.c:3864 [inline]
 __x64_sys_mkdir+0x5c/0x80 fs/namei.c:3864
0f 
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
85 8f 
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
03 

00 
Freed by task 5380:
00 
 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
48 
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
8b 
 sk_prot_free net/core/sock.c:1550 [inline]
 __sk_destruct+0x791/0xa60 net/core/sock.c:1632
b5 
 sk_destruct+0x78/0x90 net/core/sock.c:1640
f0 
 __sk_free+0xcf/0x300 net/core/sock.c:1651
fe ff 
 sk_free+0x42/0x50 net/core/sock.c:1662
ff 49 
 deferred_put_nlk_sk+0x164/0x350 net/netlink/af_netlink.c:741
 __rcu_reclaim kernel/rcu/rcu.h:178 [inline]
 rcu_do_batch kernel/rcu/tree.c:2558 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2818 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2785 [inline]
 rcu_process_callbacks+0xed5/0x1850 kernel/rcu/tree.c:2802
8b 
 __do_softirq+0x2e8/0xb17 kernel/softirq.c:288

45 
The buggy address belongs to the object at ffff8801adb156c0
 which belongs to the cache kmalloc-2048 of size 2048
08 80 
The buggy address is located 888 bytes inside of
 2048-byte region [ffff8801adb156c0, ffff8801adb15ec0)
RSP: 0018:ffff88019aceea28 EFLAGS: 00010203
The buggy address belongs to the page:
page:ffffea0006b6c500 count:1 mapcount:0 mapping:ffff8801da800c40 index:0xffff8801adb14e40
RAX: 090a88207d18290b RBX: dffffc0000000000 RCX: ffffffff81b29b10
RDX: 0000000000000000 RSI: ffffffff81b29b4c RDI: 0000000000000005
 compound_mapcount: 0
RBP: ffff88019aceeb70 R08: ffff8801c9eda5c0 R09: fffff94000d2990e
R10: fffff94000d2990e R11: ffffea000694c877 R12: dffffc0000000000
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea0006ec7808 ffffea0006af3f88 ffff8801da800c40
R13: 48544103e8c14855 R14: ffffffff81912b80 R15: 0000000000000000
raw: ffff8801adb14e40 ffff8801adb145c0 0000000100000002 0000000000000000
FS:  00007fe59f638700(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
page dumped because: kasan: bad access detected
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000702138 CR3: 00000001a19a9000 CR4: 00000000001406e0

DR0: 00000000200001c0 DR1: 0000000020000080 DR2: 0000000000000000
Memory state around the buggy address:
 ffff8801adb15900: f2 f2 f2 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 00
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
 ffff8801adb15980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1
>ffff8801adb15a00: f1 f1 f1 00 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 f2
                                        ^
 ffff8801adb15a80: f2 f2 f2 00 f2 f2 f2 f2 f2 f2 f2 f8 f2 f2 f2 f2
 ffff8801adb15b00: f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/19 02:39 bpf-next 8ae71e76cf1f 49f35839 .config console log report ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.