Skip to contentSkip to conversation

mptcp: a bunch of data race fixes

PATCH In review Paolo Abeni 4 participants 15 messages May 18, 2023 – May 24, 2023

Subsystems (2)
lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

v2 cover mptcp: a bunch of data race fixes

The patch 1 && 4 are direct response to recently reported KCSAN splat.

The patch 2 && 3 are just by code inspection of related code path. Patch 3/5 is there mostly to make the next one simple, even if the race mentioned in such patch should be real (but very tiny, if possible at all).

This iteration addresses a compile warning in patch 2/5 reported by kbuild bot.

Patch 5/5 is new in this round, fixes an unrelated issue found by code inspection. I should have posted separatelly

Paolo Abeni (5):
mptcp: add annotations around msk->subflow accesses
mptcp: consolidate passive msk socket initialization
mptcp: fix data race around msk->first access
mptcp: add annotations around sk->sk_shutdown accesses
mptcp: fix active subflow finalization.

 net/mptcp/protocol.c | 111 +++++++++++++++++++++++++++----------------
 net/mptcp/protocol.h |  14 ++++--
 net/mptcp/subflow.c  |  28 +----------
 3 files changed, 81 insertions(+), 72 deletions(-)
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH v2 1/5 mptcp: add annotations around msk->subflow accesses

The MPTCP can access the first subflow socket in a few spots outside the socket lock scope. That is actually safe, as MPTCP will delete the socket itself only after the msk sock close().

Still the such accesses causes a few KCSAN splats, as reported by Christoph. Silence the harmless warning adding a few annotation around the relevant accesses.

Fixes 71ba088ce0aa ("mptcp: cleanup accept and poll")
---
 net/mptcp/protocol.c | 18 ++++++++++--------
 net/mptcp/protocol.h |  6 +++++-
 2 files changed, 15 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +10 -8
index 93eac61e7ba7..b96b1191763a 100644
@@ -91,7 +91,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk)
 		return err;
 
 	msk->first = ssock->sk;
-	msk->subflow = ssock;
+	WRITE_ONCE(msk->subflow, ssock);
 	subflow = mptcp_subflow_ctx(ssock->sk);
 	list_add(&subflow->node, &msk->conn_list);
 	sock_hold(ssock->sk);
@@ -2309,7 +2309,7 @@ static void mptcp_dispose_initial_subflow(struct mptcp_sock *msk)
 {
 	if (msk->subflow) {
 		iput(SOCK_INODE(msk->subflow));
-		msk->subflow = NULL;
+		WRITE_ONCE(msk->subflow, NULL);
 	}
 }
 
@@ -3184,7 +3184,7 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
 	msk = mptcp_sk(nsk);
 	msk->local_key = subflow_req->local_key;
 	msk->token = subflow_req->token;
-	msk->subflow = NULL;
+	WRITE_ONCE(msk->subflow, NULL);
 	msk->in_accept_queue = 1;
 	WRITE_ONCE(msk->fully_established, false);
 	if (mp_opt->suboptions & OPTION_MPTCP_CSUMREQD)
@@ -3233,7 +3233,7 @@ static struct sock *mptcp_accept(struct sock *sk, int flags, int *err,
 	struct socket *listener;
 	struct sock *newsk;
 
-	listener = msk->subflow;
+	listener = READ_ONCE(msk->subflow);
 	if (WARN_ON_ONCE(!listener)) {
 		*err = -EINVAL;
 		return NULL;
@@ -3784,10 +3784,10 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
 
 	pr_debug("msk=%p", msk);
 
-	/* buggy applications can call accept on socket states other then LISTEN
+	/* Buggy applications can call accept on socket states other then LISTEN
 	 * but no need to allocate the first subflow just to error out.
 	 */
-	ssock = msk->subflow;
+	ssock = READ_ONCE(msk->subflow);
 	if (!ssock)
 		return -EINVAL;
 
@@ -3863,10 +3863,12 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 	state = inet_sk_state_load(sk);
 	pr_debug("msk=%p state=%d flags=%lx", msk, state, msk->flags);
 	if (state == TCP_LISTEN) {
-		if (WARN_ON_ONCE(!msk->subflow || !msk->subflow->sk))
+		struct socket *ssock = READ_ONCE(msk->subflow);
+
+		if (WARN_ON_ONCE(!ssock || !ssock->sk))
 			return 0;
 
-		return inet_csk_listen_poll(msk->subflow->sk);
+		return inet_csk_listen_poll(ssock->sk);
 	}
 
 	if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) {
net/mptcp/protocol.h +5 -1
index 1e8effe395d8..552d7b06aaa9 100644
@@ -304,7 +304,11 @@ struct mptcp_sock {
 	struct list_head rtx_queue;
 	struct mptcp_data_frag *first_pending;
 	struct list_head join_list;
-	struct socket	*subflow; /* outgoing connect/listener/!mp_capable */
+	struct socket	*subflow; /* outgoing connect/listener/!mp_capable
+				   * The mptcp ops can safely dereference, using suitable
+				   * ONCE annotation, the subflow outside the socket
+				   * lock as such sock is freed after close().
+				   */
 	struct sock	*first;
 	struct mptcp_pm_data	pm;
 	struct mptcp_sched_ops	*sched;
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH v2 2/5 mptcp: consolidate passive msk socket initialization

In reply to Paolo Abeni

When the msk socket is cloned at MPC handshake time, a few fields are initializated in a racy way outside mptcp_sk_clone() and the msk socket lock.

The above is due historical reasons: before commit a88d0092b24b ("mptcp: simplify subflow_syn_recv_sock()") as the first subflow socket carrying all the needed date was not available yet at msk creation time

We can now refactor the code moving the missing initialization bit under the socket lock, removing the init race and avoiding some code duplication.

This will also simplify the next patch, as all msk->first write access are now under the msk socket lock.

Fixes 0397c6d85f9c ("mptcp: keep unaccepted MPC subflow into join list")

---
v1 -> v2:
- make mptcp_copy_inaddrs() static, fixing a W=1 compiler warning

---
 net/mptcp/protocol.c | 35 ++++++++++++++++++++++++++++-------
 net/mptcp/protocol.h |  8 ++++----
 net/mptcp/subflow.c  | 28 +---------------------------
 3 files changed, 33 insertions(+), 38 deletions(-)
net/mptcp/protocol.c +28 -7
index b96b1191763a..38709c332367 100644
@@ -3086,7 +3086,7 @@ static void mptcp_close(struct sock *sk, long timeout)
 	sock_put(sk);
 }
 
-void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk)
+static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk)
 {
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 	const struct ipv6_pinfo *ssk6 = inet6_sk(ssk);
@@ -3163,9 +3163,10 @@ static struct ipv6_pinfo *mptcp_inet6_sk(const struct sock *sk)
 }
 #endif
 
-struct sock *mptcp_sk_clone(const struct sock *sk,
-			    const struct mptcp_options_received *mp_opt,
-			    struct request_sock *req)
+struct sock *mptcp_sk_clone_init(const struct sock *sk,
+				 const struct mptcp_options_received *mp_opt,
+				 struct sock *ssk,
+				 struct request_sock *req)
 {
 	struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
 	struct sock *nsk = sk_clone_lock(sk, GFP_ATOMIC);
@@ -3198,10 +3199,30 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
 	mptcp_init_sched(msk, mptcp_sk(sk)->sched);
 
 	sock_reset_flag(nsk, SOCK_RCU_FREE);
-	/* will be fully established after successful MPC subflow creation */
-	inet_sk_state_store(nsk, TCP_SYN_RECV);
-
 	security_inet_csk_clone(nsk, req);
+
+	/* this can't race with mptcp_close(), as the msk is
+	 * not yet exposted to user-space
+	 */
+	inet_sk_state_store(nsk, TCP_ESTABLISHED);
+
+	/* The msk maintain a referece to each subflow in the connections list */
+	WRITE_ONCE(msk->first, ssk);
+	list_add(&mptcp_subflow_ctx(ssk)->node, &msk->conn_list);
+	sock_hold(ssk);
+
+	/* new mpc subflow takes ownership of the newly
+	 * created mptcp socket
+	 */
+	mptcp_token_accept(subflow_req, msk);
+
+	/* set msk addresses early to ensure mptcp_pm_get_local_id()
+	 * uses the correct data
+	 */
+	mptcp_copy_inaddrs(nsk, ssk);
+	mptcp_propagate_sndbuf(nsk, ssk);
+
+	mptcp_rcv_space_init(msk, ssk);
 	bh_unlock_sock(nsk);
 
 	/* note: the newly allocated socket refcount is 2 now */
net/mptcp/protocol.h +4 -4
index 552d7b06aaa9..de94c01746dc 100644
@@ -618,7 +618,6 @@ int mptcp_allow_join_id0(const struct net *net);
 unsigned int mptcp_stale_loss_cnt(const struct net *net);
 int mptcp_get_pm_type(const struct net *net);
 const char *mptcp_get_scheduler(const struct net *net);
-void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk);
 void mptcp_subflow_fully_established(struct mptcp_subflow_context *subflow,
 				     const struct mptcp_options_received *mp_opt);
 bool __mptcp_retransmit_pending_data(struct sock *sk);
