CVE-2026-139205

bpf: Propagate btf_add_type() errors in btf_check_all_metas()

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

bpf: Propagate btf_add_type() errors in btf_check_all_metas()

btf_check_all_metas() ignores the return value of btf_add_type(), so a
type that could not be registered is silently dropped while the loop
keeps walking over the type section.

Both failure modes are reachable:

- -E2BIG. Once the types array reaches its capacity (BTF_MAX_TYPE),
every following btf_add_type() fails the same way, so
btf_check_all_metas() still returns 0 and the BTF object is created
with btf->nr_types capped while hdr->type_len claims more records.

- -ENOMEM. btf->nr_types is not incremented and the array is not
grown, so the next type is recorded at the slot of the dropped one
and btf->types[] stays off by one with respect to the type ids for
all remaining types. btf_type_by_id() then returns the wrong type
for those ids for the whole lifetime of the object, and the last
type is silently left unresolved.

Propagate the error so that the object is rejected instead.

Analysis

AI-generated

Technical impact

In the Linux kernel, the BPF subsystem contains a flaw where the function btf_check_all_metas() ignores errors returned by btf_add_type(). When a type cannot be registered, the error is silently dropped, yet the loop continues to traverse the type section. This leads to a constructed BTF object whose number of reported types does not match the actual data. Two failure modes are possible: –E2BIG when the type array reaches its capacity, causing subsequent calls to fail but still reporting success, and –ENOMEM where the type count is not incremented and a subsequent type overwrites a previously dropped slot. In both cases the internal type mapping becomes corrupted, which can propagate incorrect type information to any kernel component that consumes BTF data, potentially causing memory corruption or other integrity violations.

Affected Systems

All Linux kernel installations running a version prior to the commit adding error propagation in btf_check_all_metas() and btf_add_type() are impacted. The code is part of the core BPF framework, so any system that loads a BPF program embedding a BTF object exercises the vulnerable path. This includes regular system services that make use of BPF, as well as third‑party tools that interact with the kernel via BPF.

Risk and Exploitability

While the vulnerability is not listed in the CISA KEV catalog and no EPSS score is available, indicating no publicly documented exploitation, the potential consequences are significant. Based on the description, the likely attack vector requires the ability to load a crafted BPF program containing malformed BTF data, which means an attacker needs local or elevated privileges. Successful exploitation could corrupt kernel data structures or trigger a denial of service. The absence of known exploitation does not reduce remediation urgency given the critical nature of kernel integrity.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the kernel to a release that includes the commit adding error propagation in btf_check_all_metas() and btf_add_type().
  • If a kernel upgrade cannot be performed immediately, restrict BPF program loading to trusted users and disable BTF parsing for non‑essential workloads until the patch is applied.
  • Configure system hardening to deny the use of BPF features to unprivileged users.

Generated by OpenCVE AI on December 1, 2026 at 09:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-390
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf: Propagate btf_add_type() errors in btf_check_all_metas() btf_check_all_metas() ignores the return value of btf_add_type(), so a type that could not be registered is silently dropped while the loop keeps walking over the type section. Both failure modes are reachable: - -E2BIG. Once the types array reaches its capacity (BTF_MAX_TYPE), every following btf_add_type() fails the same way, so btf_check_all_metas() still returns 0 and the BTF object is created with btf->nr_types capped while hdr->type_len claims more records. - -ENOMEM. btf->nr_types is not incremented and the array is not grown, so the next type is recorded at the slot of the dropped one and btf->types[] stays off by one with respect to the type ids for all remaining types. btf_type_by_id() then returns the wrong type for those ids for the whole lifetime of the object, and the last type is silently left unresolved. Propagate the error so that the object is rejected instead.
Title bpf: Propagate btf_add_type() errors in btf_check_all_metas()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-390

    Detection of Error Condition Without Action

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:32 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:18 PM
Modified
Nov 30, 2026, 2:18 PM