WARNING in pcpu_alloc

From: syzbot
Date: Mon Oct 01 2018 - 14:14:07 EST


Hello,

syzbot found the following crash on:

HEAD commit: c5a9f9817ba5 Merge branch 'bpf-per-cpu-cgroup-local-storage'
git tree: bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=175f98e6400000
kernel config: https://syzkaller.appspot.com/x/.config?x=443816db871edd66
dashboard link: https://syzkaller.appspot.com/bug?extid=18628320d3b14a5c459c
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=129cbd1a400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16685ac9400000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+18628320d3b14a5c459c@xxxxxxxxxxxxxxxxxxxxxxxxx

------------[ cut here ]------------
illegal size (0) or align (8) for percpu allocation
WARNING: CPU: 0 PID: 5355 at mm/percpu.c:1382 pcpu_alloc+0x1359/0x15e0 mm/percpu.c:1381
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 5355 Comm: syz-executor747 Not tainted 4.19.0-rc5+ #105
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+0x1c4/0x2b4 lib/dump_stack.c:113
panic+0x238/0x4e7 kernel/panic.c:184
__warn.cold.8+0x163/0x1ba kernel/panic.c:536
report_bug+0x254/0x2d0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:178 [inline]
do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:993
RIP: 0010:pcpu_alloc+0x1359/0x15e0 mm/percpu.c:1381
Code: ff e8 2b 9f ff ff e9 70 f4 ff ff e8 01 ee d0 ff 48 8b 95 c8 fd ff ff 48 c7 c7 40 51 33 88 48 8b b5 e8 fd ff ff e8 87 d4 9a ff <0f> 0b 31 db e9 29 ee ff ff e8 d9 ed d0 ff e8 04 f8 b9 ff 31 ff 41
RSP: 0018:ffff8801d8fef840 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81650cb5 RDI: 0000000000000005
RBP: ffff8801d8fefab8 R08: ffff8801d8ec23c0 R09: ffffed003b584fe8
R10: ffffed003b584fe8 R11: ffff8801dac27f47 R12: 00000000006280c0
R13: ffffffffffffffff R14: 0000000000000008 R15: ffff8801bfc70034
__alloc_percpu_gfp+0x27/0x30 mm/percpu.c:1545
bpf_cgroup_storage_alloc+0x2d6/0x380 kernel/bpf/local_storage.c:393
bpf_test_run+0xd1/0x780 net/bpf/test_run.c:37
bpf_prog_test_run_skb+0x634/0xb40 net/bpf/test_run.c:155
bpf_prog_test_run+0x130/0x1a0 kernel/bpf/syscall.c:1772
__do_sys_bpf kernel/bpf/syscall.c:2409 [inline]
__se_sys_bpf kernel/bpf/syscall.c:2353 [inline]
__x64_sys_bpf+0x3d8/0x510 kernel/bpf/syscall.c:2353
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440379
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd94681f78 EFLAGS: 00000217 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440379
RDX: 0000000000000028 RSI: 0000000020000180 RDI: 000000000000000a
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000401c00
R13: 0000000000401c90 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches