From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v8 4/8] mptcp: remove CB offset field
Date: Tue, 25 Aug 2026 08:17:10 +0000 [thread overview]
Message-ID: <20260825081710.E11791F000E9@smtp.kernel.org> (raw)
In-Reply-To: <e5a0ab26b1dae80ae284ebe5e3adf24840f68589.1787644449.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mptcp_inq_hint() can return arbitrarily large, bogus values to userspace (via FIONREAD) due to a missing sequence sync check when the unread data length evaluates to less than INT_MAX, enabling a remotely triggerable Denial of Service.
--
--- Patch [4]: [PATCH mptcp-next v8 4/8] mptcp: remove CB offset field ---
commit f21bf73a134ec25916ac8358db183f0eea8d9925
Author: Paolo Abeni <pabeni@redhat.com>
mptcp: remove CB offset field
This commit introduces a new msk-level field to track the bytes already
consumed inside each skb, similar to TCP, instead of using a CB offset
field. It synchronizes sequence spaces and simplifies hint calculations
and buffer moves.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -2408,26 +2391,26 @@ static bool mptcp_move_skbs(struct sock *sk)
> return enqueued;
> }
>
> -static unsigned int mptcp_inq_hint(const struct sock *sk)
> +static unsigned int mptcp_inq_hint(struct sock *sk)
> {
> const struct mptcp_sock *msk = mptcp_sk(sk);
> - const struct sk_buff *skb;
> + u64 hint_val;
>
> - skb = skb_peek(&sk->sk_receive_queue);
> - if (skb) {
> - u64 hint_val = atomic64_read(&msk->ack_seq) -
> - MPTCP_SKB_CB(skb)->map_seq;
> -
> - if (hint_val >= INT_MAX)
> - return INT_MAX;
> -
> - return (unsigned int)hint_val;
> + /* Avoid races vs ack_seq updates. */
> + mptcp_data_lock(sk);
> + hint_val = atomic64_read(&msk->ack_seq) - msk->copied_seq;
> + mptcp_data_unlock(sk);
> + if (hint_val >= INT_MAX) {
> + if (test_bit(MPTCP_SYNC_SEQ, &msk->cb_flags))
> + return 0;
> + return INT_MAX;
> }
[Severity: High]
Does this logic allow un-synced sequence lengths smaller than INT_MAX to
leak into userspace?
If a server application is actively reading data in recvmsg() (holding the
socket lock) and a remote attacker sends a third ACK with MP_CAPABLE, the
softirq defers updating copied_seq by setting the MPTCP_SYNC_SEQ bit.
Because the test_bit(MPTCP_SYNC_SEQ, ...) check is nested inside the
if (hint_val >= INT_MAX) block, an attacker could bypass the sync check by
crafting a sender_key such that the resulting hint_val is just under INT_MAX.
Could this return an arbitrarily large hint_val to userspace via FIONREAD
(TCP_INQ), potentially leading to massive application-level memory allocations
and rapid memory exhaustion?
>
> - if (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN))
> + if (!hint_val &&
> + (sk->sk_state == TCP_CLOSE || (sk->sk_shutdown & RCV_SHUTDOWN)))
> return 1;
>
> - return 0;
> + return (unsigned int)hint_val;
> }
>
> static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787644449.git.tanggeliang@kylinos.cn?part=4
next prev parent reply other threads:[~2026-08-25 8:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 7:57 [PATCH mptcp-next v8 0/8] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-08-25 7:57 ` [PATCH mptcp-next v8 1/8] mptcp: use atomic64_t for msk->ack_seq Geliang Tang
2026-08-25 8:14 ` sashiko-bot
2026-08-25 7:57 ` [PATCH mptcp-next v8 2/8] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-08-25 7:57 ` [PATCH mptcp-next v8 3/8] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-08-25 7:57 ` [PATCH mptcp-next v8 4/8] mptcp: remove CB offset field Geliang Tang
2026-08-25 8:17 ` sashiko-bot [this message]
2026-08-25 7:57 ` [PATCH mptcp-next v8 5/8] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-08-25 7:57 ` [PATCH mptcp-next v8 6/8] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-08-25 8:14 ` sashiko-bot
2026-08-25 7:57 ` [PATCH mptcp-next v8 7/8] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-08-25 7:57 ` [PATCH mptcp-next v8 8/8] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-08-25 9:05 ` [PATCH mptcp-next v8 0/8] 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=20260825081710.E11791F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox