CVE-2026-99795: cxl/features: Ensure that count is set before access to ent[] __counted_by()
In the Linux kernel, the following vulnerability has been resolved:
cxl/features: Ensure that count is set before access to ent[] countedby()
getsupportedfeatures() assigns entries->numfeatures only after the memcpy() loop that fills entries->ent[] has already run. Since ent[] is countedby(numfeatures), the compiler's bounds instrumentation sees a 0-length array during that loop and FORTIFYSOURCE trips on the memcpy. Set @numfeatures right after allocation, before any write into ent[], so the bound is correct for the whole lifetime of the array.
This was found via a fortify panic:
memcpy: detected buffer overflow: 384 byte write of buffer size 0 WARNING: lib/stringhelpers.c:1035 at fortifyreport+0x54/0xa0 kernel BUG at lib/stringhelpers.c:1043! Call trace: fortifypanic+0x10/0x18 getsupportedfeatures.isra.0+0x4a0/0x4d0 [cxlcore] devmcxlsetupfeatures+0x84/0x120 [cxlcore] cxlpciprobe+0x254/0x5e0 [cxlpci]
Same class of bug, same fix shape as commit 6c9d2e87df40 ("cxl/fwctl: Fix fortifypanic"), which fixed the analogous issue in cxlctlgetsupportedfeatures() but missed this one.
[ dj: Fixed up title typo per Jonathan. ]
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.5 - Compensating control
In Linux kernel cxl/features, set entries->num_features immediately after allocating entries and before any memcpy or other access to entries->ent[].
Frequently Asked Questions
When does this issue manifest in practice?
It manifests while the kernel is probing a CXL PCI device and setting up its supported features. The reported failure is a FORTIFY_SOURCE panic caused by copying feature entries into an array that the compiler treats as having zero length.
Is exploitation dependent on an unprivileged attacker supplying input?
The provided information describes a kernel-internal bounds-instrumentation failure during CXL PCI device probing, not an attacker-controlled input path. It does not establish an unprivileged exploitation scenario or identify any required attacker access.
What is the immediate remediation?
Apply a kernel update containing the fix that initializes num_features immediately after allocation and before writing entries into ent[]. The supplied references identify stable kernel commits carrying the correction.
How can administrators identify an affected system?
Affected systems may log a FORTIFY_SOURCE buffer-overflow report stating "384 byte write of buffer size 0," followed by a warning in lib/string_helpers.c and a kernel BUG. The call trace includes get_supported_features, devm_cxl_setup_features, and cxl_pci_probe.