From 99fc45e1f02c012a98df2b3dadf0f7ef50dca209 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Wed, 12 Oct 2022 11:52:30 +0200 Subject: [PATCH] mptcp: validate TFO_CONNECT with blocking sendmsg Our CI found a deadlock when validating MSG_FASTOPEN, see: https://cirrus-ci.com/task/6007236538400768 Paolo noticed it can also happen with TCP_CONNECT_FASTOPEN. Here is a new test to reproduce the deadlock. The calltrace is visible when the test is stopped (timeout or CTRL+C). Co-developed-by: Paolo Abeni Signed-off-by: Paolo Abeni Signed-off-by: Matthieu Baerts (cherry picked from commit b047d8ab38d8c8b0ccee28b919638b43c3ac3238) Signed-off-by: Matthieu Baerts --- ...nt-TCP_FASTOPEN_CONNECT-blocking-sendmsg.pkt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 gtests/net/mptcp/fastopen/client-TCP_FASTOPEN_CONNECT-blocking-sendmsg.pkt diff --git a/gtests/net/mptcp/fastopen/client-TCP_FASTOPEN_CONNECT-blocking-sendmsg.pkt b/gtests/net/mptcp/fastopen/client-TCP_FASTOPEN_CONNECT-blocking-sendmsg.pkt new file mode 100644 index 00000000..3f233a9a --- /dev/null +++ b/gtests/net/mptcp/fastopen/client-TCP_FASTOPEN_CONNECT-blocking-sendmsg.pkt @@ -0,0 +1,17 @@ +// Send data in SYN with a blocking sendto() +--tolerance_usecs=100000 +`../common/defaults.sh + sysctl -q net.ipv4.tcp_fastopen=0x5` + + 0.0 socket(..., SOCK_STREAM, IPPROTO_MPTCP) = 3 ++0.0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 ++0.0 setsockopt(3, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0 ++0.0 connect(3, ..., ...) = 0 + +// Switch to "blocking" mode, only the msk should be "blocked" ++0.0 fcntl(3, F_SETFL, O_RDWR) = 0 ++0...0.4 sendto(3, ..., 500, 0, ..., ...) = 500 + ++0.0 > S 0:500(500) ++0.4 < S. 0:0(0) ack 501 win 65535 ++0.0 > . 501:501(0) ack 1