linux/net
Tejas Birajdar ca10634ebc tcp: honor BPF_SOCK_OPS_RWND_INIT on the active connect path
BPF_SOCK_OPS_RWND_INIT lets a sockops BPF program pick the initial TCP
receive window, e.g. to advertise a larger window up front in environments
where that is known to be safe. Today it is only effective for the passive
(listener) side; on the active (connect) side the value is computed and
then silently discarded.

On the passive path tcp_openreq_init_rwin() inflates full_space when the
program returns a non-zero window, so tcp_select_initial_window() can offer
it:

	else if (full_space < (u64)rcv_wnd * mss)
		full_space = min_t(u64, (u64)rcv_wnd * mss, INT_MAX);

tcp_select_initial_window() only clamps the requested window *down* to the
available space, so without inflating the space first the BPF reply can
never raise the offered window above tcp_full_space(sk).

tcp_connect_init() calls tcp_rwnd_init_bpf() but never inflates full_space,
so on connect() the requested window is clamped back to tcp_full_space(sk)
(~64KB at the default rcvbuf) and the program's value is ignored.

Inflate full_space in tcp_connect_init() as well; tp->advmss is the mss the
listener path uses (both are tcp_mss_clamp(tp, dst_metric_advmss(dst))).
Read full_space after tcp_rwnd_init_bpf() so a program that also adjusts
SO_RCVBUF is still reflected. Compute the inflated value in u64 and clamp
to INT_MAX to avoid overflow (full_space is int, rcv_wnd is u32), and
apply the same overflow fix to the existing listener-side computation.

tcp_select_initial_window() itself also computes init_rcv_wnd * mss in
32-bit when clamping the offered window down to the requested value. A
large requested window (init_rcv_wnd greater than ~2.9M segments at
1460 mss) wraps this multiply and collapses the offered window to a tiny
value, so compute it in u64 as well.

Signed-off-by: Tejas Birajdar <tejasbirajdar@meta.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260730220055.2946171-1-tejasbirajdar@meta.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-06 11:32:46 -07:00
..
6lowpan net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
9p 9p: Add missing read barrier in virtio zero-copy path 2026-06-21 05:22:57 +00:00
802 appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
8021q vlan: defer real device state propagation to netdev_work 2026-06-25 10:18:40 -07:00
atm atm: remove unused exported helpers 2026-07-29 17:54:58 -07:00
batman-adv Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-10 10:20:05 +02:00
bluetooth Bluetooth: SCO: give the socket its own sco_conn reference 2026-07-28 16:13:48 -04:00
bpf bpf: Fix partial copy of non-linear test_run output 2026-06-21 17:55:06 -07:00
bridge Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
can can: isotp: check register_netdevice_notifier() error in module init 2026-07-29 11:26:41 +02:00
ceph libceph: bound pg_{temp,upmap,upmap_items} length to CEPH_PG_MAX_SIZE 2026-07-23 20:29:42 +02:00
core rtnetlink: cap IFLA_VFINFO_LIST at a documented number of VFs 2026-08-06 12:42:49 +02:00
dcb
devlink devlink: Expose external flag for PCI SF ports 2026-08-05 16:39:54 -07:00
dns_resolver net: dns_resolver: allow shorter names in dns_query() 2026-07-27 18:25:36 -07:00
dsa netfilter pull request 26-07-31 2026-08-05 16:26:00 -07:00
ethernet
ethtool ethtool: rss: Fix hfunc and input_xfrm parsing on big endian 2026-07-09 11:38:30 +02:00
handshake handshake: Require admin permission for DONE command 2026-06-12 15:45:44 -07:00
hsr net: hsr: allow PRP RedBox (interlink) creation 2026-07-27 17:46:41 -07:00
ieee802154 ieee802154: convert dgram getsockopt to sockopt_t 2026-08-03 16:55:23 -07:00
ife net: ife: require ETH_HLEN to be pullable in ife_decode() 2026-06-13 17:34:39 -07:00
ipv4 tcp: honor BPF_SOCK_OPS_RWND_INIT on the active connect path 2026-08-06 11:32:46 -07:00
ipv6 netfilter pull request 26-07-31 2026-08-05 16:26:00 -07:00
iucv net/af_iucv: fix NULL deref in afiucv_hs_callback_syn() 2026-07-21 13:36:35 -07:00
kcm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-16 14:59:58 -07:00
key ipsec-2026-06-22 2026-06-23 16:22:24 -07:00
l2tp net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
l3mdev
lapb
llc llc: fix SAP refcount leak when creating incoming sockets 2026-07-17 13:17:46 +02:00
mac80211 Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
mac802154 mac802154: hold an interface reference across the scan worker 2026-07-23 10:37:46 -07:00
mctp mctp: check register_netdevice_notifier() error in mctp_device_init() 2026-07-23 09:17:36 -07:00
mpls net: mpls: initialize rtm_tos in mpls_getroute() 2026-07-28 11:06:06 +02:00
mptcp mptcp: fix BUILD_BUG_ON on legacy ARM config 2026-07-23 10:50:38 -07:00
ncsi
netfilter netfilter: conntrack: tcp: use UNACK timeout for non-closing RST packets 2026-07-31 14:47:03 +02:00
netlabel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-11 14:33:35 -07:00
netlink netlink: drop unneeded semicolon 2026-08-05 17:32:34 -07:00
nfc nfc: nci: uart: Constify struct tty_ldisc_ops 2026-06-11 20:21:32 +02:00
nsh
openvswitch openvswitch: vport: remove infrastructure for separate modules 2026-08-06 15:09:23 +02:00
packet net/packet: avoid fanout hook re-registration after unregister 2026-07-20 18:15:20 -07:00
phonet phonet: pep: convert getsockopt to sockopt_t 2026-08-03 16:55:23 -07:00
psample net: psample: fix info leak in PSAMPLE_ATTR_DATA 2026-06-17 16:35:50 -07:00
psp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
qrtr net: qrtr: restrict socket creation to the initial network namespace 2026-07-23 07:44:00 -07:00
rds rds: synchronize info callbacks with module unload 2026-08-05 17:51:48 -07:00
rfkill Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
rxrpc rxrpc: fix io_thread race in rxrpc_wake_up_io_thread() 2026-07-21 11:52:29 +02:00
sched Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
shaper net: shaper: add a note that we expect cap dumps to be tiny 2026-06-11 12:55:23 +02:00
smc net/smc: fix socket use-after-free during link group termination 2026-07-28 11:22:43 +02:00
strparser
sunrpc SUNRPC: pin upper rpc_clnt across the TLS connect_worker 2026-07-08 14:07:19 -04:00
switchdev
tipc tipc: avoid use-after-free in poll trace queue dumps 2026-07-27 15:18:59 -07:00
tls tls: convert getsockopt to sockopt_t 2026-08-03 16:55:23 -07:00
unix af_unix: fix listen() succeeding on sockets in the wrong state 2026-07-24 15:10:05 -07:00
vmw_vsock Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-23 14:07:40 -07:00
wireless Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-07-30 12:53:19 -07:00
x25 net/x25: fix use-after-free in x25_kill_by_neigh() 2026-07-23 11:58:20 +02:00
xdp xsk: account ring allocations to memcg 2026-08-05 19:32:39 -07:00
xfrm Merge branch 'big-tcp-for-udp-tunnels' 2026-07-22 13:49:03 +02:00
compat.c
devres.c
Kconfig appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
Kconfig.debug
Makefile appletalk: move the protocol out of tree 2026-06-16 14:37:06 -07:00
socket.c Networking changes for 7.2. 2026-06-17 08:17:00 +01:00
sysctl_net.c