From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796441788; b=LmeNNtosU2P+8G9jmiQAIODWAJNQ0k+Oa6XBgC9F32MoBU4yLDnk6PclIAKpb6QJaswQ 2cn7zIz1B0iOmQNh9A3OQoIatPIQi4uapri1On3v05MLAqN3pglxd0n2s1j1TBQ70NZaM OsYwhjzrEJ3N6iw78/C3kZyYezwoXJhA/f6IT09atVqK5SckhFyF+rrUTsPbDumWzKAir XVS/2luzDYCeI3X5d3GWiWZbpPOI1O9WSTuDfw3P6RqVUvLrdfx9aYuW10ZFnRFfMs8Xp FM/rcS9Lg5/ru7+/AZKtyhxRj+10OQR7rjqbJiYTlXJsAnC/hT6DC0BighkFFErWn9w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796441788; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Cq1ZWBojNTscmsc2hcUhBQsK5GS/979cvaM3l7uqP6Q=; b=jBMShIUnMh2s/Q6temjd012kgNHlcbuuSgA9/3z3GmFqn7LfyRIgt49BMWULpoHJOwlk hU3f2jTNnF39CCmPlj6QGQMoQFiBZ43Fg18qDM50oY1HwTlpoj5CpAYZlx6wobK0zzZNI Lz3Ba1A4BZfkKu6zeXnHYwOcAdtRqzMnBcDdKgyr516CiPepSYQbq9bj1JG39NQSZQ7ak Oa7wK1D9FNPRWG7ME3dgLualLv8gVgaJA4mRNz02OCRiCcabBDkN1fBZZx7Wve0dXhGlW wZNVSVcWGz5eLWbV01PTopikMliTPmcutZkbnsuRARBqZwLBi+OCVdmfheb1v4BWCaw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RgeuBL68; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94360606A322 for ; Sat, 5 Dec 2026 03:36:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RgeuBL68 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECEA1F0092B; Sat, 5 Dec 2026 03:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796441788; bh=Cq1ZWBojNTscmsc2hcUhBQsK5GS/979cvaM3l7uqP6Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RgeuBL68lqcaw+mBDNQzg0k3Kgovj/KIt0Bh6si53lVpXFLVHVVTFQISYkPeojxPq miw39fOsEdI+npYNY9RF7l7BNVDiEHbOOvYsiWT0AbLzW5FkzIUm5YJhBAJsuzrP2P ThNOlMiYSGd9LkfJRlCyjJ7BqYpGg93KOIG8G6nhyCqRlC5X6ycGyx4/O7ukRd43c/ dl/f/5g7dsRkNvHOk0VCMDMCoehYG7gWGQQjcr07Es3YXkQrAONZSmM7zKJtagRe6a C9Ng+DfZu3x3Pk8jaJCG9tEmhQH8sEPf75BZ/hp56UEbamxZPK8rdqSCW8hjegmQ7K RwsIk09zt/TwQ== Subject: Re: [PATCH mptcp-next v11 3/4] mptcp: add sendmsg_locked to proto_ops From: netdev-bot+sashiko@kernel.org To: geliang@kernel.org Cc: mptcp@lists.linux.dev, kuba@kernel.org Date: Sat, 05 Dec 2026 03:36:27 +0000 Message-ID: <179644178783.3143.13573021588431972169@kernel.org> In-Reply-To: <7def44fa9bd1baa6b31e5c544630ef37aa753b01.1796308130.git.geliang@kernel.org> References: <7def44fa9bd1baa6b31e5c544630ef37aa753b01.1796308130.git.geliang@kernel.org> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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 ', but the only Signed-off-by is 'Geliang Tang '. - [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 [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