Skip to contentSkip to conversation

CVE-2026-90157: bpf: Reject negative optlen in cgroup getsockopt hook

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 17

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

bpf: Reject negative optlen in cgroup getsockopt hook

A cgroup getsockopt BPF program can shrink ctx->optlen after the kernel getsockopt handler has run. The kernel-buffer variant, used by TCP_ZEROCOPY_RECEIVE, only rejects values larger than the original length.

If BPF writes a negative optlen, that value is accepted and propagated back to the TCP getsockopt code. It can then be passed to copy_to_sockptr() as a size_t and trigger the hardened usercopy bytes > INT_MAX warning.

Reject negative ctx.optlen in __cgroup_bpf_run_filter_getsockopt_kern(), matching the lower-bound validation already present in the sockptr-based getsockopt hook.

The Linux kernel CVE team has assigned CVE-2026-90157 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.10.188 with commit 08f61a34913558e06576e7b6318bf583f273c1be and fixed in 5.10.270 with commit 5b09d984b38b018b123c3a9e02a96bbc6468dbe5
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 5.15.221 with commit 554ba7195c4108726450e24480c8449990c2268c
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 6.1.188 with commit d02a12b4085ffe41ea750b1007f7a9c7aee2875a
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 6.6.157 with commit e6fbf0eba87f50084d67508898f6ad6fc7ff1ba2
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 6.12.110 with commit f68671b1a98d426c57864bd457c125fee14ac1a5
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 6.18.52 with commit 2bdbe00454200fcb0110f31eeca8d906a3515e74
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 7.2.6 with commit 31a89af4f513d750fec196e2bb6195a7d4473e9f
	Issue introduced in 5.12 with commit 9cacf81f8161111db25f98e78a7a0e32ae142b3f and fixed in 7.3-rc1 with commit 1b5aacd5b2419b0790e955e466d389a61c79b4b1

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-90157

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
kernel/bpf/cgroup.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/5b09d984b38b018b123c3a9e02a96bbc6468dbe5
	https://git.kernel.org/stable/c/554ba7195c4108726450e24480c8449990c2268c
	https://git.kernel.org/stable/c/d02a12b4085ffe41ea750b1007f7a9c7aee2875a
	https://git.kernel.org/stable/c/e6fbf0eba87f50084d67508898f6ad6fc7ff1ba2
	https://git.kernel.org/stable/c/f68671b1a98d426c57864bd457c125fee14ac1a5
	https://git.kernel.org/stable/c/2bdbe00454200fcb0110f31eeca8d906a3515e74
	https://git.kernel.org/stable/c/31a89af4f513d750fec196e2bb6195a7d4473e9f
	https://git.kernel.org/stable/c/1b5aacd5b2419b0790e955e466d389a61c79b4b1