[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+Pe+yMnGUTUbg=---VB1RO1KDfRLrZjaUVM7OHktMw2g@mail.gmail.com>
Date: Thu, 3 Nov 2022 18:24:55 -0700
From: Eric Dumazet <edumazet@...gle.com>
To: Lu Wei <luwei32@...wei.com>
Cc: davem@...emloft.net, yoshfuji@...ux-ipv6.org, dsahern@...nel.org,
kuba@...nel.org, pabeni@...hat.com, xemul@...allels.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch net v5] tcp: prohibit TCP_REPAIR_OPTIONS if data was
already sent
On Thu, Nov 3, 2022 at 6:22 PM Lu Wei <luwei32@...wei.com> wrote:
>
> If setsockopt with option name of TCP_REPAIR_OPTIONS and opt_code
> of TCPOPT_SACK_PERM is called to enable sack after data is sent
> and dupacks are received , it will trigger a warning in function
> tcp_verify_left_out() as follows:
>
> In function tcp_timeout_mark_lost(), tp->sacked_out will be cleared if
> Step7 not happen and the warning will not be triggered. As suggested by
> Denis and Eric, TCP_REPAIR_OPTIONS should be prohibited if data was
> already sent.
>
> socket-tcp tests in CRIU has been tested as follows:
> $ sudo ./test/zdtm.py run -t zdtm/static/socket-tcp* --keep-going \
> --ignore-taint
>
> socket-tcp* represent all socket-tcp tests in test/zdtm/static/.
>
> Fixes: b139ba4e90dc ("tcp: Repair connection-time negotiated parameters")
> Signed-off-by: Lu Wei <luwei32@...wei.com>
> ---
> v5: modify the commit message
> net/ipv4/tcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index ef14efa1fb70..54836a6b81d6 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3647,7 +3647,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
> case TCP_REPAIR_OPTIONS:
> if (!tp->repair)
> err = -EINVAL;
> - else if (sk->sk_state == TCP_ESTABLISHED)
> + else if (sk->sk_state == TCP_ESTABLISHED && !tp->bytes_sent)
> err = tcp_repair_options_est(sk, optval, optlen);
> else
> err = -EPERM;
> --
> 2.31.1
>
SGTM, thanks.
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists