Skip to content

mptcp: avoid data-races around the sysctls

Gang Yan mptcp sashiko-reviews 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest6 patches 4 repliesIn review
  2. v66 patches 3 repliesSuperseded
  3. v56 patches 1 replySuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v46 patches2 repliesSuperseded
v35 patches6 repliesSuperseded
v2 posting 2/25 patches8 repliesSuperseded
v2 posting 1/22 of 5 patches1 replySuperseded
v13 patches2 repliesSuperseded

Changes in v7 from the cover letter

Patch 5:
- Rephrase the commit message accoding to sashiko's comments.[1]

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6mptcp: sched: change scheduler sysctl atomicallynet/mptcp/ctrl.c net/mptcp/protocol.c net/mptcp/protocol.h +1 more+54 -170 replies
2/6mptcp: pm: change path_manager sysctl atomicallynet/mptcp/ctrl.c net/mptcp/pm.c net/mptcp/protocol.h+26 -130 replies
3/6mptcp: use READ_ONCE() over sysctlsnet/mptcp/ctrl.c+8 -80 replies
4/6mptcp: pm: use WRITE_ONCE() for the pm_type sysctlnet/mptcp/ctrl.c+7 -10 replies
5/6Squash-to "mptcp: pm: init and release mptcp_pm_ops"net/mptcp/ctrl.c net/mptcp/pm.c net/mptcp/protocol.h+30 -190 replies
6/6Squash to previous onenet/mptcp/pm.c net/mptcp/protocol.c net/mptcp/protocol.h +1 more+59 -162 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.

Read the v7 thread

Cover letter [PATCH mptcp-next v7 0/6] mptcp: avoid data-races around the sysctls

From: Gang Yan <[email protected]>

Changlog:
v7:
Patch 5:
- Rephrase the commit message accoding to sashiko's comments.[1]

Patch 6:
- Fix the use-after-free reported by sashiko [2]: the module reference is now taken inside the same RCU read section as the pointer fetch in mptcp_pm_data_reset(), so the ops cannot be freed between the rcu_read_unlock() and the bpf_try_module_get() that previously lived in mptcp_pm_ops_init(). The fallback to mptcp_pm_kernel now takes a reference as well, fixing a pre-existing refcount underflow when MPTCP is built as a module.
- Fix the reported use-after-free in [2]: take the module reference inside the same RCU read section as the pointer fetch.
- The remaining of [2] are not actual issues, along with the "scheduling while atomic" one which does not apply: lock_sock() has mutex semantics, no spinlock is held across synchronize_rcu().
- Clear the pm.ops inherited by cloned sockets before re-selecting
it: the clone entered the swap logic with a reference it never took, and the grace period wait could run in RX softirq.
- Wait for a grace period before releasing the retired ops in all cases (same-ops reuse and final destruction included).
v6:

v5:

v4:

v3:

v2:

v2:

[1] https://sashiko.dev/#/patchset/[email protected]?part=5
[2] https://sashiko.dev/#/patchset/[email protected]?part=6

Gang Yan (5):
mptcp: sched: change scheduler sysctl atomically
mptcp: pm: change path_manager sysctl atomically
mptcp: pm: use WRITE_ONCE() for the pm_type sysctl Squash-to "mptcp: pm: init and release mptcp_pm_ops" Squash to previous one

Matthieu Baerts (NGI0) (1):
mptcp: use READ_ONCE() over sysctls

 net/mptcp/ctrl.c     | 141 ++++++++++++++++++++++++++++++++-----------
 net/mptcp/pm.c       |  64 ++++++++++++++------
 net/mptcp/protocol.c |   7 ++-
 net/mptcp/protocol.h |   9 +--
 net/mptcp/sched.c    |   2 +-
 net/mptcp/subflow.c  |   9 ++-
 6 files changed, 171 insertions(+), 61 deletions(-)
Signature · 1 line
2.43.0