@@ -702,9 +701,10 @@ void __init mptcp_proto_init(void);
 int __init mptcp_proto_v6_init(void);
 #endif
 
-struct sock *mptcp_sk_clone(const struct sock *sk,
-			    const struct mptcp_options_received *mp_opt,
-			    struct request_sock *req);
+struct sock *mptcp_sk_clone_init(const struct sock *sk,
+				 const struct mptcp_options_received *mp_opt,
+				 struct sock *ssk,
+				 struct request_sock *req);
 void mptcp_get_options(const struct sk_buff *skb,
 		       struct mptcp_options_received *mp_opt);
 
net/mptcp/subflow.c +1 -27
index 76952cf74fc0..63ac4dc621d4 100644
@@ -815,38 +815,12 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 		ctx->setsockopt_seq = listener->setsockopt_seq;
 
 		if (ctx->mp_capable) {
-			ctx->conn = mptcp_sk_clone(listener->conn, &mp_opt, req);
+			ctx->conn = mptcp_sk_clone_init(listener->conn, &mp_opt, child, req);
 			if (!ctx->conn)
 				goto fallback;
 
 			owner = mptcp_sk(ctx->conn);
-
-			/* this can't race with mptcp_close(), as the msk is
-			 * not yet exposted to user-space
-			 */
-			inet_sk_state_store(ctx->conn, TCP_ESTABLISHED);
-
-			/* record the newly created socket as the first msk
-			 * subflow, but don't link it yet into conn_list
-			 */
-			WRITE_ONCE(owner->first, child);
-
-			/* new mpc subflow takes ownership of the newly
-			 * created mptcp socket
-			 */
-			owner->setsockopt_seq = ctx->setsockopt_seq;
 			mptcp_pm_new_connection(owner, child, 1);
-			mptcp_token_accept(subflow_req, owner);
-
-			/* set msk addresses early to ensure mptcp_pm_get_local_id()
-			 * uses the correct data
-			 */
-			mptcp_copy_inaddrs(ctx->conn, child);
-			mptcp_propagate_sndbuf(ctx->conn, child);
-
-			mptcp_rcv_space_init(owner, child);
-			list_add(&ctx->node, &owner->conn_list);
-			sock_hold(child);
 
 			/* with OoO packets we can reach here without ingress
 			 * mpc option
Signature · 1 line
2.40.1
author maintainer
#3 lore raw

PATCH v2 3/5 mptcp: fix data race around msk->first access

In reply to Paolo Abeni

The first subflow socket is accessed outside the msk socket lock by mptcp_subflow_fail(), we need to annotate each write access with WRITE_ONCE, but a few spots still lacks it.

Fixes 76a13b315709 ("mptcp: invoke MP_FAIL response when needed")
---
 net/mptcp/protocol.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/protocol.c +3 -3
index 38709c332367..cea9992fec98 100644
@@ -90,7 +90,7 @@ static int __mptcp_socket_create(struct mptcp_sock *msk)
 	if (err)
 		return err;
 
-	msk->first = ssock->sk;
+	WRITE_ONCE(msk->first, ssock->sk);
 	WRITE_ONCE(msk->subflow, ssock);
 	subflow = mptcp_subflow_ctx(ssock->sk);
 	list_add(&subflow->node, &msk->conn_list);
@@ -2446,7 +2446,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
 	sock_put(ssk);
 
 	if (ssk == msk->first)
-		msk->first = NULL;
+		WRITE_ONCE(msk->first, NULL);
 
 out:
 	if (ssk == msk->last_snd)
@@ -2762,7 +2762,7 @@ static int __mptcp_init_sock(struct sock *sk)
 	WRITE_ONCE(msk->rmem_released, 0);
 	msk->timer_ival = TCP_RTO_MIN;
 
-	msk->first = NULL;
+	WRITE_ONCE(msk->first, NULL);
 	inet_csk(sk)->icsk_sync_mss = mptcp_sync_mss;
 	WRITE_ONCE(msk->csum_enabled, mptcp_is_checksum_enabled(sock_net(sk)));
 	WRITE_ONCE(msk->allow_infinite_fallback, true);
Signature · 1 line
2.40.1
author maintainer
#4 lore raw

PATCH v2 4/5 mptcp: add annotations around sk->sk_shutdown accesses

In reply to Paolo Abeni

Christoph reported the mptcp variant of a recently addressed plain TCP issue. Similar to commit e14cadfd80d7 ("tcp: add annotations around sk->sk_shutdown accesses") add READ/WRITE ONCE annotations to silence KCSAN reports around lockless sk_shutdown access.

Fixes 71ba088ce0aa ("mptcp: cleanup accept and poll")
---
 net/mptcp/protocol.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
net/mptcp/protocol.c +16 -13
index cea9992fec98..4b24f3bc6919 100644
@@ -603,7 +603,7 @@ static bool mptcp_check_data_fin(struct sock *sk)
 		WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1);
 		WRITE_ONCE(msk->rcv_data_fin, 0);
 
-		sk->sk_shutdown |= RCV_SHUTDOWN;
+		WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN);
 		smp_mb__before_atomic(); /* SHUTDOWN must be visible first */
 
 		switch (sk->sk_state) {
@@ -910,7 +910,7 @@ static void mptcp_check_for_eof(struct mptcp_sock *msk)
 		/* hopefully temporary hack: propagate shutdown status
 		 * to msk, when all subflows agree on it
 		 */
-		sk->sk_shutdown |= RCV_SHUTDOWN;
+		WRITE_ONCE(sk->sk_shutdown, sk->sk_shutdown | RCV_SHUTDOWN);
 
 		smp_mb__before_atomic(); /* SHUTDOWN must be visible first */
 		sk->sk_data_ready(sk);
@@ -2553,7 +2553,7 @@ static void mptcp_check_fastclose(struct mptcp_sock *msk)
 	}
 
 	inet_sk_state_store(sk, TCP_CLOSE);
-	sk->sk_shutdown = SHUTDOWN_MASK;
+	WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK);
 	smp_mb__before_atomic(); /* SHUTDOWN must be visible first */
 	set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags);
 
