mptcp: stop using the mptcp_has_another_subflow() helper
Subsystems (2)
Paolo Abeni
maintainerPATCH 1/1 mptcp: stop using the mptcp_has_another_subflow() helper
The mentioned helper requires the msk socket lock, and the current callers don't own it nor can't acquire it, so the access is racy.
All the current callers are really checking for infinite mapping fallback, and the latter condition is explicitly tracked by the relevant msk variable: we can safely remove the caller usage
- and the caller itself.
The issue is present since MP_FAIL implementation, but the fix only applies since the infinite fallback support, ence the somewhat unexpected fixes tag.
--- net/mptcp/pm.c | 2 +- net/mptcp/protocol.h | 13 ------------- net/mptcp/subflow.c | 3 +-- 3 files changed, 2 insertions(+), 16 deletions(-)
net/mptcp/pm.c +1 -1
@@ -303,7 +303,7 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)pr_debug ("fail_seq=%llu" , fail_seq); -if (mptcp_has_another_subflow (sk) || !READ_ONCE (msk->allow_infinite_fallback)) +if (!READ_ONCE (msk->allow_infinite_fallback))return ;if (!READ_ONCE (subflow->mp_fail_response_expect)) {
net/mptcp/protocol.h +0 -13
@@ -661,19 +661,6 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow (struct sock *ssk) -{ -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk), *tmp; -struct mptcp_sock *msk =mptcp_sk (subflow->conn); - -mptcp_for_each_subflow (msk, tmp) { -if (tmp != subflow) -return true; - } - -return false; -} -void __init mptcp_proto_init (void );#if IS_ENABLED (CONFIG_MPTCP_IPV6 )int __init mptcp_proto_v6_init (void );
net/mptcp/subflow.c +1 -2
@@ -1218,8 +1218,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (!__mptcp_check_fallback (msk)) {/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk) || - !READ_ONCE (msk->allow_infinite_fallback)) { +if (!READ_ONCE (msk->allow_infinite_fallback)) { ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ;
Signature · 1 line
2.35.3
Re: mptcp: stop using the mptcp_has_another_subflow() helper: Tests Results
Hi Paolo,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 1 failed test(s): selftest_mptcp_join 🔴:
- Task: https://cirrus-ci.com/task/5945895240859648
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5945895240859648/summary/summary.txt
- KVM Validation: debug:
- Unstable: 1 failed test(s): selftest_diag 🔴:
- Task: https://cirrus-ci.com/task/5382945287438336
- Summary: https://api.cirrus-ci.com/v1/artifact/task/5382945287438336/summary/summary.txt
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/b6ca0ca322e2
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-debugFor 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)
Quoted 9 lines · Paolo Abeni
The mentioned helper requires the msk socket lock, and the current callers don't own it nor can't acquire it, so the access is racy.
All the current callers are really checking for infinite mapping fallback, and the latter condition is explicitly tracked by the relevant msk variable: we can safely remove the caller usage
- and the caller itself.
Quoted 6 lines
The issue is present since
MP_FAILimplementation, but the fix only applies since the infinite fallback support, ence the somewhat unexpected fixes tag.Fixes 0530020a7c8f ("mptcp: track and update contiguous data status")Signed-off-by Paolo Abeni <[email protected]>
Looks good to me. I wasn't able to reproduce the CI failure.
Quoted 62 lines
---
net/mptcp/pm.c | 2 +- net/mptcp/protocol.h | 13 ------------- net/mptcp/subflow.c | 3 +-- 3 files changed, 2 insertions(+), 16 deletions(-)net/mptcp/pm.c +1
-1@@ -303,7 +303,7 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)pr_debug ("fail_seq=%llu" , fail_seq); -if (mptcp_has_another_subflow (sk) || !READ_ONCE (msk->allow_infinite_fallback)) +if (!READ_ONCE (msk->allow_infinite_fallback))return ;if (!READ_ONCE (subflow->mp_fail_response_expect)) {net/mptcp/protocol.h +0
-13@@ -661,19 +661,6 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow (struct sock *ssk) -{ -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk), *tmp; -struct mptcp_sock *msk =mptcp_sk (subflow->conn); - -mptcp_for_each_subflow (msk, tmp) { -if (tmp != subflow) -return true; - } - -return false; -} -void __init mptcp_proto_init (void );#if IS_ENABLED (CONFIG_MPTCP_IPV6 )int __init mptcp_proto_v6_init (void );net/mptcp/subflow.c +1
-2@@ -1218,8 +1218,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (!__mptcp_check_fallback (msk)) {/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk) || - !READ_ONCE (msk->allow_infinite_fallback)) { +if (!READ_ONCE (msk->allow_infinite_fallback)) { ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ;Signature · 1 line
2.35.3
--
Mat Martineau
Intel
Quoted 16 lines · Mat Martineau <[email protected]> 于2022年5月12日周四 08:15写道:
Quoted 13 lines · Paolo Abeni
The mentioned helper requires the msk socket lock, and the current callers don't own it nor can't acquire it, so the access is racy.
All the current callers are really checking for infinite mapping fallback, and the latter condition is explicitly tracked by the relevant msk variable: we can safely remove the caller usage
- and the caller itself.The issue is present since
MP_FAILimplementation, but the fix only applies since the infinite fallback support, ence the somewhat unexpected fixes tag.
Quoted 6 lines
Quoted 2 lines
Fixes 0530020a7c8f ("mptcp: track and update contiguous data status")Signed-off-by Paolo Abeni <[email protected]>Looks good to me. I wasn't able to reproduce the CI failure.
Reviewed-by Mat Martineau <[email protected]>
CI reported this failure:
[13:54:03.080] # itx[ ok ] - infirx[fail] got 0 infinite map[s] RX expected 1
But it doesn't occur in my test.
Thanks,
-Geliang
Quoted 70 lines
Quoted 61 lines
---
net/mptcp/pm.c | 2 +- net/mptcp/protocol.h | 13 ------------- net/mptcp/subflow.c | 3 +-- 3 files changed, 2 insertions(+), 16 deletions(-)net/mptcp/pm.c +1
-1@@ -303,7 +303,7 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)pr_debug ("fail_seq=%llu" , fail_seq); -if (mptcp_has_another_subflow (sk) || !READ_ONCE (msk->allow_infinite_fallback)) +if (!READ_ONCE (msk->allow_infinite_fallback))return ;if (!READ_ONCE (subflow->mp_fail_response_expect)) {net/mptcp/protocol.h +0
-13@@ -661,19 +661,6 @@ static inline void mptcp_subflow_tcp_fallback(struct sock *sk,inet_csk (sk)->icsk_af_ops = ctx->icsk_af_ops; } -static inline bool mptcp_has_another_subflow (struct sock *ssk) -{ -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk), *tmp; -struct mptcp_sock *msk =mptcp_sk (subflow->conn); - -mptcp_for_each_subflow (msk, tmp) { -if (tmp != subflow) -return true; - } - -return false; -} -void __init mptcp_proto_init (void );#if IS_ENABLED (CONFIG_MPTCP_IPV6 )int __init mptcp_proto_v6_init (void );net/mptcp/subflow.c +1
-3@@ -1218,8 +1218,7 @@ static bool subflow_check_data_avail(struct sock *ssk)if (!__mptcp_check_fallback (msk)) {/* RFC 8684 section 3.7. */ if (subflow->send_mp_fail) { -if (mptcp_has_another_subflow (ssk) || - !READ_ONCE (msk->allow_infinite_fallback)) { +if (!READ_ONCE (msk->allow_infinite_fallback)) { ssk->sk_err =EBADMSG ;tcp_set_state (ssk,TCP_CLOSE ); subflow->reset_transient =0 ; --Quoted 4 lines
2.35.3
--
Mat Martineau
Intel
Hi Paolo, Mat, Geliang,
Quoted 4 lines · Paolo Abeni
The mentioned helper requires the msk socket lock, and the current callers don't own it nor can't acquire it, so the access is racy.
Quoted 8 lines
All the current callers are really checking for infinite mapping fallback, and the latter condition is explicitly tracked by the relevant msk variable: we can safely remove the caller usage
- and the caller itself.The issue is present since
MP_FAILimplementation, but the fix only applies since the infinite fallback support, ence the somewhat unexpected fixes tag.
Thank you for the patch, review and validation!
Just applied in our tree (fixes for net-next) with Mat's RvB and Geliang's ACK+Test tag.
New patches for t/upstream:
- 9dc556bbb2c6: mptcp: stop using the mptcp_has_another_subflow() helper
- Results: 2cb58f40e877..7e5581f27ee6 (export)
Builds and tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220516T161647
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net