From: netdev-bot+sashiko@kernel.org
To: geliang@kernel.org
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-next v27 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow
Date: Mon, 16 Nov 2026 03:44:25 +0000 [thread overview]
Message-ID: <179480066581.3133.2291623347932821892@kernel.org> (raw)
In-Reply-To: <ac3de6c2e3d3593a1737af35c3681cc129c5e552.1794663678.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] When the remote key never arrives, the new TFO SIOCINQ check
passes without testing anything.
- [Low] The TCP_CM_INQ check in mptcp_connect.c is now out of step with
the kernel's new inq semantics.
--
selftests: mptcp: connect: check TFO SIOCINQ overflow
This commit adds a SIOCINQ check to the server mode of mptcp_connect
when the MPTFO socket option is enabled. After accepting a connection,
the server polls MPTCP_INFO until MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED is
set, bounded by poll_timeout. It then fails if SIOCINQ returns INT_MAX.
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 178d98d91fea2..152976d39d464 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
[ ... ]
> @@ -1176,6 +1180,47 @@ static void maybe_close(int fd)
> close(fd);
> }
>
> +static int wait_for_remote_key(int fd)
> +{
[ ... ]
> + while (elapsed < poll_timeout || poll_timeout < 0) {
[ ... ]
> + if (info.mptcpi_flags & MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED)
> + return 0;
> +
> + elapsed += timeout_ms;
> + }
> + fprintf(stderr, "TFO: timeout waiting for remote key\n");
> + return 0;
> +}
[Severity: Low]
On timeout, wait_for_remote_key() returns 0, which is also what it
returns when the key arrives. Can main_loop_s() then report a pass on a
kernel that still has the regression?
On the unfixed kernel, mptcp_inq_hint() computes
ack_seq - head->map_seq. mptcp_fastopen_subflow_synack_set_params() sets
a dummy map_seq:
MPTCP_SKB_CB(skb)->map_seq = -skb->len;
msk->ack_seq stays 0 until subflow_set_remote_key() runs:
WRITE_ONCE(msk->ack_seq, subflow->iasn);
WRITE_ONCE(msk->can_ack, true);
MPTCP_INFO reports can_ack as MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED. Before
the key arrives, the old hint is 0 - (-len) = len, not INT_MAX. So the
avail == INT_MAX check in main_loop_s() cannot fire on the timeout path.
The commit message says this is intentional:
"Print a warning if the remote key does not arrive within the timeout,
but continue with the SIOCINQ check rather than failing the test."
In that case, though, the SIOCINQ check can never fail.
Would it be better to skip or fail the test when the key never arrives
on a socket that is still MPTCP and has not fallen back to TCP?
> int main_loop_s(int listensock)
> {
> struct sockaddr_storage ss;
> @@ -1207,6 +1252,22 @@ int main_loop_s(int listensock)
> check_sockaddr(pf, &ss, salen);
> check_getpeername(remotesock, &ss, salen);
>
> + if (cfg_sockopt_types.mptfo) {
> + int avail;
> +
> + if (wait_for_remote_key(remotesock) < 0) {
> + close(remotesock);
> + return 1;
> + }
> +
> + if (ioctl(remotesock, SIOCINQ, &avail) == 0 &&
> + avail == INT_MAX) {
> + fprintf(stderr, "TFO SIOCINQ overflow\n");
> + close(remotesock);
> + return 1;
> + }
> + }
[Severity: Low]
This is outside the hunk, but this patch is the selftest update for the
series. Should do_recvmsg_cmsg() in mptcp_connect.c also be updated for
the new inq semantics?
The earlier patch "mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint"
makes mptcp_inq_hint() return mptcp_data_avail(). With N bytes unread
after DATA_FIN, the hint is now N instead of N+1. It returns 1 only when
nothing is queued and the socket is closed or has RCV_SHUTDOWN.
do_recvmsg_cmsg() still assumes the TCP-style N+1 rule:
if (cfg_cmsg_types.tcp_inq) {
if ((size_t)ret < len && last_hint > (unsigned int)ret) {
if (ret + 1 != (int)last_hint) {
...
} else {
tcp_inq.expect_eof = true;
}
}
}
The hint now equals exactly the queued in-order bytes. A short read
therefore returns at least last_hint bytes, so last_hint > ret can never
be true for MPTCP. As a result, the expect_eof branch never runs, and
neither does the later "expected EOF" check.
The only in-tree TCPINQ user is do_transfer() in mptcp_sockopt.sh, which
runs MPTCP on both ends. So in-tree runs no longer exercise this check.
No later patch in the series seems to change it either.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794663678.git.tanggeliang%40kylinos.cn
next prev parent reply other threads:[~2026-11-16 3:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 14:00 [PATCH mptcp-next v27 0/8] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-11-14 14:00 ` [PATCH mptcp-next v27 1/8] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-16 3:44 ` netdev-bot+sashiko
2026-11-14 14:00 ` [PATCH mptcp-next v27 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-16 3:44 ` netdev-bot+sashiko [this message]
2026-11-14 14:00 ` [PATCH mptcp-next v27 3/8] mptcp: fix fallback dummy mapping anchor Geliang Tang
2026-11-14 14:01 ` [PATCH mptcp-next v27 4/8] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-11-14 14:01 ` [PATCH mptcp-next v27 5/8] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-11-16 3:44 ` netdev-bot+sashiko
2026-11-14 14:01 ` [PATCH mptcp-next v27 6/8] mptcp: remove CB offset field Geliang Tang
2026-11-14 14:29 ` sashiko-bot
2026-11-16 3:44 ` netdev-bot+sashiko
2026-11-14 14:01 ` [PATCH mptcp-next v27 7/8] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-11-14 14:41 ` sashiko-bot
2026-11-16 3:44 ` netdev-bot+sashiko
2026-11-14 14:01 ` [PATCH mptcp-next v27 8/8] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-11-16 3:44 ` netdev-bot+sashiko
2026-11-14 15:52 ` [PATCH mptcp-next v27 0/8] Reduce the differences between TCP and MPTCP for TLS usage MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179480066581.3133.2291623347932821892@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=geliang@kernel.org \
--cc=kuba@kernel.org \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.