syzbot


WARNING: kmalloc bug in bpf_prog_array_copy_info

Status: fixed on 2018/02/26 20:04
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+cab5816b0edbabf598b3@syzkaller.appspotmail.com
Fix commit: 9c481b908b01 bpf: fix bpf_prog_array_copy_to_user warning from perf event prog query
First crash: 2435d, last: 2420d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH bpf] bpf: fix bpf_prog_array_copy_to_user warning from perf event prog query 2 (2) 2018/02/14 17:03
WARNING: kmalloc bug in bpf_prog_array_copy_info 2 (3) 2018/02/14 14:40

Sample crash report:
audit: type=1400 audit(1518631520.128:9): avc:  denied  { prog_run } for  pid=4159 comm="syzkaller321832" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=bpf permissive=1
WARNING: CPU: 0 PID: 4159 at mm/slab_common.c:1012 kmalloc_slab+0x5d/0x70 mm/slab_common.c:1012
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 4159 Comm: syzkaller321832 Not tainted 4.16.0-rc1+ #13
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:53
 panic+0x1e4/0x41c kernel/panic.c:183
 __warn+0x1dc/0x200 kernel/panic.c:547
 report_bug+0x211/0x2d0 lib/bug.c:184
 fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
 fixup_bug arch/x86/kernel/traps.c:247 [inline]
 do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
 invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:988
RIP: 0010:kmalloc_slab+0x5d/0x70 mm/slab_common.c:1012
RSP: 0018:ffff8801c33d7798 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff1003867af22 RCX: ffffffff817e12fd
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000100000084
RBP: ffff8801c33d7798 R08: ffffed003867af26 R09: ffffed003867af26
R10: 0000000000000001 R11: ffffed003867af26 R12: ffff8801b46c5080
R13: ffff8801c33d7930 R14: 00000000014280c0 R15: 0000000040000021
 __do_kmalloc mm/slab.c:3700 [inline]
 __kmalloc+0x25/0x760 mm/slab.c:3714
 kmalloc_array include/linux/slab.h:631 [inline]
 kcalloc include/linux/slab.h:642 [inline]
 bpf_prog_array_copy_to_user+0x98/0x480 kernel/bpf/core.c:1593
 bpf_prog_array_copy_info+0x17b/0x1c0 kernel/bpf/core.c:1701
 perf_event_query_prog_array+0x196/0x280 kernel/trace/bpf_trace.c:877
 _perf_ioctl kernel/events/core.c:4737 [inline]
 perf_ioctl+0x3e1/0x1480 kernel/events/core.c:4757
 vfs_ioctl fs/ioctl.c:46 [inline]
 do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:686
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x8f/0xc0 fs/ioctl.c:692
 do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x26/0x9b
RIP: 0033:0x43ffe9
RSP: 002b:00007ffe7966abf8 EFLAGS: 00000217 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 000000000043ffe9
RDX: 0000000020fb4000 RSI: 00000000c008240a RDI: 0000000000000004
RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000401910
R13: 00000000004019a0 R14: 0000000000000000 R15: 0000000000000000
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (4424):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/02/14 18:07 bpf-next 615a94749857 17061fc0 .config console log report syz C ci-upstream-bpf-next-kasan-gce
2018/02/12 18:05 bpf-next 7928b2cbe55b 88bc17df .config console log report syz C ci-upstream-bpf-next-kasan-gce
2018/02/25 14:10 bpf-next 7d72637eb39f 5c1e0207 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/24 15:30 bpf-next 7d72637eb39f 5c1e0207 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/19 23:25 bpf-next 0b6b8a3dd86d c1f526e3 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:35 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:34 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:31 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:28 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:27 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:20 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:13 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:10 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:09 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:08 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:03 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:03 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 11:02 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:46 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:45 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:37 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:34 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:33 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:28 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:24 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:15 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:14 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 10:00 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:59 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:50 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:50 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:47 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:42 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:39 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:39 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:32 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:30 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:27 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:21 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:20 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:20 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/16 09:18 bpf-next 0b6b8a3dd86d c8b3f7c1 .config console log report ci-upstream-bpf-next-kasan-gce
2018/02/12 17:36 bpf-next 7928b2cbe55b 88bc17df .config console log report ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.