bpf: Use VM_MAP instead of VM_ALLOC for ringbuf
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Use VM_MAP instead of VM_ALLOC for ringbuf
After commit 2fd3fb0be1d1 ("kasan, vmalloc: unpoison VM_ALLOC pages after mapping"), non-VM_ALLOC mappings will be marked as accessible in __get_vm_area_node() when KASAN is enabled. But now the flag for ringbuf area is VM_ALLOC, so KASAN will complain out-of-bound access after vmap() returns. Because the ringbuf area is created by mapping allocated pages, so use VM_MAP instead.
After the change, info in /proc/vmallocinfo also changes from [start]-[end] 24576 ringbuf_map_alloc+0x171/0x290 vmalloc user to [start]-[end] 24576 ringbuf_map_alloc+0x171/0x290 vmap user
From the CVE record · Linux
The BPF ring buffer uses the VM_ALLOC flag for an area created by mapping allocated pages. With KASAN enabled after the cited vmalloc change, KASAN reports an out-of-bounds access after vmap() returns; the input does not establish an attacker capability or specify access, authentication, or user-interaction requirements.
Engineers running Linux kernels with the cited vmalloc change and KASAN enabled should check their BPF ring-buffer implementation; affected versions are not specified.