HIGH
bpf Arena UAF
CVE-2026-45837
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: bpf: Fix use-after-free in arena_vm_close on fork arena_vm_open() only bumps vml->mmap_count but never registers the child VMA in arena->vma_list. The vml->vma always points at the parent VMA, so after parent munmap the pointer dangles. If the child then calls bpf_arena_free_pages(), zap_pages() reads the stale vml->vma triggering use-after-free. Fix this by preventing the arena VMA from being inherited across fork with VM_DONTCOPY, and preventing VMA splits via the may_split callback. Also reject mremap with a .mremap callback returning -EINVAL. A same-size mremap(MREMAP_FIXED) on the full arena VMA reaches copy_vma() through the following path: check_prep_vma() - returns 0 early: new_len == old_len skips VM_DONTEXPAND check prep_move_vma() - vm_start == old_addr and vm_end == old_addr + old_len so may_split is never called move_vma() copy_vma_and_data() copy_vma() vm_area_dup() - copies vm_private_data (vml pointer) vm_ops->open() - bumps vml->mmap_count vm_ops->mremap() - returns -EINVAL, rollback unmaps new VMA The refcount ensures the rollback's arena_vm_close does not free the vml shared with the original VMA.
02KernelScan AI Analysis
Risk summary
Local attackers with the ability to load BPF programs can trigger a use-after-free vulnerability in the BPF arena memory management during process forking. This can lead to kernel memory corruption, privilege escalation, or system crashes when child processes access freed parent VMA structures.
Vulnerability analysis
The vulnerability occurs because arena_vm_open() increments a reference count during fork but fails to properly register the child VMA in the arena's VMA list, leaving the child's vml->vma pointer pointing to the parent's VMA. When the parent process unmaps the arena, the pointer becomes stale, and subsequent calls to bpf_arena_free_pages() by the child process trigger a use-after-free when zap_pages() accesses the dangling vml->vma pointer. The fix prevents VMA inheritance across fork using VM_DONTCOPY flag and blocks VMA splits/remaps through callback functions that return -EINVAL, ensuring proper memory management isolation between parent and child processes.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.12 | 6.12.88 | 723b9fa930cc |
| 6.18 | 6.18.30 | d18099f19e53 |
| 7.0 | 7.0.7 | 201128fcc7b2 |
| mainline | 7.1-rc1 | 4fddde2a732d |