@@ -3006,7 +3006,7 @@ bool __mptcp_close(struct sock *sk, long timeout)
 	bool do_cancel_work = false;
 	int subflows_alive = 0;
 
-	sk->sk_shutdown = SHUTDOWN_MASK;
+	WRITE_ONCE(sk->sk_shutdown, SHUTDOWN_MASK);
 
 	if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) {
 		mptcp_listen_inuse_dec(sk);
@@ -3149,7 +3149,7 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	mptcp_pm_data_reset(msk);
 	mptcp_ca_reset(sk);
 
-	sk->sk_shutdown = 0;
+	WRITE_ONCE(sk->sk_shutdown, 0);
 	sk_error_report(sk);
 	return 0;
 }
@@ -3856,9 +3856,6 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk)
 {
 	struct sock *sk = (struct sock *)msk;
 
-	if (unlikely(sk->sk_shutdown & SEND_SHUTDOWN))
-		return EPOLLOUT | EPOLLWRNORM;
-
 	if (sk_stream_is_writeable(sk))
 		return EPOLLOUT | EPOLLWRNORM;
 
@@ -3876,6 +3873,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 	struct sock *sk = sock->sk;
 	struct mptcp_sock *msk;
 	__poll_t mask = 0;
+	u8 shutdown;
 	int state;
 
 	msk = mptcp_sk(sk);
@@ -3892,17 +3890,22 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
 		return inet_csk_listen_poll(ssock->sk);
 	}
 
