bpf: Enforce expected_attach_type for tailcall compatibility
In the Linux kernel, the following vulnerability has been resolved: bpf: Enforce expected_attach_type for tailcall compatibility Yinhao et al. recently reported: Our fuzzer tool discovered an uninitialized pointer issue in the bpf_prog_test_run_xdp() function within the Linux kernel's BPF subsystem. This leads to a NULL pointer dereference when a BPF program attempts to deference the txq member of struct xdp_buff object. The test initializes two programs of BPF_PROG_TYPE_XDP: progA acts as the entry point for bpf_prog_test_run_xdp() and its expected_attach_type can neither be of be BPF_XDP_DEVMAP nor BPF_XDP_CPUMAP. progA calls into a slot of a tailcall map it owns. progB's expected_attach_type must be BPF_XDP_DEVMAP to pass xdp_is_valid_access() validation. The program returns struct xdp_md's egress_ifindex, and the latter is only allowed to be accessed under mentioned expected_attach_type. progB is then inserted into the tailcall which progA calls. The underlying issue goes beyond XDP though. Another example are programs of type BPF_PROG_TYPE_CGROUP_SOCK_ADDR. sock_addr_is_valid_access() as well as sock_addr_func_proto() have different logic depending on the programs' expected_attach_type. Similarly, a program attached to BPF_CGROUP_INET4_GETPEERNAME should not be allowed doing a tailcall into a program which calls bpf_bind() out of BPF which is only enabled for BPF_CGROUP_INET4_CONNECT. In short, specifying expected_attach_type allows to open up additional functionality or
CVE-2025-40123
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: cve:CVE-2025-40123
Linux
Source reference: /containers/cna/affected/0/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Linux
Source reference: /containers/cna/affected/1/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "e53a59e7cee5c1605d1ed595933098c2b69108f9",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "dc4f348952173beb8ceb15be30b249276eccb605",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "a99de19128aec0913f3d529f529fbbff5edfaff8",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "08cb3dc9d2b44f153d0bcf2cb966e4a94b5d0f32",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "f856c598080ba7ce1252867b8ecd6ad5bdaf9a6a",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "c1ad19b5d8e23123503dcaf2d4342e1b90b923ad",
"versionType": "git"
},
{
"status": "affected",
"version": "5e43f899b03a3492ce5fc44e8900becb04dae9c0",
"lessThan": "4540aed51b12bc13364149bf95f6ecef013197c0",
"versionType": "git"
}
],
"programFiles": [
"include/linux/bpf.h",
"kernel/bpf/core.c"
],
"defaultStatus": "unaffected"
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "4.17"
},
{
"status": "unaffected",
"version": "0",
"lessThan": "4.17",
"versionType": "semver"
},
{
"status": "unaffected",
"version": "5.10.270",
"versionType": "semver",
"lessThanOrEqual": "5.10.*"
},
{
"status": "unaffected",
"version": "5.15.221",
"versionType": "semver",
"lessThanOrEqual": "5.15.*"
},
{
"status": "unaffected",
"version": "6.1.156",
"versionType": "semver",
"lessThanOrEqual": "6.1.*"
},
{
"status": "unaffected",
"version": "6.6.112",
"versionType": "semver",
"lessThanOrEqual": "6.6.*"
},
{
"status": "unaffected",
"version": "6.12.53",
"versionType": "semver",
"lessThanOrEqual": "6.12.*"
},
{
"status": "unaffected",
"version": "6.17.3",
"versionType": "semver",
"lessThanOrEqual": "6.17.*"
},
{
"status": "unaffected",
"version": "6.18",
"versionType": "original_commit_for_fix",
"lessThanOrEqual": "*"
}
],
"programFiles": [
"include/linux/bpf.h",
"kernel/bpf/core.c"
],
"defaultStatus": "affected"
}
]- Related CVEs
- CVE-2025-40123
Source reference:
/cveMetadata/cveId
Publisher severity
high
Source reference: /containers/cna/metrics
- Event
- #30676 · Revision 1
- Added to Heist Feed
- Publisher date