Skip to content

tcp: take care of tcp_get_timestamping_opt_stats() races

Eric Dumazet netdev 1 version Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 0 repliesApplied 14/14

Patches in v1 All 14 applied

#Subject and filesSizeRepliesApplied
1/14tcp: annotate data-races in tcp_get_info_chrono_stats()include/net/tcp.h net/ipv4/tcp.c+17 -70 repliesApplied
2/14tcp: add data-race annotations around tp->data_segs_out and tp->total_retransnet/ipv4/tcp.c net/ipv4/tcp_output.c+7 -50 repliesApplied
3/14tcp: add data-races annotations around tp->reordering, tp->snd_cwndinclude/net/tcp.h net/ipv4/tcp.c net/ipv4/tcp_input.c +1 more+14 -120 repliesApplied
4/14tcp: annotate data-races around tp->snd_ssthreshnet/core/filter.c net/ipv4/tcp.c net/ipv4/tcp_bbr.c +11 more+32 -300 repliesApplied
5/14tcp: annotate data-races around tp->delivered and tp->delivered_ceinclude/net/tcp_ecn.h net/ipv4/tcp.c net/ipv4/tcp_input.c+7 -70 repliesApplied
6/14tcp: add data-race annotations for TCP_NLA_SNDQ_SIZEnet/ipv4/tcp.c net/ipv4/tcp_input.c net/ipv4/tcp_output.c+6 -40 repliesApplied
7/14tcp: annotate data-races around tp->bytes_sentnet/ipv4/tcp.c net/ipv4/tcp_output.c+3 -20 repliesApplied
8/14tcp: annotate data-races around tp->bytes_retransnet/ipv4/tcp.c net/ipv4/tcp_output.c+3 -30 repliesApplied
9/14tcp: annotate data-races around tp->dsack_dupsnet/ipv4/tcp.c net/ipv4/tcp_input.c+2 -20 repliesApplied
10/14tcp: annotate data-races around tp->reord_seennet/ipv4/tcp.c net/ipv4/tcp_input.c+3 -30 repliesApplied
11/14tcp: annotate data-races around tp->srtt_usnet/ipv4/tcp.c net/ipv4/tcp_input.c+4 -30 repliesApplied
12/14tcp: annotate data-races around tp->timeout_rehashnet/ipv4/tcp.c net/ipv4/tcp_timer.c+3 -20 repliesApplied
13/14tcp: annotate data-races around (tp->write_seq - tp->snd_nxt)net/ipv4/tcp.c+2 -10 repliesApplied
14/14tcp: annotate data-races around tp->plb_rehashnet/ipv4/tcp.c net/ipv4/tcp_plb.c+3 -20 repliesApplied

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH net 00/14] tcp: take care of tcp_get_timestamping_opt_stats() races

tcp_get_timestamping_opt_stats() does not own the socket lock, this is intentional.

It calls tcp_get_info_chrono_stats() while other threads could change chrono fields in tcp_chrono_set(). It also reads many tcp socket fields that can be modified by other cpus/threads.

I do not think we need coherent TCP socket state snapshot in tcp_get_timestamping_opt_stats().

Add READ_ONCE()/WRITE_ONCE() or data_race() annotations.

Note that icsk_ca_state is a bitfield, thus not covered in this series.

Eric Dumazet (14):
tcp: annotate data-races in tcp_get_info_chrono_stats()
tcp: add data-race annotations around tp->data_segs_out and

    tp->total_retrans

tcp: add data-races annotations around tp->reordering, tp->snd_cwnd
tcp: annotate data-races around tp->snd_ssthresh
tcp: annotate data-races around tp->delivered and tp->delivered_ce
tcp: add data-race annotations for TCP_NLA_SNDQ_SIZE
tcp: annotate data-races around tp->bytes_sent
tcp: annotate data-races around tp->bytes_retrans
tcp: annotate data-races around tp->dsack_dups
tcp: annotate data-races around tp->reord_seen
tcp: annotate data-races around tp->srtt_us
tcp: annotate data-races around tp->timeout_rehash
tcp: annotate data-races around (tp->write_seq - tp->snd_nxt)
tcp: annotate data-races around tp->plb_rehash

 include/net/tcp.h       | 12 +++++---
 include/net/tcp_ecn.h   |  2 +-
 net/core/filter.c       |  2 +-
 net/ipv4/tcp.c          | 64 ++++++++++++++++++++++++-----------------
 net/ipv4/tcp_bbr.c      |  6 ++--
 net/ipv4/tcp_bic.c      |  2 +-
 net/ipv4/tcp_cdg.c      |  4 +--
 net/ipv4/tcp_cubic.c    |  6 ++--
 net/ipv4/tcp_dctcp.c    |  2 +-
 net/ipv4/tcp_input.c    | 42 ++++++++++++++-------------
 net/ipv4/tcp_metrics.c  |  6 ++--
 net/ipv4/tcp_nv.c       |  4 +--
 net/ipv4/tcp_output.c   | 19 ++++++------
 net/ipv4/tcp_plb.c      |  2 +-
 net/ipv4/tcp_timer.c    |  2 +-
 net/ipv4/tcp_vegas.c    |  9 +++---
 net/ipv4/tcp_westwood.c |  4 +--
 net/ipv4/tcp_yeah.c     |  3 +-
 18 files changed, 107 insertions(+), 84 deletions(-)
Signature · 1 line
2.54.0.rc1.513.gad8abe7a5a-goog