From: netdev-bot+sashiko@kernel.org
To: geliang@kernel.org
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-next v11 3/4] mptcp: add sendmsg_locked to proto_ops
Date: Sat, 05 Dec 2026 03:36:27 +0000 [thread overview]
Message-ID: <179644178783.3143.13573021588431972169@kernel.org> (raw)
In-Reply-To: <7def44fa9bd1baa6b31e5c544630ef37aa753b01.1796308130.git.geliang@kernel.org>
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] The patch adds .sendmsg_locked = mptcp_sendmsg_locked to
mptcp_stream_ops and mptcp_v6_stream_ops (net/mptcp/protocol.c:5110…
- [Low] The commit message says "Unlike tcp_sendmsg_locked(),
mptcp_sendmsg_locked() drops the MSG_SPLICE_PAGES flag from the mask".
- [Low] The commit author is 'Geliang Tang <geliang@kernel.org>', but the
only Signed-off-by is 'Geliang Tang <tanggeliang@kylinos.cn>'.
- [Low] Publishing mptcp_sendmsg_locked() as proto_ops->sendmsg_locked
exposes an implementation that cannot meet the calling context the…
--
mptcp: add sendmsg_locked to proto_ops
This splits mptcp_sendmsg() into two parts. mptcp_sendmsg_locked() expects
the caller to already own the msk socket lock, and a small wrapper takes
and drops the lock around it. The patch also adds a msk_owned_by_me()
assertion and exposes the locked variant as .sendmsg_locked in
mptcp_stream_ops and mptcp_v6_stream_ops.
> Unlike tcp_sendmsg_locked(), mptcp_sendmsg_locked() drops the
> MSG_SPLICE_PAGES flag from the mask. Future kTLS and sockmap support
> will require additional changes to call through proto_ops->sendmsg_locked
> instead of tcp_sendmsg_locked() directly.
[Severity: Low]
Is this description complete? The patch leaves the existing mask in
mptcp_sendmsg_locked() unchanged:
msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL |
MSG_FASTOPEN | MSG_EOR;
MSG_SPLICE_PAGES was never part of that mask. The same mask also silently
clears other internal flags that tcp_sendmsg_locked() honours, such as
MSG_ZEROCOPY and MSG_SENDPAGE_DECRYPTED. For the second one,
tcp_sendmsg_locked() does this:
net/ipv4/tcp.c:tcp_sendmsg_locked() {
...
skb->decrypted = !!(flags & MSG_SENDPAGE_DECRYPTED);
...
}
kTLS device offload sets MSG_SENDPAGE_DECRYPTED in tls_push_data() and
tls_device_write_space(), and kTLS is named here as a future user. Today
there is no runtime effect, because no in-tree caller passes these flags
to an MPTCP socket.
Could the commit message list every flag that gets dropped and explain why
dropping it is safe? Alternatively, could mptcp_sendmsg_locked() reject
unsupported internal flags instead of silently ignoring them?
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
[Severity: Low]
This isn't a bug, but the author address is geliang@kernel.org while the
only Signed-off-by uses tanggeliang@kylinos.cn. checkpatch reports this as
FROM_SIGN_OFF_MISMATCH.
The first two patches of the series have the same mismatch, while
"mptcp: update mptcp_check_readable" has a geliang@kernel.org sign-off.
Could a sign-off with the author address be added?
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 4be1990e2a243..c75a1158f33ec 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -2140,12 +2140,12 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
> int ret = 0;
> long timeo;
>
> + msk_owned_by_me(msk);
> +
[Severity: Low]
Does this assertion check the locking state that the function body needs?
msk_owned_by_me() goes through sock_owned_by_me() and
lockdep_sock_is_held(). That check also passes for a caller that holds
only sk_lock.slock:
include/net/sock.h:lockdep_sock_is_held() {
return lockdep_is_held(&sk->sk_lock) ||
lockdep_is_held(&sk->sk_lock.slock);
}
Both existing generic users of this hook call it in atomic context while
holding only the spinlock:
esp_output_tcp_finish()
bh_lock_sock(sk)
espintcp_push_skb()
espintcp_sendskb_locked()
skb_send_sock_locked()
sendmsg_locked()
sock->ops->sendmsg_locked()
ovpn_tcp_send_skb()
spin_lock_nested(&sk->sk_lock.slock, OVPN_TCP_DEPTH_NESTING)
ovpn_tcp_send_sock()
skb_send_sock_locked_with_flags()
sendmsg_locked()
sock->ops->sendmsg_locked()
mptcp_sendmsg_locked() always does this:
mptcp_sendmsg_locked()
mptcp_rate_check_app_limited()
mptcp_data_lock(sk) /* spin_lock_bh(&sk->sk_lock.slock) */
__mptcp_push_pending() also calls lock_sock(ssk), which can sleep, even
when MSG_DONTWAIT is set.
With a caller like that, wouldn't this either self-deadlock on
sk_lock.slock or sleep in atomic context, while the assertion still
passes?
Nothing in the tree reaches this today: MPTCP rejects TCP_ULP, and ovpn
rejects IPPROTO_MPTCP sockets. However, kTLS, the named future user, pushes
records from tls_device_write_space() with GFP_ATOMIC and MSG_DONTWAIT.
Could this assert real ownership instead, for example with
sock_owned_by_user_nocheck() plus might_sleep()? Or could the requirement
that this hook needs lock_sock() held in process context be documented?
> /* silently ignore everything else */
> msg->msg_flags &= MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL |
> MSG_FASTOPEN | MSG_EOR;
[ ... ]
> @@ -5097,6 +5107,7 @@ static const struct proto_ops mptcp_stream_ops = {
> .set_rcvlowat = mptcp_set_rcvlowat,
> .read_sock = mptcp_read_sock,
> .splice_read = mptcp_splice_read,
> + .sendmsg_locked = mptcp_sendmsg_locked,
> };
[Severity: Low]
Is there any path that can call this hook on an MPTCP socket? The same
question applies to the matching entry in mptcp_v6_stream_ops.
The only generic dispatcher is sendmsg_locked() in net/core/skbuff.c. It is
reached through skb_send_sock_locked() and
skb_send_sock_locked_with_flags(), and the in-tree users of those are
espintcp and ovpn.
espintcp is a TCP ULP, and mptcp_setsockopt_sol_tcp() rejects ULPs:
case TCP_ULP:
return -EOPNOTSUPP;
ovpn_socket_attach() only accepts IPPROTO_UDP and IPPROTO_TCP. An MPTCP
socket has sk_protocol == IPPROTO_MPTCP, so ovpn returns -EOPNOTSUPP.
Sockmap is also excluded: mptcp_subflow_init() sets
tcp_prot_override.psock_update_sk_prot = NULL, and skmsg only uses the
unlocked skb_send_sock(). kTLS, tcp_bpf and espintcp call
tcp_sendmsg_locked() directly.
The commit message says "certain upper layers need to call the sendmsg
method while the socket lock is already held", but none of those layers can
reach this hook. The rest of the series doesn't add a caller either.
"mptcp: update mptcp_check_readable" only touches poll and readability.
Could this hook be added together with its first user, so the contract can
be reviewed against a real call site?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1796308130.git.geliang%40kernel.org
next prev parent reply other threads:[~2026-12-05 3:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 14:32 [PATCH mptcp-next v11 0/4] prepare interfaces for kTLS and sockmap support Geliang Tang
2026-12-03 14:32 ` [PATCH mptcp-next v11 1/4] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-12-03 14:59 ` sashiko-bot
2026-12-05 3:36 ` netdev-bot+sashiko
2026-12-03 14:32 ` [PATCH mptcp-next v11 2/4] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-12-03 14:32 ` [PATCH mptcp-next v11 3/4] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-12-05 3:36 ` netdev-bot+sashiko [this message]
2026-12-03 14:32 ` [PATCH mptcp-next v11 4/4] mptcp: update mptcp_check_readable Geliang Tang
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=179644178783.3143.13573021588431972169@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.