From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v11 7/7] selftests: mptcp: cover msg_zerocopy test
Date: Fri, 27 Nov 2026 13:06:00 +0000 [thread overview]
Message-ID: <sashiko-outbox-237461@kernel.org> (raw)
In-Reply-To: <52f67bef0305ff81d900244811035f639a16bd05.1795783388.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] mptcp: missing skb zerocopy tracking in mptcp_sendmsg_frag()
without SG
- [Medium] mptcp: broken zerocopy handling for fastopen in
mptcp_sendmsg()
- [Low] selftests: mptcp: pass -z before positional test arg in
msg_zerocopy.sh
--
commit f03babdacde6ac2c280f3aacb29db133993b9706
Author: Geliang Tang <geliang@kernel.org>
selftests: mptcp: cover msg_zerocopy test
This commit adds a msg_zerocopy.sh wrapper script and build rules to the
MPTCP selftest suite to run the net msg_zerocopy test when MPTCP zerocopy
is supported.
> diff --git a/tools/testing/selftests/net/mptcp/msg_zerocopy.sh b/tools/testing/selftests/net/mptcp/msg_zerocopy.sh
> new file mode 100755
> index 0000000000000..de2807df225a0
> --- /dev/null
> +++ b/tools/testing/selftests/net/mptcp/msg_zerocopy.sh
> @@ -0,0 +1,15 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +. "$(dirname "${0}")/mptcp_lib.sh"
> +
> +mptcp_lib_check_mptcp
> +
> +BIN="$(dirname "${0}")/msg_zerocopy"
> +if ! "${BIN}" -4 -t 1 check || ! "${BIN}" -4 -t 1 check -z; then
[Severity: Low]
Does passing -z after check fail in parse_opts() when getopt() does not
permute argv (such as with musl libc or POSIXLY_CORRECT)?
tools/testing/selftests/net/msg_zerocopy.c:parse_opts() stops option
parsing at the non-option argument check and requires optind == argc - 1,
aborting via usage() when -z trails the positional test name. The same
"${BIN} -4 -t 1 check -z" argument order appears in commit "selftests:
net: msg_zerocopy: add MPTCP support" in
tools/testing/selftests/net/msg_zerocopy.sh; passing -z before check
("${BIN}" -4 -t 1 -z check) avoids both failures.
> + mptcp_lib_pr_skip "MPTCP zerocopy not supported"
> + mptcp_lib_fail_if_expected_feature "MPTCP zerocopy"
> + exit "${KSFT_SKIP}"
> +fi
> +
> +exec "$(dirname "${0}")/../msg_zerocopy.sh" "$@"
[Severity: High]
In commit "mptcp: add MSG_ZEROCOPY support" earlier in this series, does
mptcp_sendmsg_frag() attach a pinned user page to the subflow skb without
zerocopy tracking when the subflow route lacks NETIF_F_SG?
net/mptcp/protocol.c:mptcp_sendmsg_frag() {
...
} else {
get_page(dfrag->page);
skb_fill_page_desc(skb, i, dfrag->page, offset, copy);
if (dfrag->ubuf && !skb_zcopy(skb) &&
ssk->sk_route_caps & NETIF_F_SG) {
skb_zcopy_set(skb, dfrag->ubuf, NULL);
skb_shinfo(skb)->flags |= SKBFL_PURE_ZEROCOPY;
zc = true;
}
}
...
}
mptcp_sendmsg_zerocopy_iter() pins the user page into dfrag->page without
checking subflow NETIF_F_SG, and mptcp_sendmsg_frag() unconditionally adds
dfrag->page to the skb. When ssk->sk_route_caps does not have NETIF_F_SG,
skb_zcopy_set() is skipped, so the skb holds a reference to the user page
with no ubuf reference or SKBFL_ZEROCOPY_FRAG flag: dfrag_clear() can
complete the zerocopy notification while the skb still references the user
page, and skb_orphan_frags_rx() skips skb_copy_ubufs() on local delivery.
[Severity: Medium]
Also in commit "mptcp: add MSG_ZEROCOPY support", does the fastopen path
in mptcp_sendmsg() mishandle ubuf for both MSG_FASTOPEN and DEFER_CONNECT?
net/mptcp/protocol.c:mptcp_sendmsg() {
...
if (unlikely(inet_test_bit(DEFER_CONNECT, sk) ||
msg->msg_flags & MSG_FASTOPEN)) {
int copied_syn = 0;
if (zc && (msg->msg_flags & MSG_FASTOPEN)) {
uarg_to_msgzc(ubuf)->zerocopy = 0;
zc = false;
}
ret = mptcp_sendmsg_fastopen(sk, msg, len, &copied_syn,
zc ? ubuf : NULL);
copied += copied_syn;
if (ret == -EINPROGRESS && copied_syn > 0)
goto out;
...
}
When MSG_FASTOPEN is set, clearing zc before the call makes zc ? ubuf :
NULL evaluate to NULL, so tcp_send_syn_data() takes no reference on ubuf
and the goto out path drops the only reference via net_zcopy_put(ubuf),
queuing the completion notification before the SYN data is acknowledged.
When DEFER_CONNECT (TCP_FASTOPEN_CONNECT) is used without MSG_FASTOPEN,
uarg_to_msgzc(ubuf)->zerocopy remains 1 even though tcp_send_syn_data()
copies the SYN payload into a kernel page frag, so the completion
notification omits SO_EE_CODE_ZEROCOPY_COPIED.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795783388.git.tanggeliang@kylinos.cn?part=7
next prev parent reply other threads:[~2026-11-27 13:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 12:45 [PATCH mptcp-next v11 0/7] mptcp: add MSG_ZEROCOPY support Geliang Tang
2026-11-27 12:45 ` [PATCH mptcp-next v11 1/7] mptcp: use local variable tp in sendmsg_frag Geliang Tang
2026-11-27 12:45 ` [PATCH mptcp-next v11 2/7] mptcp: remove redundant orig_offset in carve_data_frag Geliang Tang
2026-11-27 12:45 ` [PATCH mptcp-next v11 3/7] mptcp: add MSG_ZEROCOPY support Geliang Tang
2026-11-27 13:13 ` sashiko-bot
2026-11-27 12:45 ` [PATCH mptcp-next v11 4/7] mptcp: handle SO_ZEROCOPY in setsockopt Geliang Tang
2026-11-27 12:45 ` [PATCH mptcp-next v11 5/7] Documentation: msg_zerocopy: add MPTCP support Geliang Tang
2026-11-27 12:45 ` [PATCH mptcp-next v11 6/7] selftests: net: " Geliang Tang
2026-11-27 13:00 ` sashiko-bot
2026-11-27 12:45 ` [PATCH mptcp-next v11 7/7] selftests: mptcp: cover msg_zerocopy test Geliang Tang
2026-11-27 13:06 ` sashiko-bot [this message]
2026-11-27 14:57 ` [PATCH mptcp-next v11 0/7] mptcp: add MSG_ZEROCOPY 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=sashiko-outbox-237461@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@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.