mbox series

[v2,net-next,0/4] tcp: fix tcp_poll() races

Message ID 20240528125253.1966136-1-edumazet@google.com (mailing list archive)
Headers show
Series tcp: fix tcp_poll() races | expand

Message

Eric Dumazet May 28, 2024, 12:52 p.m. UTC
Flakes in packetdrill tests stressing epoll_wait()
were root caused to bad ordering in tcp_write_err()

Precisely, we have to call sk_error_report() after
tcp_done().

When fixing this issue, we discovered tcp_abort(),
tcp_v4_err() and tcp_v6_err() had similar issues.

Since tcp_reset() has the correct ordering,
first patch takes part of it and creates
tcp_done_with_error() helper.

v2: added @err parameter to tcp_done_with_error()
    as suggested by David Laight.

Eric Dumazet (4):
  tcp: add tcp_done_with_error() helper
  tcp: fix race in tcp_write_err()
  tcp: fix races in tcp_abort()
  tcp: fix races in tcp_v[46]_err()

 include/net/tcp.h    |  1 +
 net/ipv4/tcp.c       |  8 ++------
 net/ipv4/tcp_input.c | 32 +++++++++++++++++++++-----------
 net/ipv4/tcp_ipv4.c  | 11 +++--------
 net/ipv4/tcp_timer.c |  6 +-----
 net/ipv6/tcp_ipv6.c  | 10 +++-------
 6 files changed, 31 insertions(+), 37 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 30, 2024, 12:30 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 28 May 2024 12:52:49 +0000 you wrote:
> Flakes in packetdrill tests stressing epoll_wait()
> were root caused to bad ordering in tcp_write_err()
> 
> Precisely, we have to call sk_error_report() after
> tcp_done().
> 
> When fixing this issue, we discovered tcp_abort(),
> tcp_v4_err() and tcp_v6_err() had similar issues.
> 
> [...]

Here is the summary with links:
  - [v2,net-next,1/4] tcp: add tcp_done_with_error() helper
    https://git.kernel.org/netdev/net-next/c/5e514f1cba09
  - [v2,net-next,2/4] tcp: fix race in tcp_write_err()
    https://git.kernel.org/netdev/net-next/c/853c3bd7b791
  - [v2,net-next,3/4] tcp: fix races in tcp_abort()
    https://git.kernel.org/netdev/net-next/c/5ce4645c23cf
  - [v2,net-next,4/4] tcp: fix races in tcp_v[46]_err()
    https://git.kernel.org/netdev/net-next/c/fde6f897f2a1

You are awesome, thank you!