MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v9 11/11] Squash to "selftests/bpf: Add bpf_burst scheduler & test"
Date: Thu, 27 Aug 2026 11:17:50 +0000	[thread overview]
Message-ID: <20260827111751.4A8791F000E9@smtp.kernel.org> (raw)
In-Reply-To: <056ee1d2d313b38d6dfa20d44517ddeed34a63db.1787827525.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Reading a 64-bit atomic variable directly via READ_ONCE() from a BPF program causes load tearing on 32-bit architectures.
--

commit a7fdecf17f713344ff1f523b442eda6174e11cd2
Author: Geliang Tang <geliang@kernel.org>

    Squash to "selftests/bpf: Add bpf_burst scheduler & test"

This commit modifies the BPF burst scheduler test to safely read the newly
converted atomic64_t field msk->snd_nxt using READ_ONCE() on its .counter
member within the BPF context.

> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
> index 3d512b0efe6f7..a391f6563a618 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_burst.c
> @@ -108,7 +108,8 @@ int BPF_PROG(bpf_burst_get_send, struct mptcp_sock *msk)
>  	if (!subflow || !bpf_sk_stream_memory_free(subflow))
>  		return -1;
>  
> -	burst = min(MPTCP_SEND_BURST_SIZE, mptcp_wnd_end(msk) - msk->snd_nxt);
> +	burst = min(MPTCP_SEND_BURST_SIZE,
> +		    mptcp_wnd_end(msk) - READ_ONCE(msk->snd_nxt.counter));

[Severity: Medium]
Will this cause load tearing on 32-bit architectures?

When the kernel concurrently updates msk->snd_nxt using atomic64_set(), on
32-bit architectures (e.g. ARM32, i386) configured with CONFIG_GENERIC_ATOMIC64,
atomic64_t operations are protected by hashed spinlocks. The BPF JIT will
translate the 64-bit load of READ_ONCE(msk->snd_nxt.counter) into two separate,
unsynchronized 32-bit memory loads.

If the BPF program executes these memory loads while the kernel is writing to
the counter, it could observe a torn read, leading to an incorrect burst size
calculation that breaks the MPTCP bpf_burst scheduler logic.

>  	ssk = mptcp_subflow_tcp_sock(subflow);
>  	wmem = ssk->sk_wmem_queued;
>  	if (!burst)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787827525.git.tanggeliang@kylinos.cn?part=11

  reply	other threads:[~2026-08-27 11:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27 10:57 [PATCH mptcp-next v9 00/11] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 01/11] mptcp: use atomic64_t for locklessly accessed u64 fields Geliang Tang
2026-08-27 11:15   ` sashiko-bot
2026-08-27 10:57 ` [PATCH mptcp-next v9 02/11] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 03/11] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 04/11] mptcp: remove CB offset field Geliang Tang
2026-08-27 11:13   ` sashiko-bot
2026-08-27 10:57 ` [PATCH mptcp-next v9 05/11] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 06/11] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 07/11] mptcp: implement peek_len for proto_ops Geliang Tang
2026-08-27 11:10   ` sashiko-bot
2026-08-27 10:57 ` [PATCH mptcp-next v9 08/11] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 09/11] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 10/11] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-08-27 10:57 ` [PATCH mptcp-next v9 11/11] Squash to "selftests/bpf: Add bpf_burst scheduler & test" Geliang Tang
2026-08-27 11:17   ` sashiko-bot [this message]
2026-08-27 12:13 ` [PATCH mptcp-next v9 00/11] 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=20260827111751.4A8791F000E9@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