syzbot


KASAN: vmalloc-out-of-bounds Write in htab_map_alloc

Status: fixed on 2021/03/10 01:48
Subsystems: bpf
[Documentation on labels]
Fix commit: e1868b9e36d0 bpf: Avoid overflows involving hash elem_size
First crash: 1233d, last: 1224d

Sample crash report:
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in htab_elem_set_ptr kernel/bpf/hashtab.c:212 [inline]
BUG: KASAN: vmalloc-out-of-bounds in prealloc_init kernel/bpf/hashtab.c:299 [inline]
BUG: KASAN: vmalloc-out-of-bounds in htab_map_alloc+0x10e4/0x1230 kernel/bpf/hashtab.c:507
Write of size 8 at addr ffffc900193f06d8 by task syz-executor.0/30635

CPU: 1 PID: 30635 Comm: syz-executor.0 Not tainted 5.10.0-rc7-syzkaller #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+0x107/0x163 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0x5/0x4c8 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
 htab_elem_set_ptr kernel/bpf/hashtab.c:212 [inline]
 prealloc_init kernel/bpf/hashtab.c:299 [inline]
 htab_map_alloc+0x10e4/0x1230 kernel/bpf/hashtab.c:507
 find_and_alloc_map kernel/bpf/syscall.c:123 [inline]
 map_create kernel/bpf/syscall.c:829 [inline]
 __do_sys_bpf+0xa81/0x5170 kernel/bpf/syscall.c:4374
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45e159
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f28e52aac68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e159
RDX: 0000000000000040 RSI: 0000000020000240 RDI: 0000000000000000
RBP: 000000000119bfc0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bf8c
R13: 00007fff0e56627f R14: 00007f28e52ab9c0 R15: 000000000119bf8c


Memory state around the buggy address:
 ffffc900193f0580: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc900193f0600: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc900193f0680: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                                                    ^
 ffffc900193f0700: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc900193f0780: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/12/13 02:19 net-next-old 00f7763a26cb bca53db9 .config console log report info ci-upstream-net-kasan-gce
2020/12/12 14:14 net-next-old 91163f821436 bca53db9 .config console log report info ci-upstream-net-kasan-gce
2020/12/11 13:04 net-next-old 91163f821436 ba24ffcd .config console log report info ci-upstream-net-kasan-gce
2020/12/06 16:21 bpf-next 34da87213d3d f12ba0c5 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/06 10:29 bpf-next 34da87213d3d f12ba0c5 .config console log report info ci-upstream-bpf-next-kasan-gce
2020/12/04 02:58 bpf-next 97306be45fbe e6b0d314 .config console log report info ci-upstream-bpf-next-kasan-gce
* Struck through repros no longer work on HEAD.