CVE-2025-40123
kernel: bpf: Enforce expected_attach_type for tailcall compatibility
Severity
LowRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · November 12, 2025
Updated · July 30, 2026
Description
A constraint validation bypass was found in the Linux kernel's BPF tailcall compatibility checking. A local user with BPF privileges can trigger this issue by creating two programs with mismatched expected_attach_type values where the entry program performs a tailcall into a target program that has permissions to access different context fields or helper functions. This causes NULL pointer dereferences or undefined behavior when the target program attempts operations only valid for its attach type, resulting in kernel crashes and denial of service.
Statement
BPF programs specify expected_attach_type to enable attach-point-specific functionality beyond the base prog_type. For XDP, BPF_XDP_DEVMAP programs can access xdp_md's egress_ifindex field, while regular XDP programs cannot. For CGROUP_SOCK_ADDR, different attach types permit different helper functions like bpf_bind. Tailcalls allow one program to jump to another, but the compatibility check only verified prog_type matches—not expected_attach_type. An attacker creates progA (e.g., regular XDP) that tailcalls into progB (e.g., XDP_DEVMAP), which then accesses fields or calls helpers it shouldn't have permission to use, causing crashes or uninitialized pointer accesses. The fix enforces expected_attach_type matching for tailcall maps.
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
No mitigation is specified in collected source.
CVSS / CWE
CVSS 3.1 · 4.4CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H
CWE-843 · Access of Resource Using Incompatible Type ('Type Confusion')