Skip to content

tcp: protect locked SO_RCVBUF from Silly Window Syndrome

Ankit Jain linux-kselftest lkml netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesIn review
  2. v22 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- Changed GRO detection from checking tp->advmss to skb->len > len based on Eric Dumazet's suggestion. This correctly detects GRO packets even if they contain tiny segments.
- Updated packetdrill script. Removed the ad-hoc mss 48 configuration. It now uses a standard 1460 MSS and sends varying packet sizes (600, 700, 800 bytes) to naturally trigger the scaling_ratio recalculation.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tcp: protect locked SO_RCVBUF from Silly Window Syndromenet/ipv4/tcp_input.c+6 -12 replies
2/2selftests/net: add packetdrill test for locked SO_RCVBUF SWStools/testing/selftests/net/packetdrill/tcp_locked_rcvbuf_sws.pkt+29 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH net v3 0/2] tcp: protect locked SO_RCVBUF from Silly Window Syndrome

This patch series fixes Silly Window Syndrome (SWS) for sockets using locked SO_RCVBUF.

When applications like Tomcat lock SO_RCVBUF, receiving small packets causes the memory truesize penalty to drop the scaling_ratio to 1. This shrinks the internal window clamp and leads to 504 Gateway Timeouts.

Patch 1 bypasses this penalty for locked sockets, except for GRO packets. Patch 2 adds a packetdrill test to validate this fix.

Link to v1:
https://lore.kernel.org/all/[email protected]/
Link to v2:
https://lore.kernel.org/all/[email protected]/

v2 -> v3:
- Changed GRO detection from checking tp->advmss to skb->len > len based on Eric Dumazet's suggestion. This correctly detects GRO packets even if they contain tiny segments.
- Updated packetdrill script. Removed the ad-hoc mss 48 configuration. It now uses a standard 1460 MSS and sends varying packet sizes (600, 700, 800 bytes) to naturally trigger the scaling_ratio recalculation.

Testing:
- Verified fix in a live Java/Tomcat environment (504 timeouts resolved).
- Passed the newly added packetdrill test demonstrating the clamp bypass.
- Passed upstream regression tests: tcp_rcv_neg_window.pkt, tcp_rcv_wnd_shrink_allowed.pkt, tcp_rcv_wnd_shrink_nomem.pkt, tcp_rcv_zero_wnd_fin.pkt, and tcp_rcv_big_endseq.pkt

Ankit Jain (2):
tcp: protect locked SO_RCVBUF from Silly Window Syndrome selftests/net: add packetdrill test for locked SO_RCVBUF SWS

 net/ipv4/tcp_input.c                          |  7 ++++-
 .../net/packetdrill/tcp_locked_rcvbuf_sws.pkt | 29 +++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/net/packetdrill/tcp_locked_rcvbuf_sws.pkt
Signature · 1 line
2.53.0