+	shutdown = READ_ONCE(sk->sk_shutdown);
+	if (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
+		mask |= EPOLLHUP;
+	if (shutdown & RCV_SHUTDOWN)
+		mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
+
 	if (state != TCP_SYN_SENT && state != TCP_SYN_RECV) {
 		mask |= mptcp_check_readable(msk);
-		mask |= mptcp_check_writeable(msk);
+		if (shutdown & SEND_SHUTDOWN)
+			mask |= EPOLLOUT | EPOLLWRNORM;
+		else
+			mask |= mptcp_check_writeable(msk);
 	} else if (state == TCP_SYN_SENT && inet_sk(sk)->defer_connect) {
 		/* cf tcp_poll() note about TFO */
 		mask |= EPOLLOUT | EPOLLWRNORM;
 	}
-	if (sk->sk_shutdown == SHUTDOWN_MASK || state == TCP_CLOSE)
-		mask |= EPOLLHUP;
-	if (sk->sk_shutdown & RCV_SHUTDOWN)
-		mask |= EPOLLIN | EPOLLRDNORM | EPOLLRDHUP;
 
 	/* This barrier is coupled with smp_wmb() in __mptcp_error_report() */
 	smp_rmb();
Signature · 1 line
2.40.1
author maintainer
#5 lore raw

PATCH v2 5/5 mptcp: fix active subflow finalization.

In reply to Paolo Abeni

Active subflow are inserted into the connection list at creation time. When the MPJ handshake completes succesfully, a the new subflow creation netlink event is generated correctly, but the current code wrongly avoid initializing a couple of subflow data.

The above will cause misbehavior on a few exceptional events: unneeded mptcp-level retransmission on msk-level sequence wrap-around and infinite mapping fallback even when a MPJ socket is present.

Address the issue factoring out the needed initialization in a new helper and invoking the latter from __mptcp_finish_join() time for passive subflow and from mptcp_finish_join() for active ones.

Fixes 0530020a7c8f ("mptcp: track and update contiguous data status")
---
 net/mptcp/protocol.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
net/mptcp/protocol.c +14 -9
index 4b24f3bc6919..28da6a9fe8fd 100644
@@ -825,6 +825,13 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
 	mptcp_data_unlock(sk);
 }
 
+static void mptcp_subflow_joined(struct mptcp_sock *msk, struct sock *ssk)
+{
+	mptcp_subflow_ctx(ssk)->map_seq = READ_ONCE(msk->ack_seq);
+	WRITE_ONCE(msk->allow_infinite_fallback, false);
+	mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);
+}
+
 static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk)
 {
 	struct sock *sk = (struct sock *)msk;
@@ -839,6 +846,7 @@ static bool __mptcp_finish_join(struct mptcp_sock *msk, struct sock *ssk)
 		mptcp_sock_graft(ssk, sk->sk_socket);
 
 	mptcp_sockopt_sync_locked(msk, ssk);
+	mptcp_subflow_joined(msk, ssk);
 	return true;
 }
 
@@ -3532,14 +3540,16 @@ bool mptcp_finish_join(struct sock *ssk)
 		return false;
 	}
 
-	if (!list_empty(&subflow->node))
-		goto out;
+	/* active subflow, already present inside the conn_list */
+	if (!list_empty(&subflow->node)) {
+		mptcp_subflow_joined(msk, ssk);
+		return true;
+	}
 
 	if (!mptcp_pm_allow_new_subflow(msk))
 		goto err_prohibited;
 
-	/* active connections are already on conn_list.
-	 * If we can't acquire msk socket lock here, let the release callback
+	/* If we can't acquire msk socket lock here, let the release callback
 	 * handle it
 	 */
 	mptcp_data_lock(parent);
@@ -3562,11 +3572,6 @@ bool mptcp_finish_join(struct sock *ssk)
 		return false;
 	}
 
-	subflow->map_seq = READ_ONCE(msk->ack_seq);
-	WRITE_ONCE(msk->allow_infinite_fallback, false);
-
-out:
-	mptcp_event(MPTCP_EVENT_SUB_ESTABLISHED, msk, ssk, GFP_ATOMIC);
 	return true;
 }
 
