From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v5 3/7] mptcp: remove CB offset field
Date: Sat, 22 Aug 2026 03:36:18 +0000 [thread overview]
Message-ID: <20260822033619.77D2B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <7ea2978b1777ca56a0bdfe72f8f8da0cc1667d94.1787368526.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing memory barrier before set_bit(MPTCP_SYNC_SEQ, &msk->cb_flags) causes a data race, allowing a concurrent lockless reader in __mptcp_move_skb() to read a stale msk->ack_seq.
--
--- Patch [3]: [PATCH mptcp-next v5 3/7] mptcp: remove CB offset field ---
commit 9bf62f08e2b81be277b483eb357610241e9d800b
Author: Paolo Abeni <pabeni@redhat.com>
mptcp: remove CB offset field
This replaces the SKB CB offset field with a new msk-level copied_seq field
to track the bytes already consumed. It also introduces explicit synchronization
for the TFO SKB in the receive queue using the MPTCP_SYNC_SEQ flag.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -464,6 +460,9 @@ static bool __mptcp_move_skb(struct sock *sk, struct sk_buff *skb)
>
> mptcp_borrow_fwdmem(sk, skb);
>
> + if (test_and_clear_bit(MPTCP_SYNC_SEQ, &msk->cb_flags))
> + msk->copied_seq += mptcp_iasn(msk);
> +
[Severity: High]
Can this lockless reader observe the MPTCP_SYNC_SEQ flag as set but still read
a stale msk->ack_seq (via mptcp_iasn())?
If a Fast Open connection receives the remote key in BH context while a user
thread concurrently processes the backlog here, a missing memory barrier on the
writer side might cause mptcp_iasn() to calculate using a stale sequence
number.
Could this corrupt copied_seq and lead to incorrect offset calculations for
subsequent packets?
> /* Be sure to sync the eventual fastopen dummy mapping before any other
> * skb lands into the msk.
> */
[ ... ]
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
[ ... ]
> @@ -497,10 +497,13 @@ static void subflow_set_remote_key(struct mptcp_sock *msk,
> WRITE_ONCE(msk->can_ack, true);
> atomic64_set(&msk->rcv_wnd_sent, subflow->iasn);
>
> - if (!sock_owned_by_user(sk))
> + if (!sock_owned_by_user(sk)) {
> + /* User space could have already read partially the TFO skb */
> + msk->copied_seq += subflow->iasn;
> __mptcp_sync_rcv_sequence(sk);
> - else
> + } else {
> set_bit(MPTCP_SYNC_SEQ, &msk->cb_flags);
> + }
> }
[Severity: High]
Could the lack of a memory barrier here cause a data race on weakly-ordered
architectures?
The writer updates msk->ack_seq earlier in the function and then sets
MPTCP_SYNC_SEQ using set_bit(), which does not imply a memory barrier.
Is it possible for the CPU to reorder these writes, making the flag visible to
__mptcp_move_skb() before the new sequence number is committed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787368526.git.tanggeliang@kylinos.cn?part=3
next prev parent reply other threads:[~2026-08-22 3:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 3:19 [PATCH mptcp-next v5 0/7] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-08-22 3:19 ` [PATCH mptcp-next v5 1/7] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-08-22 3:19 ` [PATCH mptcp-next v5 2/7] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-08-22 3:19 ` [PATCH mptcp-next v5 3/7] mptcp: remove CB offset field Geliang Tang
2026-08-22 3:36 ` sashiko-bot [this message]
2026-08-22 3:19 ` [PATCH mptcp-next v5 4/7] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-08-22 3:19 ` [PATCH mptcp-next v5 5/7] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-08-22 3:36 ` sashiko-bot
2026-08-22 3:19 ` [PATCH mptcp-next v5 6/7] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-08-22 3:28 ` sashiko-bot
2026-08-22 3:19 ` [PATCH mptcp-next v5 7/7] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-08-22 4:33 ` [PATCH mptcp-next v5 0/7] Reduce the differences between TCP and MPTCP for TLS usage MPTCP CI
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260822033619.77D2B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.