CVE Database›CVE-2025-38502

CVE-2025-38502

kernel: bpf: Fix oob access in cgroup local storage

Loading…

Severity

Low

Red Hat Product Security

4

CVSS 3.1

Review impact separately from score.

Published · August 16, 2025

Updated · October 18, 2026

Description

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix oob access in cgroup local storage

Lonial reported that an out-of-bounds access in cgroup local storage can be crafted via tail calls. Given two programs each utilizing a cgroup local storage with a different value size, and one program doing a tail call into the other. The verifier will validate each of the indivial programs just fine. However, in the runtime context the bpf_cg_run_ctx holds an bpf_prog_array_item which contains the BPF program as well as any cgroup local storage flavor the program uses. Helpers such as bpf_get_local_storage() pick this up from the runtime context:

ctx = container_of(current->bpf_ctx, struct bpf_cg_run_ctx, run_ctx); storage = ctx->prog_item->cgroup_storage[stype];

if (stype == BPF_CGROUP_STORAGE_SHARED) ptr = &READ_ONCE(storage->buf)->data[0]; else ptr = this_cpu_ptr(storage->percpu_buf);

For the second program which was called from the originally attached one, this means bpf_get_local_storage() will pick up the former program's map, not its own. With mismatching sizes, this can result in an unintended out-of-bounds access.

To fix this issue, we need to extend bpf_map_owner with an array of storage_cookie[] to match on i) the exact maps from the original program if the second program was using bpf_get_local_storage(), or ii) allow the tail call combination if the second program was not using any of the cgroup local storage maps.

Statement

A low-impact out-of-bounds access flaw was found in the Linux kernel's BPF cgroup local storage handling, affecting the kernel and kernel-rt packages in Red Hat Enterprise Linux 8, 9, and 10 and the kernel in Red Hat In-Vehicle OS. When a cgroup-attached BPF program performs a tail call into another program that uses a cgroup local storage map with a different value size, the bpf_get_local_storage() helper retrieves the originally attached program's storage from the runtime context instead of the tail-called program's own map. Because the BPF verifier validates each program independently, this size mismatch is not detected, and the tail-called program can perform an unintended out-of-bounds access on kernel memory. A local attacker able to load and attach crafted BPF programs could use this flaw to trigger an out-of-bounds kernel memory access, resulting in a system crash or other unintended consequences.

Red Hat Enterprise Linux 6 and 7 are not affected because the vulnerable code (shared cgroup local storage between programs on the same cgroup, introduced upstream in Linux 5.9) is not present in those releases. Fixes for the affected Red Hat Enterprise Linux and Red Hat In-Vehicle OS streams are currently deferred because the flaw is rated low impact and requires a local attacker who already has the ability to load and run BPF programs; the residual risk is limited to such an attacker triggering an out-of-bounds kernel memory access. Red Hat assessed this flaw as low severity, lower than the NIST (7.1) and CVE.org (7.8) ratings, because exploitation requires local access with the ability to load crafted BPF programs and the assessed direct impact is limited (RH CVSS 4.0, availability-only impact).

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

CVSS / CWE

CVSS 3.1 · 4
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

CWE-125 · Out-of-bounds Read