netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] tcp: fix handling of stale syncookies timestamps
@ 2019-12-05  0:58 Guillaume Nault
  2019-12-05  0:59 ` [PATCH net v2 1/2] tcp: fix rejected syncookies due to stale timestamps Guillaume Nault
  2019-12-05  0:59 ` [PATCH net v2 2/2] tcp: tighten acceptance of ACKs not matching a child socket Guillaume Nault
  0 siblings, 2 replies; 8+ messages in thread
From: Guillaume Nault @ 2019-12-05  0:58 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski; +Cc: netdev, Eric Dumazet, Arnd Bergmann

The synflood timestamps (->ts_recent_stamp and ->synq_overflow_ts) are
only refreshed when the syncookie protection triggers. Therefore, their
value can become very far apart from jiffies if no synflood happens for
a long time.

If jiffies grows too much and wraps while the synflood timestamp isn't
refreshed, then time_after32() might consider the later to be in the
future. This can trick tcp_synq_no_recent_overflow() into returning
erroneous values and rejecting valid ACKs.

Patch 1 handles the case of ACKs using legitimate syncookies.
Patch 2 handles the case of stray ACKs.

Changes from v1:
  - Initialising timestamps at socket creation time is not enough
    because jiffies wraps in 24 days with HZ=1000 (Eric Dumazet).
    Handle stale timestamps in tcp_synq_overflow() and
    tcp_synq_no_recent_overflow() instead.
  - Rework commit description.
  - Add a second patch to handle the case of stray ACKs.

Guillaume Nault (2):
  tcp: fix rejected syncookies due to stale timestamps
  tcp: tighten acceptance of ACKs not matching a child socket

 include/net/tcp.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

-- 
@DaveM, I'm sending both patches in one series as they logically fit
together, although patch 2 is arguably a performance optimisation. I
can drop it from the series and repost it when net-next reopens if
you prefer. Although that'd make the link between the two less obvious.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-05 19:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-05  0:58 [PATCH net v2 0/2] tcp: fix handling of stale syncookies timestamps Guillaume Nault
2019-12-05  0:59 ` [PATCH net v2 1/2] tcp: fix rejected syncookies due to stale timestamps Guillaume Nault
2019-12-05  0:59 ` [PATCH net v2 2/2] tcp: tighten acceptance of ACKs not matching a child socket Guillaume Nault
2019-12-05  3:08   ` Eric Dumazet
2019-12-05 18:00     ` Guillaume Nault
2019-12-05 18:14       ` Eric Dumazet
2019-12-05 19:22         ` Guillaume Nault
2019-12-05 19:30           ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).