CVE-2026-142893: bpf: Fix out-of-bounds btf->types write for split BTF
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix out-of-bounds btf->types write for split BTF
btfaddtype() stores the types of a BTF in btf->types[], which can hold at most BTFMAXTYPE entries. The types of a split BTF get IDs startid .. startid + nrtypes - 1, so only BTFMAXTYPE - startid of them fit, but neither the limit check nor the size used to grow the array accounts for startid: the check is an equality test against BTFMAXTYPE ('startid + btf->typessize == BTFMAXTYPE') and the new size is clamped to BTFMAXTYPE.
The check therefore only fires if the array happens to grow to exactly BTFMAXTYPE - startid entries. Otherwise, if the module has more than BTFMAXTYPE types, the array is filled up to BTFMAXTYPE entries. The next type that needs to be added reallocates the array to the same size, after which btf->typessize no longer equals btf->nrtypes and the growth path is not taken anymore, so every following type is written past the end of the array:
BUG: unable to handle page fault for address: ffffc90006200000 RIP: 0010:btfaddtype+0x74/0x270 Call Trace: btfcheckallmetas btfparsemodule
Bound both the array size and the limit check by BTFMAXTYPE - startid. Base BTF (startid == 0) is unaffected.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In btf_add_type() for split BTF, bound both the array size and the limit check by BTF_MAX_TYPE - start_id.
Event History
Frequently Asked Questions
Which systems are affected by this condition?
The condition applies when the kernel parses split BTF for a module whose type count exceeds the available BTF type-array capacity after accounting for the split BTF start ID. It is specifically associated with split BTF rather than ordinary BTF handling.
How can administrators identify a likely occurrence?
A failure may present as a kernel page fault in btf_add_type during module BTF parsing. The reported call trace includes btf_check_all_metas and btf_parse_module.