protocol: pm callback must be done after msk state is set up
Subsystems (2)
Florian Westphal
PATCH 1/2 protocol: pm callback must be done after msk state is set up
Squashto: mptcp: Add path manager interface
current location calls this when msk->token is still 0, so pm worker will never find the mptcp socket it should be using.
--- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/protocol.c +2 -2
@@ -1371,8 +1371,6 @@ void mptcp_finish_connect(struct sock *ssk)pr_debug ("msk=%p, token=%u" , sk, subflow->token); -mptcp_pm_new_connection (msk,0 ); -mptcp_crypto_key_sha (subflow->remote_key,NULL , &ack_seq); ack_seq++; subflow->map_seq = ack_seq;
@@ -1389,6 +1387,8 @@ void mptcp_finish_connect(struct sock *ssk)WRITE_ONCE (msk->ack_seq, ack_seq);WRITE_ONCE (msk->can_ack,1 );atomic64_set (&msk->snd_una, msk->write_seq); + +mptcp_pm_new_connection (msk,0 ); }static void mptcp_sock_graft (struct sock *sk,struct socket *parent)
Signature · 1 line
2.24.1
Florian Westphal
PATCH 2/2 protocol: fix list corruption
squashto: subflow: place further subflows on new 'join_list'
plugs:
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
kworker/u8:1/31 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff88810c43d520 (&(&msk->join_list_lock)->rlock){+.?.}, at: mptcp_finish_join+0x30f/0x4d0
and a list corruption, we need to re-init the join list head, else next list_empty() test will splice this a second time, resulting in a corrupted conn list.
--- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/protocol.c +3 -3
@@ -153,7 +153,7 @@ static void __mptcp_flush_join_list(struct mptcp_sock *msk)return ;spin_lock_bh (&msk->join_list_lock); -list_splice_tail (&msk->join_list, &msk->conn_list); +list_splice_tail_init (&msk->join_list, &msk->conn_list);spin_unlock_bh (&msk->join_list_lock); }
@@ -1420,9 +1420,9 @@ bool mptcp_finish_join(struct sock *sk)/* active connections are already on conn_list */ if (list_empty (&subflow->node)) { -spin_lock (&msk->join_list_lock); +spin_lock_bh (&msk->join_list_lock);list_add_tail (&subflow->node, &msk->join_list); -spin_unlock (&msk->join_list_lock); +spin_unlock_bh (&msk->join_list_lock); } }return true;
Signature · 1 line
2.24.1
Paolo Abeni
[MPTCP] Re: [PATCH 2/2] protocol: fix list corruption
Quoted 31 lines · Florian Westphal
squashto: subflow: place further subflows on new '
join_list'plugs:
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
kworker/u8:1/31 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff88810c43d520(&(&msk->join_list_lock)->rlock){+.?.}, at:mptcp_finish_join+0x30f/0x4d0and a list corruption, we need to re-init the join list head, else next
list_empty()test will splice this a second time, resulting in a corrupted conn list.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/mptcp/protocol.c +1
-1@@ -153,7 +153,7 @@ static void __mptcp_flush_join_list(struct mptcp_sock *msk)return ;spin_lock_bh (&msk->join_list_lock); -list_splice_tail (&msk->join_list, &msk->conn_list); +list_splice_tail_init (&msk->join_list, &msk->conn_list);spin_unlock_bh (&msk->join_list_lock); }@@ -1420,9 +1420,9 @@ bool mptcp_finish_join(struct sock *sk)
net/mptcp/protocol.c bool mptcp_finish_join(struct sock *sk) · line 1428
Quoted 10 lines
net/mptcp/protocol.c +2
-2/* active connections are already on conn_list */ if (list_empty (&subflow->node)) { -spin_lock (&msk->join_list_lock); +spin_lock_bh (&msk->join_list_lock);list_add_tail (&subflow->node, &msk->join_list); -spin_unlock (&msk->join_list_lock); +spin_unlock_bh (&msk->join_list_lock); } }return true;
whoops, I thought this would run in BH only - I was wrong!
LGTM!
Paolo
Matthieu Baerts
[MPTCP] Re: [PATCH 2/2] protocol: fix list corruption
Hi Florian, Paolo,
Quoted 32 lines · Paolo Abeni
Quoted 31 lines · Florian Westphal
squashto: subflow: place further subflows on new '
join_list'plugs:
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
kworker/u8:1/31 [HC0[0]:SC1[1]:HE1:SE0] takes:
ffff88810c43d520(&(&msk->join_list_lock)->rlock){+.?.}, at:mptcp_finish_join+0x30f/0x4d0and a list corruption, we need to re-init the join list head, else next
list_empty()test will splice this a second time, resulting in a corrupted conn list.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)net/mptcp/protocol.c +1
-1@@ -153,7 +153,7 @@ static void __mptcp_flush_join_list(struct mptcp_sock *msk)return ;spin_lock_bh (&msk->join_list_lock); -list_splice_tail (&msk->join_list, &msk->conn_list); +list_splice_tail_init (&msk->join_list, &msk->conn_list);spin_unlock_bh (&msk->join_list_lock); }@@ -1420,9 +1420,9 @@ bool mptcp_finish_join(struct sock *sk)
Quoted 12 lines
net/mptcp/protocol.c bool mptcp_finish_join(struct sock *sk) · line 1428
Quoted 10 lines
net/mptcp/protocol.c +2
-2/* active connections are already on conn_list */ if (list_empty (&subflow->node)) { -spin_lock (&msk->join_list_lock); +spin_lock_bh (&msk->join_list_lock);list_add_tail (&subflow->node, &msk->join_list); -spin_unlock (&msk->join_list_lock); +spin_unlock_bh (&msk->join_list_lock); } }return true;whoops, I thought this would run in BH only - I was wrong!
Thank you for the patches and the review!
- f11b0171d4ee: "squashed" patch 1/2 in "mptcp: Add path manager interface" (with a small conflict)
- 8dc2fbf1951b: "Signed-off-by" + "Co-developed-by"
- bf09e56f4f2b: conflict in t/mptcp-update-per-unacked-sequence-on-pkt-reception
- 11cb91b0f172..0bc44ebe6199: result
- a4445faa25c7: "squashed" patch 2/2 in "subflow: place further subflows on new 'join_list'"
- 0bc44ebe6199..23c5e836256b: result
Tests are in progress.
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Paolo Abeni
Quoted 24 lines · Florian Westphal
Squashto: mptcp: Add path manager interface
current location calls this when
msk->tokenis still 0, so pm worker will never find the mptcp socket it should be using.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/mptcp/protocol.c +0
-2@@ -1371,8 +1371,6 @@ void mptcp_finish_connect(struct sock *ssk)pr_debug ("msk=%p, token=%u" , sk, subflow->token); -mptcp_pm_new_connection (msk,0 ); -mptcp_crypto_key_sha (subflow->remote_key,NULL , &ack_seq); ack_seq++; subflow->map_seq = ack_seq;
net/mptcp/protocol.c void mptcp_finish_connect(struct sock *ssk) · line 1394
Quoted 8 lines
net/mptcp/protocol.c +2
-0@@ -1389,6 +1387,8 @@ void mptcp_finish_connect(struct sock *ssk)WRITE_ONCE (msk->ack_seq, ack_seq);WRITE_ONCE (msk->can_ack,1 );atomic64_set (&msk->snd_una, msk->write_seq); + +mptcp_pm_new_connection (msk,0 ); }static void mptcp_sock_graft (struct sock *sk,struct socket *parent)
LGTM, thanks Florian! (This was fast!)
Does this fix the MP_JOIN handshake or is there any other pending known issue ? (beyond the list corruption fixed by the next patch...)
Paolo
Florian Westphal
Quoted 32 lines · Paolo Abeni
Quoted 31 lines · Florian Westphal
Squashto: mptcp: Add path manager interface
current location calls this when
msk->tokenis still 0, so pm worker will never find the mptcp socket it should be using.Signed-off-by Florian Westphal <fw(a)strlen.de>--- net/mptcp/protocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)net/mptcp/protocol.c +2
-2@@ -1371,8 +1371,6 @@ void mptcp_finish_connect(struct sock *ssk)pr_debug ("msk=%p, token=%u" , sk, subflow->token); -mptcp_pm_new_connection (msk,0 ); -mptcp_crypto_key_sha (subflow->remote_key,NULL , &ack_seq); ack_seq++; subflow->map_seq = ack_seq;@@ -1389,6 +1387,8 @@ void mptcp_finish_connect(struct sock *ssk)WRITE_ONCE (msk->ack_seq, ack_seq);WRITE_ONCE (msk->can_ack,1 );atomic64_set (&msk->snd_una, msk->write_seq); + +mptcp_pm_new_connection (msk,0 ); }
Quoted 6 lines
net/mptcp/protocol.c void mptcp_finish_connect(struct sock *ssk) · line 1394
Quoted 1 line
net/mptcp/protocol.c +0
-0static void mptcp_sock_graft (struct sock *sk,struct socket *parent)LGTM, thanks Florian! (This was fast!)
Does this fix the
MP_JOINhandshake or is there any other pending known issue ? (beyond the list corruption fixed by the next patch...)
Yes and yes. Things only work when slowing down the test prog to give the join time to complete.
Else, this hits the 'is parent not established anymore' check in mptcp_finish_join. This also gives a memory leak of the socket.