Skip to content

tcp: address KCSAN reports in tcp_poll() (part I)

Eric Dumazet netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9tcp: add rcu protection around tp->fastopen_rskinclude/linux/tcp.h net/core/request_sock.c net/ipv4/inet_connection_sock.c +8 more+35 -240 replies
2/9tcp: annotate tp->rcv_nxt lockless readsnet/ipv4/tcp.c net/ipv4/tcp_diag.c net/ipv4/tcp_input.c +3 more+15 -100 replies
3/9tcp: annotate tp->copied_seq lockless readsnet/ipv4/tcp.c net/ipv4/tcp_diag.c net/ipv4/tcp_input.c +4 more+19 -180 replies
4/9tcp: annotate tp->write_seq lockless readsinclude/net/tcp.h net/ipv4/tcp.c net/ipv4/tcp_diag.c +4 more+36 -280 replies
5/9tcp: annotate tp->snd_nxt lockless readsinclude/net/tcp.h net/ipv4/tcp.c net/ipv4/tcp_minisocks.c +1 more+13 -90 replies
6/9tcp: annotate tp->urg_seq lockless readsnet/ipv4/tcp.c net/ipv4/tcp_input.c+4 -30 replies
7/9tcp: annotate sk->sk_rcvbuf lockless readsinclude/net/tcp.h include/trace/events/sock.h net/core/filter.c +4 more+15 -120 replies
8/9tcp: annotate sk->sk_sndbuf lockless readsinclude/net/sock.h net/core/filter.c net/core/sock.c +2 more+25 -160 replies
9/9tcp: annotate sk->sk_wmem_queued lockless readsinclude/net/sock.h include/trace/events/sock.h net/core/datagram.c +5 more+24 -190 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH net 0/9] tcp: address KCSAN reports in tcp_poll() (part I)

This all started with a KCSAN report (included in "tcp: annotate tp->rcv_nxt lockless reads" changelog)

tcp_poll() runs in a lockless way. This means that about all accesses of tcp socket fields done in tcp_poll() context need annotations otherwise KCSAN will complain about data-races.

While doing this detective work, I found a more serious bug, addressed by the first patch ("tcp: add rcu protection around tp->fastopen_rsk").

Eric Dumazet (9):
tcp: add rcu protection around tp->fastopen_rsk
tcp: annotate tp->rcv_nxt lockless reads
tcp: annotate tp->copied_seq lockless reads
tcp: annotate tp->write_seq lockless reads
tcp: annotate tp->snd_nxt lockless reads
tcp: annotate tp->urg_seq lockless reads
tcp: annotate sk->sk_rcvbuf lockless reads
tcp: annotate sk->sk_sndbuf lockless reads
tcp: annotate sk->sk_wmem_queued lockless reads

 include/linux/tcp.h             |  6 +--
 include/net/sock.h              | 29 ++++++++++-----
 include/net/tcp.h               |  7 ++--
 include/trace/events/sock.h     |  4 +-
 net/core/datagram.c             |  2 +-
 net/core/filter.c               |  6 ++-
 net/core/request_sock.c         |  2 +-
 net/core/skbuff.c               |  2 +-
 net/core/sock.c                 | 22 ++++++-----
 net/ipv4/inet_connection_sock.c |  4 +-
 net/ipv4/inet_diag.c            |  2 +-
 net/ipv4/tcp.c                  | 65 +++++++++++++++++++--------------
 net/ipv4/tcp_diag.c             |  5 ++-
 net/ipv4/tcp_fastopen.c         |  2 +-
 net/ipv4/tcp_input.c            | 37 +++++++++++--------
 net/ipv4/tcp_ipv4.c             | 28 ++++++++------
 net/ipv4/tcp_minisocks.c        | 17 ++++++---
 net/ipv4/tcp_output.c           | 32 ++++++++--------
 net/ipv4/tcp_timer.c            | 11 +++---
 net/ipv6/tcp_ipv6.c             | 18 +++++----
 net/sched/em_meta.c             |  2 +-
 21 files changed, 175 insertions(+), 128 deletions(-)
Signature · 1 line
2.23.0.700.g56cf767bdb-goog