mptcp: a bunch of assorted fixes
Subsystems (4)
Paolo Abeni
maintainercover mptcp: a bunch of assorted fixes
This series pulls a few fixes for the MPTCP datapath. Most issues addressed here has been recently introduced with the recent reworks, with the notable exception of the first patch, which addresses an issue present since the early days
Paolo Abeni (4):
mptcp: fix security context on server socket
mptcp: properly annotate nested lock
mptcp: push pending frames when subflow has free space
mptcp: fix pending data accounting
net/mptcp/options.c | 13 ++++++++----- net/mptcp/protocol.c | 11 ++++++----- net/mptcp/protocol.h | 2 +- tools/testing/selftests/net/mptcp/simult_flows.sh | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.2
Paolo Abeni
maintainerPATCH 1/4 mptcp: fix security context on server socket
Currently MPTCP is not propagating the security context from the ingress request socket to newly created msk at clone time.
Address the issue invoking the missing security helper.
--- net/mptcp/protocol.c | 2 ++ 1 file changed, 2 insertions(+)
net/mptcp/protocol.c +2 -0
@@ -2699,6 +2699,8 @@ struct sock *mptcp_sk_clone(const struct sock *sk,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);bh_unlock_sock (nsk);/* keep a single reference */
Signature · 1 line
2.26.2
Paolo Abeni
maintainerPATCH 2/4 mptcp: properly annotate nested lock
In reply to Paolo AbeniMPTCP closes the subflows while holding the msk-level lock. While acquiring the subflow socket lock we need to use the correct nested annotation, or we can hit a lockdep splat at runtime.
--- net/mptcp/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/protocol.c +1 -1
@@ -2119,7 +2119,7 @@ void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,list_del (&subflow->node); -lock_sock (ssk); +lock_sock_nested (ssk,SINGLE_DEPTH_NESTING );/* if we are invoked by the msk cleanup code, the subflow is * already orphaned
Signature · 1 line
2.26.2
Paolo Abeni
maintainerPATCH 3/4 mptcp: push pending frames when subflow has free space
In reply to Paolo AbeniWhen multiple subflows are active, we can receive a window update on subflow with no write space available. MPTCP will try to push frames on such subflow and will fail. Pending frames will be pushed only after receiving a window update on a subflow with some wspace available.
Overall the above could lead to suboptimal aggregate bandwidth usage.
Instead, we should try to push pending frames as soon as the subflow reaches both conditions mentioned above.
We can finally enable self-tests with asymmetric links, as the above makes them finally pass.
--- net/mptcp/options.c | 13 ++++++++----- net/mptcp/protocol.c | 2 +- net/mptcp/protocol.h | 2 +- tools/testing/selftests/net/mptcp/simult_flows.sh | 6 +++--- 4 files changed, 13 insertions(+), 10 deletions(-)
net/mptcp/options.c +8 -5
@@ -873,10 +873,13 @@ static void ack_update_msk(struct mptcp_sock *msk, new_wnd_end = new_snd_una +tcp_sk (ssk)->snd_wnd; -if (after64 (new_wnd_end, msk->wnd_end)) { +if (after64 (new_wnd_end, msk->wnd_end)) msk->wnd_end = new_wnd_end; -__mptcp_wnd_updated (sk, ssk); - } + +/* this assumes mptcp_incoming_options() is invoked after tcp_ack() */ +if (after64 (msk->wnd_end,READ_ONCE (msk->snd_nxt)) && +sk_stream_memory_free (ssk)) +__mptcp_check_push (sk, ssk);if (after64 (new_snd_una, old_snd_una)) { msk->snd_una = new_snd_una;
@@ -942,8 +945,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)* helpers are cheap. */ mptcp_data_lock (subflow->conn); -if (mptcp_send_head (subflow->conn)) -__mptcp_wnd_updated (subflow->conn, sk); +if (sk_stream_memory_free (sk)) +__mptcp_check_push (subflow->conn, sk);__mptcp_data_acked (subflow->conn);mptcp_data_unlock (subflow->conn);return ;
net/mptcp/protocol.c +1 -1
@@ -2915,7 +2915,7 @@ void __mptcp_data_acked(struct sock *sk)mptcp_schedule_work (sk); } -void __mptcp_wnd_updated (struct sock *sk,struct sock *ssk) +void __mptcp_check_push (struct sock *sk,struct sock *ssk) {if (!mptcp_send_head (sk))return ;
net/mptcp/protocol.h +1 -1
@@ -503,7 +503,7 @@ void mptcp_rcv_space_init(struct mptcp_sock *msk, const struct sock *ssk);void mptcp_data_ready (struct sock *sk,struct sock *ssk);bool mptcp_finish_join (struct sock *sk);bool mptcp_schedule_work (struct sock *sk); -void __mptcp_wnd_updated (struct sock *sk,struct sock *ssk); +void __mptcp_check_push (struct sock *sk,struct sock *ssk);void __mptcp_data_acked (struct sock *sk);void mptcp_subflow_eof (struct sock *sk);bool mptcp_update_rcv_data_fin (struct mptcp_sock *msk,u64 data_fin_seq,bool use_64bit);
tools/testing/selftests/net/mptcp/simult_flows.sh +3 -3
@@ -287,7 +287,7 @@ run_test 10 10 0 0 "balanced bwidth" run_test 10 10 1 50 "balanced bwidth with unbalanced delay" # we still need some additional infrastructure to pass the following test-cases -# run_test 30 10 0 0 "unbalanced bwidth" -# run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay" -# run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay" +run_test 30 10 0 0 "unbalanced bwidth" +run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay" +run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay" exit $ret
Signature · 1 line
2.26.2
Paolo Abeni
maintainerPATCH 4/4 mptcp: fix pending data accounting
In reply to Paolo AbeniWhen sendmsg() needs to wait for memory, the pending data is not updated. That causes a drift in forward memory allocation, leading to stall and/or warnings at socket close time.
This change addresses the above issue moving the pending data counter update inside the sendmsg() main loop.
--- net/mptcp/protocol.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/mptcp/protocol.c +2 -3
@@ -1658,6 +1658,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) frag_truesize += psize; pfrag->offset += frag_truesize;WRITE_ONCE (msk->write_seq, msk->write_seq + psize); + msk->tx_pending_data += psize;/* charge data on mptcp pending queue to the msk socket * Note: we charge such data both to sk and ssk
@@ -1683,10 +1684,8 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) goto out; } -if (copied) { - msk->tx_pending_data += copied; +if (copied)mptcp_push_pending (sk, msg->msg_flags); - } out:release_sock (sk);
Signature · 1 line
2.26.2
Re: [PATCH net 1/4] mptcp: fix security context on server socket
In reply to Paolo AbeniQuoted 4 lines · Paolo Abeni
Currently MPTCP is not propagating the security context from the ingress request socket to newly created msk at clone time.
Quoted 8 lines
Address the issue invoking the missing security helper.
Fixes cf7da0d66cc1 ("mptcp: Create SUBFLOW socket for incoming connections")Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/protocol.c| 2 ++1 file changed, 2 insertions(+)
--
Mat Martineau
Intel
Re: [PATCH net 2/4] mptcp: properly annotate nested lock
In reply to Paolo AbeniQuoted 11 lines · Paolo Abeni
MPTCP closes the subflows while holding the msk-level lock. While acquiring the subflow socket lock we need to use the correct nested annotation, or we can hit a lockdep splat at runtime.
Reported-and-tested-by Geliang Tang <geliangtang(a)gmail.com>Fixes e16163b6e2b7 ("mptcp: refactor shutdown and close")Signed-off-by Paolo Abeni <pabeni(a)redhat.com>---
net/mptcp/protocol.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
--
Mat Martineau
Intel
[email protected]
AppliedHello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 6 lines · On Wed, 16 Dec 2020 12:48:31 +0100 you wrote:
This series pulls a few fixes for the MPTCP datapath. Most issues addressed here has been recently introduced with the recent reworks, with the notable exception of the first patch, which addresses an issue present since the early days
Quoted 7 lines
Paolo Abeni (4):
mptcp: fix security context on server socket
mptcp: properly annotate nested lock
mptcp: push pending frames when subflow has free space
mptcp: fix pending data accounting[...]
Here is the summary with links:
- [net,1/4] mptcp: fix security context on server socket
https://git.kernel.org/netdev/net/c/0c14846032f2 - [net,2/4] mptcp: properly annotate nested lock https://git.kernel.org/netdev/net/c/3f8b2667f257 - [net,3/4] mptcp: push pending frames when subflow has free space https://git.kernel.org/netdev/net/c/219d04992b68 - [net,4/4] mptcp: fix pending data accounting https://git.kernel.org/netdev/net/c/13e1603739e5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html