CVE-2026-45837: bpf: Fix use-after-free in arena_vm_close on fork
From: Greg Kroah-Hartman <[email protected]>
Description
===========
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 VMAThe refcount ensures the rollback's arena_vm_close does not free the vml shared with the original VMA.
The Linux kernel CVE team has assigned CVE-2026-45837 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.9 with commit 317460317a02a1af512697e6e964298dedd8a163 and fixed in 6.12.88 with commit 723b9fa930cc277c15ce6b9ec9feec828cfac9d7 Issue introduced in 6.9 with commit 317460317a02a1af512697e6e964298dedd8a163 and fixed in 6.18.30 with commit d18099f19e53250f8ad2801498b88cec29d9107a Issue introduced in 6.9 with commit 317460317a02a1af512697e6e964298dedd8a163 and fixed in 7.0.7 with commit 201128fcc7b213d27ab77bc4e89488b41796480f Issue introduced in 6.9 with commit 317460317a02a1af512697e6e964298dedd8a163 and fixed in 7.1-rc1 with commit 4fddde2a732de60bb97e3307d4eb69ac5f1d2b74
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-45837
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
kernel/bpf/arena.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/723b9fa930cc277c15ce6b9ec9feec828cfac9d7 https://git.kernel.org/stable/c/d18099f19e53250f8ad2801498b88cec29d9107a https://git.kernel.org/stable/c/201128fcc7b213d27ab77bc4e89488b41796480f https://git.kernel.org/stable/c/4fddde2a732de60bb97e3307d4eb69ac5f1d2b74