CVE-2026-98299: tcp: do not let tcp_rmem be set below 4096
In the Linux kernel, the following vulnerability has been resolved:
tcp: do not let tcprmem be set below 4096
We can hit a division by zero crash in tcprcvbufgrow() and tcprcvspaceadjust():
divide error: 0000 [#1] PREEMPT SMP RIP: 0010:tcprcvbufgrow+0x187/0x450 net/ipv4/tcpinput.c:939 ... grow = divu64(((u64)rcvwin << 1) (newval - oldval), oldval);
The division uses oldval = tp->rcvqspace.space as divisor. When tp->rcvqspace.space is zero, this leads to a divide-by-zero exception.
tp->rcvqspace.space is initialized in tcpinitbufferspace(): tp->rcvqspace.space = min3(tp->rcvssthresh, tp->rcvwnd, (u32)TCPINITCWND tp->advmss);
If tcprmem[1] is configured to very small values (such as 1), sk->skrcvbuf is initialized to 1. Then tcpfullspace(sk), which computes (sk->skrcvbuf scalingratio) >> 8, truncates to 0. This sets tp->windowclamp = 0, tp->rcvssthresh = 0, and tp->rcvqspace.space = 0. Later, when data arrives and DRS is invoked, tcprcvbufgrow() divides by oldval == 0.
Back in 2015, commit b1cb59cf2efe ("net: sysctlnetcore: check SNDBUF and RCVBUF for min length") ensured that net.core.rmemdefault and net.core.rmemmax cannot be set below SOCKMINRCVBUF. Similarly, SORCVBUF setsockopt enforces maxt(int, val 2, SOCKMINRCVBUF).
However, net.ipv4.tcprmem still had .extra1 = SYSCTLONE, allowing arbitrarily small values.
Because SOCKMINRCVBUF depends on sizeof(struct skbuff) and cacheline alignment, its value varies across architectures and configuration options. Using a fixed constant of 4096 ensures a predictable, architecture- independent lower bound that is safely above SOCKMINRCVBUF everywhere and matches the documented 4K default.
Fix this by setting tcprmem.extra1 to 4096 and updating the documentation.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Set tcp_rmem.extra1 to 4096 so net.ipv4.tcp_rmem cannot be configured below the safe minimum.
Linux kernel TCP net.ipv4.tcp_rmem.extra1 = 4096