From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81548181CEE; Wed, 17 Jul 2024 15:10:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721229012; cv=none; b=pAuple5TMhnfY/vE/gPpCMLFN7U/r46YkEp0PDhuT45Mp3N6YLd1+7jzsj9liEtACnb8oyRZf5hjtk3R0xv8vsXhS4LKWEv7LhDpplOy2GOrYAQeEs/gNyGdceJgwgHFMZAt7iZjt7AQ1tv2qw9Sz17j9yMKjZhz6c5hLJ5uu/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721229012; c=relaxed/simple; bh=zQiRJOqalHUnatNyl71T2glIefnb7xlR1qihZel3g3U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hXt5zIO2M+eYFGkAhsh3uiOqz6cdZLtxRdtWpVXWoTlvaR17nYUbdDVAOw/XqxD+XMleI+ULlHQHpz5wnQU/urBQ/esBgzmn7aEDR8w5yTdDZTabkV/qg7Wx6d0ly0YvR9Po/nbOVQNCQEchAIJIJWYgmHJYUqyyoe8fhTzsuC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o43QFE8v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o43QFE8v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87A74C4AF0B; Wed, 17 Jul 2024 15:10:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721229012; bh=zQiRJOqalHUnatNyl71T2glIefnb7xlR1qihZel3g3U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=o43QFE8vVgEQ3sQayaBMwsmYEo+yTxpThLWajQQysalzEbY82XM9zyj2UVLWcy0DI sDWNcU6Pev2zLkwGq4SyN/XIkyWJOBW6Bojgxykm24qVPd7s11pLUxcBOfrZqIiu4g 9iroMDIh1QDwVJY2IwvB1+hpRj05jz5Hrz87Mtt//S14JDiX1ESR/sg26cPMnz+6OC I72kaO8kMlfD9H/OsGPKiLxVIqeA/ee9PyF48JlBXUbJ8NkQmtor8nT0O7CPkC7RmY GRXeiUnO5rHuG6cyAJsQ5XcggNJXYYSao5mziJ8RwOnk0zFniTHPWuFsuHIFram92a 5uA9Ny5KWJxUQ== Message-ID: <310de142-e263-4bcd-b499-69e0640de51e@kernel.org> Date: Wed, 17 Jul 2024 17:09:58 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH net] tcp: process the 3rd ACK with sk_socket for for TFO/MPTCP Content-Language: en-GB To: Eric Dumazet , Neal Cardwell Cc: mptcp@lists.linux.dev, "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , Kuniyuki Iwashima , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240716-upstream-net-next-20240716-tcp-3rd-ack-consume-sk_socket-v1-1-4e61d0b79233@kernel.org> From: Matthieu Baerts Autocrypt: addr=matttbe@kernel.org; keydata= xsFNBFXj+ekBEADxVr99p2guPcqHFeI/JcFxls6KibzyZD5TQTyfuYlzEp7C7A9swoK5iCvf YBNdx5Xl74NLSgx6y/1NiMQGuKeu+2BmtnkiGxBNanfXcnl4L4Lzz+iXBvvbtCbynnnqDDqU c7SPFMpMesgpcu1xFt0F6bcxE+0ojRtSC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XK2e+Cbv5PXf19ce3XluaE+wA8D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== Organization: NGI0 Core In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Eric, On 17/07/2024 16:57, Eric Dumazet wrote: > On Tue, Jul 16, 2024 at 12:43 PM Matthieu Baerts (NGI0) > wrote: >> >> The 'Fixes' commit recently changed the behaviour of TCP by skipping the >> processing of the 3rd ACK when a sk->sk_socket is set. The goal was to >> skip tcp_ack_snd_check() in tcp_rcv_state_process() not to send an >> unnecessary ACK in case of simultaneous connect(). Unfortunately, that >> had an impact on TFO and MPTCP. >> >> I started to look at the impact on MPTCP, because the MPTCP CI found >> some issues with the MPTCP Packetdrill tests [1]. Then Paolo suggested >> me to look at the impact on TFO with "plain" TCP. >> >> For MPTCP, when receiving the 3rd ACK of a request adding a new path >> (MP_JOIN), sk->sk_socket will be set, and point to the MPTCP sock that >> has been created when the MPTCP connection got established before with >> the first path. The newly added 'goto' will then skip the processing of >> the segment text (step 7) and not go through tcp_data_queue() where the >> MPTCP options are validated, and some actions are triggered, e.g. >> sending the MPJ 4th ACK [2] as demonstrated by the new errors when >> running a packetdrill test [3] establishing a second subflow. >> >> This doesn't fully break MPTCP, mainly the 4th MPJ ACK that will be >> delayed. Still, we don't want to have this behaviour as it delays the >> switch to the fully established mode, and invalid MPTCP options in this >> 3rd ACK will not be caught any more. This modification also affects the >> MPTCP + TFO feature as well, and being the reason why the selftests >> started to be unstable the last few days [4]. >> >> For TFO, the existing 'basic-cookie-not-reqd' test [5] was no longer >> passing: if the 3rd ACK contains data, these data would no longer be >> processed, and thus not ACKed. >> >> Note that for MPTCP, in case of simultaneous connect(), a fallback to >> TCP will be done, which seems fine: >> >> `../common/defaults.sh` >> >> 0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_MPTCP) = 3 >> +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) >> >> +0 > S 0:0(0) >> +0 < S 0:0(0) win 1000 >> +0 > S. 0:0(0) ack 1 >> +0 < S. 0:0(0) ack 1 win 65535 >> >> +0 write(3, ..., 100) = 100 >> +0 > . 1:1(0) ack 1 >> +0 > P. 1:101(100) ack 1 >> >> Link: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/9936227696 [1] >> Link: https://datatracker.ietf.org/doc/html/rfc8684#fig_tokens [2] >> Link: https://github.com/multipath-tcp/packetdrill/blob/mptcp-net-next/gtests/net/mptcp/syscalls/accept.pkt#L28 [3] >> Link: https://netdev.bots.linux.dev/contest.html?executor=vmksft-mptcp-dbg&test=mptcp-connect-sh [4] >> Link: https://github.com/google/packetdrill/blob/master/gtests/net/tcp/fastopen/server/basic-cookie-not-reqd.pkt#L21 [5] >> Fixes: 23e89e8ee7be ("tcp: Don't drop SYN+ACK for simultaneous connect().") >> Suggested-by: Paolo Abeni >> Signed-off-by: Matthieu Baerts (NGI0) >> --- >> Notes: >> - We could also drop this 'goto consume', and send the unnecessary ACK >> in this simultaneous connect case, which doesn't seem to be a "real" >> case, more something for fuzzers. >> - When sending this patch, the 'Fixes' commit is only in net-next, this >> patch is then on top of net-next. But because net-next will be merged >> into -net soon -- judging by the PR that has been sent to Linus a few >> hours ago -- the 'net' prefix is then used. >> --- >> net/ipv4/tcp_input.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c >> index ff9ab3d01ced..a89b3ee57d8c 100644 >> --- a/net/ipv4/tcp_input.c >> +++ b/net/ipv4/tcp_input.c >> @@ -6820,7 +6820,13 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) >> if (sk->sk_shutdown & SEND_SHUTDOWN) >> tcp_shutdown(sk, SEND_SHUTDOWN); >> >> - if (sk->sk_socket) >> + /* In simult-connect cases, sk_socket will be assigned. But also >> + * with TFO and MPTCP (MPJ) while they required further >> + * processing later in tcp_data_queue(). >> + */ >> + if (sk->sk_socket && >> + TCP_SKB_CB(skb)->seq == TCP_SKB_CB(skb)->end_seq && >> + !sk_is_mptcp(sk)) >> goto consume; >> break; >> > > Hi Matthieu > > I had no time yet to run all our packetdrill tests with Kuniyuki patch > because of the ongoing netdev conference. > > Is it ok for you if we hold your patch for about 5 days ? Sure, no problem, take your time! > I would like to make sure we did not miss anything else. I understand! > I am CCing Neal, perhaps he can help to expedite the testing part > while I am busy. Thank you, no urgency here. If it's OK with you, I can send a v2 using Kuniyuki's suggestion -- simply limiting the bypass to SYN+ACK only -- because it is simpler and ready to be sent, but also to please the CI because my v1 was rejected by the CI because I sent it just before the sync with Linus tree. We can choose later to pick the v2, the previous one, or a future one. Cheers, Matt -- Sponsored by the NGI0 Core fund.