mptcp: sockopt: set timestamp flags on subflow socket, not msk
Subsystems (2)
PATCH 1/1 mptcp: sockopt: set timestamp flags on subflow socket, not msk
From: Gang Yan <[email protected]>
Both mptcp_setsockopt_sol_socket_tstamp() and mptcp_setsockopt_sol_socket_timestamping() iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket to sock_set_timestamp() / sock_set_timestamping() instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.
Pass ssk instead of sk to both helpers.
--- net/mptcp/sockopt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/sockopt.c +2 -2
@@ -161,7 +161,7 @@ static int mptcp_setsockopt_sol_socket_tstamp(struct mptcp_sock *msk, int optnamstruct sock *ssk =mptcp_subflow_tcp_sock (subflow);bool slow =lock_sock_fast (ssk); -sock_set_timestamp (sk, optname, !!val); +sock_set_timestamp (ssk, optname, !!val);unlock_sock_fast (ssk, slow); }
@@ -237,7 +237,7 @@ static int mptcp_setsockopt_sol_socket_timestamping(struct mptcp_sock *msk,struct sock *ssk =mptcp_subflow_tcp_sock (subflow);bool slow =lock_sock_fast (ssk); -sock_set_timestamping (sk, optname, timestamping); +sock_set_timestamping (ssk, optname, timestamping);unlock_sock_fast (ssk, slow); }
Signature · 1 line
2.43.0
Hi Gang,
Quoted 10 lines · Gang Yan
From: Gang Yan <[email protected]>
Both
mptcp_setsockopt_sol_socket_tstamp()andmptcp_setsockopt_sol_socket_timestamping()iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket tosock_set_timestamp()/sock_set_timestamping()instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.Pass ssk instead of sk to both helpers.
Good catch! How did you find the issue? It would be good to add a test for that, but not sure how.
Quoted 1 line
Fixes 3f4f958c3a3c ("mptcp: sockopt: propagate timestamp request to subflows")
It looks like this commit doesn't exist in the 'export' or 'export-net' branches. I guess you meant to use 9061f24bf82e instead?
When you do a git blame, do not use branches from the TopGit tree. Use 'net', 'net-next', or the 'export' ones.
Quoted 2 lines
Fixes 6c9a0a0f2333 ("mptcp: setsockopt: convert to mptcp_setsockopt_sol_socket_timestamping()")Assisted-by GLM-5.1
Thank you for using this tag!
Apart from the above, it looks good to me:
I will wait for the CI, but I can also fix the SHA (if correct) when applying the patch.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerQuoted 17 lines · Matthieu Baerts
Hi Gang,
Quoted 10 lines · Gang Yan
From: Gang Yan <[email protected]>
Both
mptcp_setsockopt_sol_socket_tstamp()andmptcp_setsockopt_sol_socket_timestamping()iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket tosock_set_timestamp()/sock_set_timestamping()instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.Pass ssk instead of sk to both helpers.
Good catch! How did you find the issue? It would be good to add a test for that, but not sure how.
Quoted 9 lines
Quoted 1 line
Fixes 3f4f958c3a3c ("mptcp: sockopt: propagate timestamp request to subflows")It looks like this commit doesn't exist in the 'export' or 'export-net' branches. I guess you meant to use
9061f24bf82einstead?When you do a git blame, do not use branches from the TopGit tree. Use 'net', 'net-next', or the 'export' ones.
Quoted 1 line
Fixes 6c9a0a0f2333 ("mptcp: setsockopt: convert to mptcp_setsockopt_sol_socket_timestamping()")
It looks like only the previous one is enough. This second commit moves code around, but it already contained the issue fixed here.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Gang,
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): Unstable: 1 failed test(s): packetdrill_sockopts ⚠️
- 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/24659822856
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/6e2320fe83ea
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1083210
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)
Matthieu Baerts
maintainerHi Gang,
Quoted 28 lines · Matthieu Baerts
Hi Gang,
Quoted 10 lines · Gang Yan
From: Gang Yan <[email protected]>
Both
mptcp_setsockopt_sol_socket_tstamp()andmptcp_setsockopt_sol_socket_timestamping()iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket tosock_set_timestamp()/sock_set_timestamping()instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.Pass ssk instead of sk to both helpers.
Good catch! How did you find the issue? It would be good to add a test for that, but not sure how.
Quoted 1 line
Fixes 3f4f958c3a3c ("mptcp: sockopt: propagate timestamp request to subflows")It looks like this commit doesn't exist in the 'export' or 'export-net' branches. I guess you meant to use
9061f24bf82einstead?When you do a git blame, do not use branches from the TopGit tree. Use 'net', 'net-next', or the 'export' ones.
Quoted 2 lines
Fixes 6c9a0a0f2333 ("mptcp: setsockopt: convert to mptcp_setsockopt_sol_socket_timestamping()")Assisted-by GLM-5.1
Quoted 8 lines
Thank you for using this tag!
Apart from the above, it looks good to me:
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>I will wait for the CI, but I can also fix the SHA (if correct) when applying the patch.
I'm going to apply the patch, but I noticed sashiko mentioned a possible other existing issue:
https://sashiko.dev/#/patchset/[email protected]
Do you mind checking if what was reported is correct, please?
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Gang,
Quoted 10 lines · Gang Yan
From: Gang Yan <[email protected]>
Both
mptcp_setsockopt_sol_socket_tstamp()andmptcp_setsockopt_sol_socket_timestamping()iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket tosock_set_timestamp()/sock_set_timestamping()instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.Pass ssk instead of sk to both helpers.
Thank you for the patch, now in our tree (but don't forget the other questions in my other emails in this email thread ;-) )
New patches for t/upstream-net and t/upstream:
- 7ed202c8815a: mptcp: sockopt: set timestamp flags on subflow socket, not msk
- Results: 4ef37f659c52..4f7190e1b98d (export-net)
- Results: 3662f0d0a0b4..823280e7c25b (export)
Tests are now in progress:
- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/7f79e7f6f65de8de0d206d00b4e689e52a94b0ce/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/4464afe97dc56e817a23b730979cbc6fc48f1912/checks
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Quoted 15 lines · Matthieu Baerts
Hi Gang,
Quoted 10 lines · Gang Yan
From: Gang Yan <[email protected]>
Both
mptcp_setsockopt_sol_socket_tstamp()andmptcp_setsockopt_sol_socket_timestamping()iterate over subflows, acquire the subflow socket lock, but then erroneously pass the MPTCP msk socket tosock_set_timestamp()/sock_set_timestamping()instead of the subflow ssk. As a result, the timestamp flags are set on the wrong socket and have no effect on the actual subflows.
Quoted 5 lines
Quoted 2 lines
Pass ssk instead of sk to both helpers.
Good catch! How did you find the issue? It would be good to add a test for that, but not sure how.
Hi Matt,
Sorry for the late feedback.
Thanks! I’ve been using AI assistance to study and understand this part of the code recently, and that’s how I found the issue.
And I noticed the issue of sashiko mentioned. I’ll take time to look into it recently, and I will post updates on this issue to the mailing list.
Thanks
Gang
Quoted 27 lines
Quoted 3 lines
Fixes 3f4f958c3a3c ("mptcp: sockopt: propagate timestamp request to subflows")It looks like this commit doesn't exist in the 'export' or 'export-net' branches. I guess you meant to use
9061f24bf82einstead?When you do a git blame, do not use branches from the TopGit tree. Use 'net', 'net-next', or the 'export' ones.
Quoted 4 lines
Fixes 6c9a0a0f2333 ("mptcp: setsockopt: convert to mptcp_setsockopt_sol_socket_timestamping()")Assisted-by GLM-5.1Thank you for using this tag!
Apart from the above, it looks good to me:
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>I will wait for the CI, but I can also fix the SHA (if correct) when applying the patch.
Cheers,
MattSignature · 1 line
Sponsored by the NGI0 Core fund.