mptcp: fix extra_subflows leak on failed passive join
Subsystems (2)
PATCH 1/1 mptcp: fix extra_subflows leak on failed passive join
From: Chenguang Zhao <[email protected]>
mptcp_pm_allow_new_subflow() increments extra_subflows before __mptcp_finish_join() on the passive MP_JOIN path. On synchronous join failure the subflow is dropped without calling mptcp_close_ssk(), so the counter is not rolled back.
Call mptcp_pm_close_subflow() when the join completion fails.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -3907,6 +3907,7 @@ bool mptcp_finish_join(struct sock *ssk)mptcp_data_unlock (parent);if (!ret) { +mptcp_pm_close_subflow (msk); err_prohibited: subflow->reset_reason =MPTCP_RST_EPROHIBIT ;return false;
Signature · 1 line
2.25.1
Hi Chenguang,
Thank you for the fix.
Quoted 2 lines
mptcp_pm_allow_new_subflow()incrementsextra_subflowsbefore__mptcp_finish_join()on the passiveMP_JOINpath.
I see that this code path is currently not exercised by our test suite:
https://ci-results.mptcp.dev/lcov/export/mptcp/protocol.c.gcov.html#L4031
How did you spot the issue? Do you have a reproducer? Or was it by reading the code? Assisted by a tool (in this case, please add the Assisted-by tag)?
I see we have a test for sync connect failure, but not sync join. Do you mind adding a new Packetdrill test please? Similar to simult_connect.pkt I suppose:
Quoted 4 lines
On synchronous join failure the subflow is dropped without calling
mptcp_close_ssk(), so the counter is not rolled back.Call
mptcp_pm_close_subflow()when the join completion fails.
A fix patch should always have a Fixes tag. Here, I guess it should be:
Apart from that, the modification looks good to me:
Signature · 1 line
Matthieu Baerts (NGI0) <[email protected]>
Hi Matthieu,
Regarding the sync join failure, I have already submitted a PR.
https://github.com/multipath-tcp/packetdrill/pull/200
Thanks
Quoted 32 lines · Matthieu Baerts
Hi Chenguang,
Thank you for the fix.
Quoted 2 lines
mptcp_pm_allow_new_subflow()incrementsextra_subflowsbefore__mptcp_finish_join()on the passiveMP_JOINpath.I see that this code path is currently not exercised by our test suite:
https://ci-results.mptcp.dev/lcov/export/mptcp/protocol.c.gcov.html#L4031
How did you spot the issue? Do you have a reproducer? Or was it by reading the code? Assisted by a tool (in this case, please add the Assisted-by tag)?
I see we have a test for sync connect failure, but not sync join. Do you mind adding a new Packetdrill test please? Similar to simult_connect.pkt I suppose:
Quoted 4 lines
On synchronous join failure the subflow is dropped without calling
mptcp_close_ssk(), so the counter is not rolled back.Call
mptcp_pm_close_subflow()when the join completion fails.A fix patch should always have a Fixes tag. Here, I guess it should be:
Fixes 10f6d46c943d ("mptcp: fix race between MP_JOIN and close")Apart from that, the modification looks good to me:
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>
Hi Chenguang,
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): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/28438179349
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/654ae3cf6532
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1118853
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-normalFor 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 (NGI0 Core)
PATCH v2 1/1 mptcp: fix extra_subflows leak on failed passive join
In reply to Chenguang ZhaoFrom: Chenguang Zhao <[email protected]>
mptcp_pm_allow_new_subflow() increments extra_subflows before __mptcp_finish_join() on the passive MP_JOIN path. On synchronous join failure the subflow is dropped without calling mptcp_close_ssk(), so the counter is not rolled back.
Call mptcp_pm_close_subflow() when the join completion fails.
---
v2:
Hi Matthieu,
Thanks for the review.
- I spotted this by reading the code. I don't have a reproducer yet. I also see we already have a Packetdrill test for synchronous connect failure (simult_connect.pkt), but not for synchronous join failure. I'll add a similar Packetdrill test
for that case and send it in a follow-up patch.
- Add Fixes and Reviewd-by tag.
- I looked again at the history, and I think the Fixes tag
should point to 3e5014909b56 ("mptcp: cleanup MPJ subflow list handling"), not 10f6d46c943d ("mptcp: fix race between MP_JOIN and close").
v1:
- https://lore.kernel.org/all/[email protected]/
net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -3907,6 +3907,7 @@ bool mptcp_finish_join(struct sock *ssk)mptcp_data_unlock (parent);if (!ret) { +mptcp_pm_close_subflow (msk); err_prohibited: subflow->reset_reason =MPTCP_RST_EPROHIBIT ;return false;
Signature · 1 line
2.25.1
Hi Chenguang,
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): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/28491654012
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/4d3b1813957d
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1119370
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-normalFor 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 (NGI0 Core)
Geliang Tang
reviewerHi Chenguang,
Thanks for this v2. However, if there are no code changes, there is no need to send a v2; we can just reply to the email thread on v1 to discuss it.
Quoted 12 lines · Chenguang Zhao
From: Chenguang Zhao <[email protected]>
mptcp_pm_allow_new_subflow()incrementsextra_subflowsbefore__mptcp_finish_join()on the passiveMP_JOINpath. On synchronous join failure the subflow is dropped without callingmptcp_close_ssk(), so the counter is not rolled back.Call
mptcp_pm_close_subflow()when the join completion fails.Fixes 3e5014909b56 ("mptcp: cleanup MPJ subflow list handling")Signed-off-by Chenguang Zhao <[email protected]>Reviewed-by Matthieu Baerts (NGI0) <[email protected]>
Quoted 14 lines
---
v2:
Hi Matthieu,
Thanks for the review.
- I spotted this by reading the code. I don't have a reproducer yet. I also see we already have a Packetdrill test for synchronous connect failure (simult_connect.pkt), but not for synchronous join failure. I'll add a similar Packetdrill test for that case and send it in a follow-up patch.
- Add Fixes and Reviewd-by tag.
- I looked again at the history, and I think the Fixes tag should point to3e5014909b56("mptcp: cleanup MPJ subflow list handling"), not10f6d46c943d("mptcp: fix race betweenMP_JOINand close").
The Fixes tag is incorrect and should be 10f6d46c943d ("mptcp: fix race between MP_JOIN and close"), because that commit introduced the call to mptcp_pm_allow_new_subflow. There is no need to send a v3, as this can be updated when applying.
I have changed the status of v2 to "Queued" and v1 to "Superseded".
Thanks,
-Geliang
Quoted 19 lines
v1:
-
https://lore.kernel.org/all/[email protected]/net/mptcp/protocol.c | 1 +
1 file changed, 1 insertion(+)net/mptcp/protocol.c +0
-0@@ -3907,6 +3907,7 @@ bool mptcp_finish_join(struct sock *ssk) mptcp_data_unlock(parent);
if (!ret) {net/mptcp/protocol.c +1
-0+mptcp_pm_close_subflow (msk);err_prohibited:
subflow->reset_reason=MPTCP_RST_EPROHIBIT; return false;
Matthieu Baerts
maintainerHi Geliang, Chenguang,
Quoted 5 lines · Geliang Tang
Hi Chenguang,
Thanks for this v2. However, if there are no code changes, there is no need to send a v2; we can just reply to the email thread on v1 to discuss it.
Indeed. Also, it is easier if you start a new thread with a link to the previous version, than replying to a previous version.
Quoted 7 lines · Chenguang Zhao
Quoted 6 lines
From: Chenguang Zhao <[email protected]>
mptcp_pm_allow_new_subflow()incrementsextra_subflowsbefore__mptcp_finish_join()on the passiveMP_JOINpath. On synchronous join failure the subflow is dropped without callingmptcp_close_ssk(), so the counter is not rolled back.
What do you mean by saying "On synchronous join failure"? When I look at the packetdrill test, we are not talking about synchronous MP_JOIN (SYN
+ MP_JOIN packets in both directions), right?
Quoted 20 lines
Quoted 5 lines
Call
mptcp_pm_close_subflow()when the join completion fails.Fixes 3e5014909b56 ("mptcp: cleanup MPJ subflow list handling")Signed-off-by Chenguang Zhao <[email protected]>Reviewed-by Matthieu Baerts (NGI0) <[email protected]>Quoted 14 lines
---
v2:
Hi Matthieu,
Thanks for the review.
- I spotted this by reading the code. I don't have a reproducer yet. I also see we already have a Packetdrill test for synchronous connect failure (simult_connect.pkt), but not for synchronous join failure. I'll add a similar Packetdrill test for that case and send it in a follow-up patch.
- Add Fixes and Reviewd-by tag.
- I looked again at the history, and I think the Fixes tag should point to3e5014909b56("mptcp: cleanup MPJ subflow list handling"), not10f6d46c943d("mptcp: fix race betweenMP_JOINand close").
Quoted 4 lines
The Fixes tag is incorrect and should be
10f6d46c943d("mptcp: fix race betweenMP_JOINand close"), because that commit introduced the call tomptcp_pm_allow_new_subflow. There is no need to send a v3, as this can be updated when applying.
+1
Quoted 1 line
I have changed the status of v2 to "Queued" and v1 to "Superseded".
I will wait to get the packetdrill test ready before applying this patch.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Chenguang,
Quoted 7 lines · Chenguang Zhao
From: Chenguang Zhao <[email protected]>
mptcp_pm_allow_new_subflow()incrementsextra_subflowsbefore__mptcp_finish_join()on the passiveMP_JOINpath. On synchronous join failure the subflow is dropped without callingmptcp_close_ssk(), so the counter is not rolled back.
Quoted 5 lines
Call
mptcp_pm_close_subflow()when the join completion fails.Fixes 3e5014909b56 ("mptcp: cleanup MPJ subflow list handling")Signed-off-by Chenguang Zhao <[email protected]>Reviewed-by Matthieu Baerts (NGI0) <[email protected]>
Thank you for the patch. Now in our tree (with small adaptations in the commit message):
New patches for t/upstream-net and t/upstream:
- 5cc023a79ad5: mptcp: decrement subflows counter on failed passive join
- Results: 6e75226ac108..4c2362a7db02 (export-net)
- Results: 4c2752580a3e..4285a4fe811b (export)
Tests are now in progress:
- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/bc033e934bd44ead5a065f26cb78af76769e90de/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/254350c480d5cc9124500ba3588f2d24a1905608/checks
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.