All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: geliang@kernel.org
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-next v8 2/7] selftests: mptcp: connect: check TFO SIOCINQ overflow
Date: Wed, 18 Nov 2026 01:05:44 +0000	[thread overview]
Message-ID: <179496394474.3133.5669457989174147035@kernel.org> (raw)
In-Reply-To: <297fb247e71d06c3c496de844410be5dd0dd1fd0.1794826541.git.geliang@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message says that when waiting for the remote key
  times out, the test skips the SIOCINQ check instead of failing.
- [Low] The commit message for "selftests: mptcp: connect: check TFO
  SIOCINQ overflow" does not mention the kernel fix this test checks for.

--

selftests: mptcp: connect: check TFO SIOCINQ overflow

This commit adds a SIOCINQ check to mptcp_connect's server mode when
MPTFO is enabled. The server polls until MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED
is set, with a limit of poll_timeout. It then fails the test if SIOCINQ
returns INT_MAX.

> Wait for MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED using poll() bounded by
> poll_timeout, then check if SIOCINQ returns INT_MAX. Use poll() instead
> of usleep() to detect dead connections via POLLHUP/POLLERR. Add SOL_MPTCP
> fallback definition and handle ENOPROTOOPT/EOPNOTSUPP errors to skip the
> wait for TCP or fallback sockets. Skip SIOCINQ check on timeout rather
> than failing the test.
>
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>

[Severity: Low]
Should this commit refer to the kernel fix it tests? The previous patch in
the series, "mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint", has:

  Fixes: f03afb3aeb9d ("mptcp: drop __mptcp_fastopen_gen_msk_ackseq()")

This patch has no Fixes: tag and does not mention that fix.

The new check in main_loop_s() will report "TFO SIOCINQ overflow" on any
kernel that has f03afb3aeb9d but not the fix. Stable maintainers would
need to know that the two patches go together.

Also, the sentence "Use poll() instead of usleep() to detect dead
connections via POLLHUP/POLLERR" reads like a changelog from an earlier
version. This patch does not replace any usleep() based wait. Should that
text go below the --- line?

> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index 178d98d91fea2..143d8177b5a33 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c

[ ... ]

> @@ -1176,6 +1180,48 @@ static void maybe_close(int fd)
>  		close(fd);
>  }
>  
> +static int wait_for_remote_key(int fd)
> +{
> +	struct mptcp_info info;
> +	int timeout_ms = 10;
> +	struct pollfd pfd;
> +	int elapsed = 0;
> +	socklen_t olen;
> +	int ret;
> +
> +	pfd.fd = fd;
> +	pfd.events = 0;
> +
> +	while (elapsed < poll_timeout || poll_timeout < 0) {
> +		ret = poll(&pfd, 1, timeout_ms);

[ ... ]

> +		if (info.mptcpi_flags & MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED)
> +			return 0;
> +
> +		elapsed += timeout_ms;
> +	}
> +	fprintf(stderr,
> +		"TFO: timeout waiting for remote key, skip SIOCINQ check\n");
> +	return 1;
> +}

[Severity: Medium]
Can this timeout path really skip the SIOCINQ check, as the commit message
says?

The loop in wait_for_remote_key() is limited by the global poll_timeout.
The client uses the same idle timeout in copyfd_io_poll():

tools/testing/selftests/net/mptcp/mptcp_connect.c:copyfd_io_poll() {
    ...
		switch (poll(&fds, 1, poll_timeout)) {
		...
		case 0:
			fprintf(stderr, "%s: poll timed out (events: "
				"POLLIN %u, POLLOUT %u)\n", __func__,
				fds.events & POLLIN, fds.events & POLLOUT);
			return 2;
		}
    ...
}

main_loop_s() calls wait_for_remote_key() after accept() and before
copyfd_io(). The server does not read or write while it waits.
mptcp_connect.sh starts both sides with -t ${timeout_poll}, which is 30
seconds.

Each iteration counts 10 ms in elapsed, but the poll() and getsockopt()
calls take at least that long. The real wait is therefore longer than
poll_timeout.

Suppose a non-fallback MPTCP socket never gets the remote key. By then the
client has filled the socket buffers or called shut_wr(), and it sees no
more poll events. Won't the client hit its own poll timeout at about the
same time, usually first, and exit with 2? do_transfer() would then report
a failure with "client exit code 2".

That turns the skip into a 30 second stall followed by a client failure
that depends on timing. Would a separate, much shorter limit for the
remote key wait give the intended behavior?

With -t 0 (poll_timeout == -1) this loop never ends. That matches what
-t 0 does for the other polls in the tool.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794826541.git.geliang%40kernel.org

  reply	other threads:[~2026-11-18  1:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 10:57 [PATCH mptcp-next v8 0/7] prepare interfaces for kTLS and sockmap support Geliang Tang
2026-11-16 10:57 ` [PATCH mptcp-net v8 1/7] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko
2026-11-16 10:57 ` [PATCH mptcp-next v8 2/7] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko [this message]
2026-11-16 10:57 ` [PATCH mptcp-next v8 3/7] mptcp: implement peek_len for proto_ops Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko
2026-11-16 10:57 ` [PATCH mptcp-next v8 4/7] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko
2026-11-16 10:57 ` [PATCH mptcp-next v8 5/7] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko
2026-11-16 10:57 ` [PATCH mptcp-next v8 6/7] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-11-18  1:05   ` netdev-bot+sashiko
2026-11-16 10:57 ` [PATCH mptcp-next v8 7/7] mptcp: update mptcp_check_readable Geliang Tang
2026-11-16 13:38 ` [PATCH mptcp-next v8 0/7] prepare interfaces for kTLS and sockmap support 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=179496394474.3133.5669457989174147035@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.