syzbot


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

Status: fixed on 2023/02/24 13:50
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+5ad567a418794b9b5983@syzkaller.appspotmail.com
Fix commit: b293dcc473d2 bpf: Use VM_MAP instead of VM_ALLOC for ringbuf
First crash: 819d, last: 812d
Cause bisection: introduced by (bisect log) :
commit c34cdf846c1298de1c0f7fbe04820fe96c45068c
Author: Andrey Konovalov <andreyknvl@google.com>
Date: Wed Feb 2 01:04:27 2022 +0000

  kasan, vmalloc: unpoison VM_ALLOC pages after mapping

Crash: KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc (log)
Repro: C syz .config
  
Discussions (5)
Title Replies (including bot) Last reply
[PATCH 5.10 00/74] 5.10.99-rc1 review 85 (85) 2022/02/09 19:08
[PATCH 5.16 000/126] 5.16.8-rc1 review 130 (130) 2022/02/07 13:38
[PATCH 5.15 000/110] 5.15.22-rc1 review 112 (112) 2022/02/07 12:29
[PATCH bpf-next v2] bpf: use VM_MAP instead of VM_ALLOC for ringbuf 5 (5) 2022/02/03 07:30
[syzbot] KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc 3 (7) 2022/02/02 14:55
Last patch testing requests (1)
Created Duration User Patch Repo Result
2022/02/02 12:20 10m daniel@iogearbox.net git://git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git pr/rb-vmap OK

Sample crash report:
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in bpf_ringbuf_area_alloc kernel/bpf/ringbuf.c:110 [inline]
BUG: KASAN: vmalloc-out-of-bounds in bpf_ringbuf_alloc kernel/bpf/ringbuf.c:133 [inline]
BUG: KASAN: vmalloc-out-of-bounds in ringbuf_map_alloc kernel/bpf/ringbuf.c:172 [inline]
BUG: KASAN: vmalloc-out-of-bounds in ringbuf_map_alloc+0x725/0x7b0 kernel/bpf/ringbuf.c:148
Write of size 8 at addr ffffc9000c7a9078 by task syz-executor070/3595

CPU: 0 PID: 3595 Comm: syz-executor070 Not tainted 5.17.0-rc2-next-20220202-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0xf/0x3e0 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 bpf_ringbuf_area_alloc kernel/bpf/ringbuf.c:110 [inline]
 bpf_ringbuf_alloc kernel/bpf/ringbuf.c:133 [inline]
 ringbuf_map_alloc kernel/bpf/ringbuf.c:172 [inline]
 ringbuf_map_alloc+0x725/0x7b0 kernel/bpf/ringbuf.c:148
 find_and_alloc_map kernel/bpf/syscall.c:128 [inline]
 map_create kernel/bpf/syscall.c:863 [inline]
 __sys_bpf+0xc0f/0x5f10 kernel/bpf/syscall.c:4622
 __do_sys_bpf kernel/bpf/syscall.c:4744 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4742 [inline]
 __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4742
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f26ddd0a029
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff911fde88 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f26ddd0a029
RDX: 0000000000000048 RSI: 0000000020000280 RDI: 0000000000000000
RBP: 00007f26ddcce010 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 00007f26ddcce0a0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>


Memory state around the buggy address:
 ffffc9000c7a8f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc9000c7a8f80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>ffffc9000c7a9000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                                                                ^
 ffffc9000c7a9080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc9000c7a9100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================

Crashes (541):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/02/02 12:10 linux-next 6abab1b81b65 4ebb2798 .config console log report syz C ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/04 04:33 linux-next 2d3d8c7643a5 30646bfe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/04 04:14 linux-next 2d3d8c7643a5 30646bfe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/04 03:03 linux-next 2d3d8c7643a5 30646bfe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 19:11 linux-next 2d3d8c7643a5 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 18:22 linux-next 2d3d8c7643a5 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 15:32 linux-next 2d3d8c7643a5 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 13:53 linux-next 2d3d8c7643a5 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 13:04 linux-next 2d3d8c7643a5 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 05:13 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 03:28 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/03 02:06 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 23:41 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 22:22 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 19:43 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 15:56 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 15:37 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 13:51 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 11:32 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 10:12 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 09:34 linux-next 6abab1b81b65 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/02 04:05 linux-next 711428e8f370 4ebb2798 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 21:09 linux-next 711428e8f370 c1c1631d .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 19:58 linux-next 711428e8f370 c1c1631d .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 08:53 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 07:43 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 06:24 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 05:08 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 04:21 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/02/01 03:52 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 20:10 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 19:14 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 18:56 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 16:11 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 15:08 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 14:02 linux-next 887a333c44eb 6b7c57fe .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 06:52 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 05:20 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 03:41 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 02:26 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 01:23 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/31 00:19 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/30 23:30 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/30 21:59 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
2022/01/28 05:38 linux-next b605fdc54c2b 495e00c5 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: vmalloc-out-of-bounds Write in ringbuf_map_alloc
* Struck through repros no longer work on HEAD.