Signature · 1 line
2.40.1
#6 lore raw

Re: mptcp: fix active subflow finalization.: Build Failure

Hi Paolo,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

https://patchwork.kernel.org/project/mptcp/patch/41d7df9d8669b5fbfe70cd5551efc9245007ae6c.1684427027.git.pabeni@redhat.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061

Status: failure
Initiator: MPTCPimporter
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/857e3bf32c8f

Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one.

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

author maintainer
#7 lore raw

Re: mptcp: fix active subflow finalization.: Build Failure

Quoted 10 lines · MPTCP CI

Hi Paolo,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

https://patchwork.kernel.org/project/mptcp/patch/41d7df9d8669b5fbfe70cd5551efc9245007ae6c.1684427027.git.pabeni@redhat.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061

The failures are caused by the pre-existing sparse warning around mptcp_sk_clone(), that this series rename as mptcp_sk_clone_init(). I guess there is some CI rule to waive the error for the old/previous function name?!? Any idea to make it generic?

/P

#8 lore raw

Re: mptcp: fix active subflow finalization.: Build Failure

Hi Paolo,

Quoted 9 lines · Paolo Abeni
Quoted 8 lines · MPTCP CI

Hi Paolo,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

Quoted 7 lines
Quoted 2 lines

https://patchwork.kernel.org/project/mptcp/patch/41d7df9d8669b5fbfe70cd5551efc9245007ae6c.1684427027.git.pabeni@redhat.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061

The failures are caused by the pre-existing sparse warning around mptcp_sk_clone(), that this series rename as mptcp_sk_clone_init(). I guess there is some CI rule to waive the error for the old/previous function name?!? Any idea to make it generic?

Thank you for having checked!

I just modified the script to whitelist the new warning:

https://github.com/multipath-tcp/mptcp-upstream-validate-export-action/commit/a9d24567

All green now:

https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061/jobs/9005030178

I don't think we need to make it generic. I guess we will rarely rename the function name and/or move it elsewhere, no?

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
author maintainer
#9 lore raw

Re: mptcp: fix active subflow finalization.: Build Failure

Quoted 22 lines · Matthieu Baerts

Hi Paolo,

Quoted 9 lines · Paolo Abeni
Quoted 8 lines · MPTCP CI

Hi Paolo,

Thank you for your modifications, that's great!

But sadly, our CI spotted some issues with it when trying to build it.

You can find more details there:

Quoted 7 lines
Quoted 2 lines

https://patchwork.kernel.org/project/mptcp/patch/41d7df9d8669b5fbfe70cd5551efc9245007ae6c.1684427027.git.pabeni@redhat.com/
https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061

The failures are caused by the pre-existing sparse warning around mptcp_sk_clone(), that this series rename as mptcp_sk_clone_init(). I guess there is some CI rule to waive the error for the old/previous function name?!? Any idea to make it generic?

Thank you for having checked!

Quoted 7 lines

I just modified the script to whitelist the new warning:

https://github.com/multipath-tcp/mptcp-upstream-validate-export-action/commit/a9d24567

All green now:

https://github.com/multipath-tcp/mptcp_net-next/actions/runs/5016483061/jobs/9005030178

Many thanks!

Quoted 2 lines

I don't think we need to make it generic. I guess we will rarely rename the function name and/or move it elsewhere, no?

Hopefully I hope and think you are right!

/P

#10 lore raw

Re: mptcp: fix active subflow finalization.: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join):
- Unstable: 1 failed test(s): packetdrill_sockopts 🔴:
- Task: https://cirrus-ci.com/task/5157388886474752
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5157388886474752/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/6283288793317376
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6283288793317376/summary/summary.txt

- KVM Validation: debug (except selftest_mptcp_join):
- Unstable: 3 failed test(s): packetdrill_fastopen packetdrill_mp_capable selftest_diag 🔴:
- Task: https://cirrus-ci.com/task/4875913909764096
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4875913909764096/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/6001813816606720
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6001813816606720/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/857e3bf32c8f

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

#11 lore raw

Re: mptcp: fix active subflow finalization.: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join):
- Unstable: 1 failed test(s): packetdrill_fastopen 🔴:
- Task: https://cirrus-ci.com/task/6045200401825792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6045200401825792/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/4778563006627840
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4778563006627840/summary/summary.txt

