linux/Documentation
Eric Dumazet 83a945a529 tcp: do not let tcp_rmem be set below 4096
We can hit a division by zero crash in tcp_rcvbuf_grow()
and tcp_rcv_space_adjust():

divide error: 0000 [#1] PREEMPT SMP
RIP: 0010:tcp_rcvbuf_grow+0x187/0x450 net/ipv4/tcp_input.c:939
...
grow = div_u64(((u64)rcvwin << 1) * (newval - oldval), oldval);

The division uses oldval = tp->rcvq_space.space as divisor.
When tp->rcvq_space.space is zero, this leads to a divide-by-zero
exception.

tp->rcvq_space.space is initialized in tcp_init_buffer_space():
    tp->rcvq_space.space = min3(tp->rcv_ssthresh, tp->rcv_wnd,
                                (u32)TCP_INIT_CWND * tp->advmss);

If tcp_rmem[1] is configured to very small values (such as 1),
sk->sk_rcvbuf is initialized to 1. Then tcp_full_space(sk), which
computes (sk->sk_rcvbuf * scaling_ratio) >> 8, truncates to 0.
This sets tp->window_clamp = 0, tp->rcv_ssthresh = 0, and
tp->rcvq_space.space = 0. Later, when data arrives and DRS is invoked,
tcp_rcvbuf_grow() divides by oldval == 0.

Back in 2015, commit b1cb59cf2e ("net: sysctl_net_core: check SNDBUF
and RCVBUF for min length") ensured that net.core.rmem_default and
net.core.rmem_max cannot be set below SOCK_MIN_RCVBUF. Similarly,
SO_RCVBUF setsockopt enforces max_t(int, val * 2, SOCK_MIN_RCVBUF).

However, net.ipv4.tcp_rmem still had .extra1 = SYSCTL_ONE, allowing
arbitrarily small values.

Because SOCK_MIN_RCVBUF depends on sizeof(struct sk_buff) 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 SOCK_MIN_RCVBUF everywhere
and matches the documented 4K default.

Fix this by setting tcp_rmem.extra1 to 4096 and updating the documentation.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260912144848.3448026-1-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-09-15 15:21:17 +02:00
..
ABI Driver core fixes for 7.3-rc2 2026-09-05 11:59:05 -07:00
accel
accounting
admin-guide syscall_user_dispatch: Use CONFIG_SYSCTL for sysctl guard 2026-09-07 14:00:56 +02:00
arch platform-drivers-x86 for v7.3-1 2026-08-24 10:16:35 -07:00
block A handful of late-arriving fixes, a Japanese translation that was ready 2026-08-26 09:25:12 -07:00
bpf bpf, arm64: Convert struct_ops arena arguments in the trampoline 2026-08-14 05:55:02 +02:00
cdrom
core-api mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
cpu-freq
crypto This update includes the following changes: 2026-08-19 17:25:42 -07:00
dev-tools mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
devicetree drm next/fixes for 7.3-rc1 2026-08-28 16:37:55 -07:00
doc-guide
driver-api More ACPI support updates for 7.3-rc1 2026-08-26 14:06:08 -07:00
edac
fault-injection nvme: add opcode filtering for fault injection 2026-08-19 07:51:23 -07:00
fb
features alpha: enable lockdep hardirq state tracking 2026-07-19 13:16:26 +02:00
filesystems A wide variety of mostly CephFS fixes and cleanups, split between 2026-08-28 11:51:05 -07:00
firmware_class
firmware-guide docs: ACPI: DSD: motorcomm: fix docs build error 2026-07-21 15:23:16 +02:00
fpga
gpu DRM Rust changes for v7.3-rc1 2026-08-10 14:48:11 +10:00
hid HID: add documentation and Coccinelle script for FF registration race 2026-08-14 14:46:20 +02:00
hwmon Char/Misc/IIO/etc driver update for 7.3-rc1 2026-08-25 09:38:50 -07:00
i2c
iio
images
infiniband
input
kbuild
kernel-hacking Documentation: locking.rst: update deprecated function 2026-07-15 10:51:27 -06:00
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices docs: misc: amd-sbi: Document SBTSI userspace interface 2026-07-17 15:50:48 +02:00
mm mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
netlabel
netlink neighbour: Enforce min/max to NDTPA_INTERVAL_PROBE_TIME_MS. 2026-09-11 17:25:13 -07:00
networking tcp: do not let tcp_rmem be set below 4096 2026-09-15 15:21:17 +02:00
nvdimm
nvme
PCI Documentation: PCI: Document how to write PCI Host Controller drivers 2026-08-12 14:20:48 -05:00
pcmcia
peci
power
process Coccinelle patches for Linux v7.3 2026-08-30 10:42:40 -07:00
RCU doc: RCU: Fix brackets 2026-07-23 10:47:10 -07:00
rust docs: rust: quick-start: remove Ubuntu 25.10 2026-08-10 06:44:10 +02:00
scheduler sched_ext: Fixes for v7.3-rc1 2026-08-31 13:13:35 -07:00
scsi scsi: leapraid: Standardize NCQ priority sysfs attributes 2026-08-23 21:57:41 -04:00
security Landlock update for v7.3-rc1 2026-08-21 12:28:35 -07:00
sound ALSA: usb-audio: Reverse MIXER_GET_CUR_BROKEN as MIXER_GET_CUR_OK 2026-08-23 11:03:34 +02:00
sphinx docs: maintainers_include: fix entry names 2026-07-16 15:45:12 -06:00
sphinx-includes
sphinx-static Documentation: html: adjust sidebar section titles styling 2026-08-05 13:37:41 -06:00
spi docs: spi: add documentation for userspace device instantiation 2026-08-06 19:13:15 +01:00
staging
sunrpc/xdr nfsd: add support to CB_NOTIFY for dir attribute changes 2026-08-10 09:54:35 -04:00
target
tee
timers
tools Documentation/rtla: Document unsetting options 2026-08-05 10:14:40 +02:00
trace perf tools updates for v7.3 2026-08-22 08:47:50 -07:00
translations irqdomain: Delete irq_domain_add_linear() 2026-09-04 08:40:07 +02:00
usb usb: gadget: f_uac1_legacy: remove broken string configfs attributes 2026-07-17 12:33:37 +02:00
userspace-api mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
virt Arm: 2026-08-25 11:48:04 -07:00
w1
watchdog docs: watchdog: npcm: Add reset status description 2026-08-10 09:00:04 -07:00
wmi
.gitignore
.renames.txt
atomic_bitops.txt
atomic_t.txt
Changes
CodingStyle
conf.py docs: conf.py: fix the 'utf-8' typo 2026-08-11 10:45:54 -06:00
docutils.conf
index.rst Documentation: html: show sections in the sidebar 2026-08-05 13:04:26 -06:00
Kconfig
Makefile
memory-barriers.txt
SubmittingPatches
subsystem-apis.rst