Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
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 patch is only a partial fix.
--
selftests: mptcp: sockopt: pass total bytes to do_getsockopts
After its read loop, connect_one_server() passed the return value of the
last read() to do_getsockopts() instead of the accumulated byte count.
This patch passes the total, so a partial final read() no longer trips
the write_seq assert in the MPTCP_INFO checks.
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/638
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> index b6e58d936ebe5..7b4ccbe10ae18 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> @@ -627,7 +627,7 @@ static void connect_one_server(int fd, int pipefd)
> if (s.tcpi_rcv_delta)
> assert(s.tcpi_rcv_delta <= total);
>
> - do_getsockopts(&s, fd, ret, ret);
> + do_getsockopts(&s, fd, total, total);
[Severity: Medium]
The client side looks right now. Does the server side of the same echo
test have the same partial read problem?
The commit message says read() on a stream socket can return a partial
chunk. The peer function, process_one_client(), still does one read and
treats its result as the whole client payload, which is 128 to 4094
bytes sent with a single write():
tools/testing/selftests/net/mptcp/mptcp_sockopt.c:process_one_client() {
...
ret = read(fd, buf, sizeof(buf));
if (ret < 0)
die_perror("read");
assert(s.mptcpi_rcv_delta <= (uint64_t)ret);
if (s.tcpi_rcv_delta)
assert(s.tcpi_rcv_delta == (uint64_t)ret);
ret2 = write(fd, buf, ret);
...
/* wait for hangup */
ret3 = read(fd, buf, 1);
if (ret3 != 0)
xerror("expected EOF, got %lu", ret3);
do_getsockopts(&s, fd, ret, ret2);
...
}
If this first read() comes back short, the server echoes only ret bytes.
The client is still blocked in its loop waiting for len bytes, and the
rest of its payload is still in the server's receive queue.
Wouldn't the "wait for hangup" read() then return 1 rather than 0, so
that the "expected EOF" xerror() fires?
The partial ret is also used as the full received byte count in the
tcpi_rcv_delta assert and in do_getsockopts(&s, fd, ret, ret2). It is
used again in the mptcpi_rcv_delta != ret + 1 check and the
mptcpi_bytes_received and mptcpi_bytes_acked checks. That is the same
wrong byte count this patch fixes on the client.
Once the server exits, the client loop in connect_one_server() would see
EOF with total < len and fail too.
Since the client fix only holds when the server's single read() got the
whole payload, should process_one_client() also loop until it has read
the full payload, as connect_one_server() does?
None of the later patches in the series, including "selftests: mptcp:
sockopt: drop unreachable FIN accounting", appear to touch
process_one_client().
>
> if (eof)
> total += 1; /* sequence advances due to FIN */
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org