MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kalpan Jani" <kalpan.jani@mpiricsoftware.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v4 2/2] selftests: mptcp: bpf: exercise the subflow avoid flag across rounds
Date: Mon, 14 Sep 2026 09:32:04 +0000	[thread overview]
Message-ID: <20260914093205.113E81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914092000.1306968-3-kalpan.jani@mpiricsoftware.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `test_avoid` selftest contains fundamental logic flaws that cause it to silently pass without ever exercising the `avoid` functionality, resulting in a false positive test.
--

commit 23085ecdc8efb175d47c716d935708a8072a4cd5
Author: Kalpan Jani <kalpan.jani@mpiricsoftware.com>

selftests: mptcp: bpf: exercise the subflow avoid flag across rounds

This commit adds a BPF struct_ops scheduler selftest for 
mptcp_subflow_set_avoid(). It attempts to mark subflows as avoided during the
first scheduling round and verifies they are skipped in subsequent rounds.

Link: https://github.com/multipath-tcp/mptcp_net-next/issues/349

> diff --git a/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c b/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c
> new file mode 100644
> index 0000000000000..359b515800875
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/mptcp_bpf_avoid.c

[ ... ]

> +SEC("struct_ops")
> +int BPF_PROG(bpf_avoid_get_send, struct mptcp_sock *msk)
> +{
> +	struct mptcp_subflow_context *subflow;
> +	struct mptcp_avoid_storage *ptr;
> +
> +	ptr = bpf_sk_storage_get(&mptcp_avoid_map, msk, 0,
> +				 BPF_LOCAL_STORAGE_GET_F_CREATE);
> +	if (!ptr)
> +		return -1;
> +
> +	/*
> +	 * set once, on the first scheduling round, never touched again --
> +	 * this is what makes "avoid" different from "scheduled": nothing
> +	 * here re-asserts the decision, and the core doesn't clear it
> +	 * either.
> +	 */
> +	if (!ptr->avoid_marked) {
> +		int i = 0;
> +
> +		/* bench every subflow but the first, once */
> +		bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) {
> +			if (i++ > 0)
> +				mptcp_subflow_set_avoid(subflow, true);
> +		}
> +		ptr->avoid_marked = true;
> +	}

[Severity: Medium]
Since bpf_avoid_get_send() is called immediately when the first subflow is 
established (and before the second subflow finishes its MP_JOIN), is `i++ > 0` 
ever true here?

If there is only one subflow when this initialization block runs, `avoid` will 
never be set for any subflow, but `avoid_marked` becomes true, which permanently 
locks out this block.

> +
> +	/*
> +	 * every round -- including this one -- just reads back state set
> +	 * at most once above. no re-assertion, ever.
> +	 */
> +	bpf_for_each(mptcp_subflow, subflow, (struct sock *)msk) {
> +		if (subflow->avoid)
> +			continue;
> +		if (mptcp_subflow_active(subflow)) {
> +			mptcp_subflow_set_scheduled(subflow, true);
> +			break;
> +		}
> +	}
> +	return 0;
> +}

[Severity: Medium]
Because the first subflow is never marked to be avoided, does this loop always 
break on the first active subflow?

Since the first subflow naturally handles the entire data transfer, it is always 
selected, and the second subflow is never evaluated. Does this cause the test 
to artificially pass and provide a false positive result, regardless of whether 
the `avoid` feature actually works?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914092000.1306968-1-kalpan.jani@mpiricsoftware.com?part=2

  reply	other threads:[~2026-09-14  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  9:19 [PATCH mptcp-next v4 0/2] mptcp: sched: let schedulers mark a subflow to avoid Kalpan Jani
2026-09-14  9:19 ` [PATCH mptcp-next v4 1/2] mptcp: sched: add subflow avoid flag and enforce it in default sched Kalpan Jani
2026-09-14  9:20 ` [PATCH mptcp-next v4 2/2] selftests: mptcp: bpf: exercise the subflow avoid flag across rounds Kalpan Jani
2026-09-14  9:32   ` sashiko-bot [this message]
2026-09-14 10:29 ` [PATCH mptcp-next v4 0/2] mptcp: sched: let schedulers mark a subflow to avoid 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=20260914093205.113E81F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kalpan.jani@mpiricsoftware.com \
    --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