- {"code":404,"message":
- "Can't find artifacts containing file conclusion.txt"}:
- Task: https://cirrus-ci.com/task/6608150355247104
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6608150355247104/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5482250448404480
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5482250448404480/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/6e2e302b0b8c

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

#12 lore raw

Re: mptcp: fix active subflow finalization.: Tests Results

In reply to Paolo Abeni

Hi Paolo,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join):
- Unstable: 1 failed test(s): packetdrill_fastopen 🔴:
- Task: https://cirrus-ci.com/task/6045200401825792
- Summary: https://api.cirrus-ci.com/v1/artifact/task/6045200401825792/summary/summary.txt

- KVM Validation: debug (only selftest_mptcp_join):
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/4778563006627840
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4778563006627840/summary/summary.txt

- KVM Validation: debug (except selftest_mptcp_join):
- Unstable: 4 failed test(s): packetdrill_fastopen packetdrill_mp_capable packetdrill_mp_join selftest_diag 🔴:
- Task: https://cirrus-ci.com/task/4825292619907072
- Summary: https://api.cirrus-ci.com/v1/artifact/task/4825292619907072/summary/summary.txt

- KVM Validation: normal (only selftest_mptcp_join):
- Success! ✅:
- Task: https://cirrus-ci.com/task/5482250448404480
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5482250448404480/summary/summary.txt

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/6e2e302b0b8c

If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-debug

For more details:

https://github.com/multipath-tcp/mptcp-upstream-virtme-docker

Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (Tessares)

maintainer Reviewed-by on the v2 series
#13 lore raw
In reply to Paolo Abeni
Quoted 21 lines · Paolo Abeni

The patch 1 && 4 are direct response to recently reported KCSAN splat.

The patch 2 && 3 are just by code inspection of related code path. Patch 3/5 is there mostly to make the next one simple, even if the race mentioned in such patch should be real (but very tiny, if possible at all).

This iteration addresses a compile warning in patch 2/5 reported by kbuild bot.

Patch 5/5 is new in this round, fixes an unrelated issue found by code inspection. I should have posted separatelly

Paolo Abeni (5):
mptcp: add annotations around msk->subflow accesses
mptcp: consolidate passive msk socket initialization
mptcp: fix data race around msk->first access
mptcp: add annotations around sk->sk_shutdown accesses
mptcp: fix active subflow finalization.

Quoted 4 lines
net/mptcp/protocol.c | 111 +++++++++++++++++++++++++++----------------
net/mptcp/protocol.h |  14 ++++--
net/mptcp/subflow.c  |  28 +----------
3 files changed, 81 insertions(+), 72 deletions(-)

Thanks Paolo,

Series looks good to me:

#14 lore raw
In reply to Paolo Abeni

Hi Paolo, Mat,

Quoted 8 lines · Paolo Abeni

The patch 1 && 4 are direct response to recently reported KCSAN splat.

The patch 2 && 3 are just by code inspection of related code path. Patch 3/5 is there mostly to make the next one simple, even if the race mentioned in such patch should be real (but very tiny, if possible at all).

Quoted 5 lines

This iteration addresses a compile warning in patch 2/5 reported by kbuild bot.

Patch 5/5 is new in this round, fixes an unrelated issue found by code inspection. I should have posted separatelly

Thank you for the patches and the reviews!

Now in our tree (fixes for -net) with Mat's RvB tag (and without some typos reported by checkpatch.pl --codespell). I had one conflict with the scheduler BPF series, nothing important:

New patches for t/upstream-net and t/upstream:
- 2bf493e0a2c7: mptcp: add annotations around msk->subflow accesses
- 824fba99ecc6: mptcp: consolidate passive msk socket initialization
- 76d73119db47: mptcp: fix data race around msk->first access
- d68a0ccb3108: mptcp: add annotations around sk->sk_shutdown accesses
- 2971ca12a7ac: mptcp: fix active subflow finalization
- 0063946d91ed: conflict in t/mptcp-add-a-new-sysctl-scheduler
- Results: c08e2cb009ac..b87768580a4d (export-net)
- Results: 1a70ca6023d3..0a9978390b78 (export)

Tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20230524T135256
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20230524T135256

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net