All of lore.kernel.org
 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 v5 16/16] selftests/bpf: add MPTCP coverage to sockmap_listen
Date: Sun, 13 Sep 2026 10:45:20 +0000	[thread overview]
Message-ID: <20260913104520.9D6941F000FF@smtp.kernel.org> (raw)
In-Reply-To: <3857608bd79abf9079a7bebd3d589194bb6433ff.1789294365.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [Medium] Unconditional loading of MPTCP BPF program breaks the entire test suite on kernels without CONFIG_MPTCP.
- [Medium] MPTCP redirect tests silently test standard TCP instead due to hardcoded protocol in create_socket_pairs().
- [Medium] The test suite unconditionally executes MPTCP socket tests and will report them as failures if the kernel does not support MPTCP.
- [Low] The SOTYPE_PROTO macro uses a bitwise AND on the SOCK_STREAM enum value.
--

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

selftests/bpf: add MPTCP coverage to sockmap_listen

Extend sockmap_listen tests to cover MPTCP sockets. Run the full test
suite (ops, redir, reuseport) in both TCP and MPTCP modes, using
IPPROTO_MPTCP for stream sockets when in MPTCP mode. Skip UDP-specific
tests in MPTCP mode. Add a dedicated BPF reuseport program
(prog_reuseport_mptcp) that uses bpf_mptcp_sk_select_reuseport() for
MPTCP-aware reuseport selection. Prefix subtest names with the protocol
(tcp/mptcp) for clarity.

> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> index 1c96a3cf4b979..d31f3eb661d65 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
> @@ -31,6 +31,10 @@
>  
>  #define NO_FLAGS 0
>  
> +static bool mptcp;
> +#define SOTYPE_PROTO(st) \
> +	(mptcp && ((st) & SOCK_STREAM) ? IPPROTO_MPTCP : 0)

[Severity: Low]
Does this bitwise AND on the socket type work correctly for all socket types?

Since SOCK_STREAM is defined as 1, ((st) & SOCK_STREAM) coincidentally
evaluates to true for SOCK_STREAM (1) and false for SOCK_DGRAM (2). However,
it evaluates to true for other odd-numbered socket types like SOCK_RAW (3) or
SOCK_SEQPACKET (5).

Could this be rewritten as ((st) == SOCK_STREAM)?

[ ... ]

> @@ -1359,7 +1375,8 @@ static void test_redir(struct test_sockmap_listen *skel, struct bpf_map *map,
>  	map_name = map_type_str(map);
>  
>  	for (t = tests; t < tests + ARRAY_SIZE(tests); t++) {
> -		snprintf(s, sizeof(s), "%s %s %s", map_name, family_name,
> +		snprintf(s, sizeof(s), "%s %s %s %s",
> +			 mptcp ? "mptcp" : "tcp", map_name, family_name,
>  			 t->name);

[Severity: Medium]
Are the MPTCP redirect tests silently testing standard TCP instead?

The test_redir() function loops through tests like redir_to_connected() which
use create_socket_pairs() to establish connections.

However, create_socket_pairs() (defined in socket_helpers.h) hardcodes
proto = 0, which resolves to IPPROTO_TCP for SOCK_STREAM. It completely ignores
the SOTYPE_PROTO macro logic intended to create IPPROTO_MPTCP sockets.

[ ... ]

> @@ -1429,13 +1455,17 @@ void serial_test_sockmap_listen(void)
>  		return;
>  	}
>  
> -	skel->bss->test_sockmap = true;
> -	run_tests(skel, skel->maps.sock_map, AF_INET);
> -	run_tests(skel, skel->maps.sock_map, AF_INET6);
> +	for (int i = 0; i < 2; i++) {
> +		mptcp = i;
>  
> -	skel->bss->test_sockmap = false;
> -	run_tests(skel, skel->maps.sock_hash, AF_INET);
> -	run_tests(skel, skel->maps.sock_hash, AF_INET6);
> +		skel->bss->test_sockmap = true;
> +		run_tests(skel, skel->maps.sock_map, AF_INET);
> +		run_tests(skel, skel->maps.sock_map, AF_INET6);

[Severity: Medium]
Will this unconditionally execute MPTCP socket tests and report them as failures
if the kernel lacks MPTCP support?

When mptcp is set to 1, functions like socket_loopback_proto() call xsocket(),
which invokes FAIL_ERRNO("socket") if the socket creation fails (e.g., returning
-1 with EPROTONOSUPPORT).

Should the test check for MPTCP support first and gracefully skip the MPTCP
iterations?

[ ... ]

> diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_listen.c b/tools/testing/selftests/bpf/progs/test_sockmap_listen.c
> index b7250eb9c30cc..46e9929ba7c4d 100644
> --- a/tools/testing/selftests/bpf/progs/test_sockmap_listen.c
> +++ b/tools/testing/selftests/bpf/progs/test_sockmap_listen.c
> @@ -137,4 +140,26 @@ int prog_reuseport(struct sk_reuseport_md *reuse)
>  	return verdict;
>  }
>  
> +SEC("sk_reuseport")
> +int prog_reuseport_mptcp(struct sk_reuseport_md *reuse)
> +{
> +	unsigned int *count;
> +	int err, verdict;
> +	__u32 zero = 0;
> +
> +	if (test_sockmap)
> +		err = bpf_mptcp_sk_select_reuseport(reuse, &sock_map,
> +						    &zero, 0);

[Severity: Medium]
Will this break the entire test suite on kernels without CONFIG_MPTCP?

The bpf_mptcp_sk_select_reuseport helper is unknown to the verifier when
CONFIG_MPTCP is disabled.

Since test_sockmap_listen__open_and_load() unconditionally loads all programs
in the skeleton, this will cause the load to fail and skip all standard TCP
and UDP tests.

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

  reply	other threads:[~2026-09-13 10:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13 10:14 [PATCH mptcp-next v5 00/16] MPTCP sockmap support Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 01/16] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 02/16] mptcp: add sendmsg_locked to proto_ops Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 03/16] mptcp: track app-limited state in mptcp_sendmsg Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 04/16] selftests: mptcp: sockopt: check app_limited Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 05/16] bpf: drop duplicate check_app_limited in tcp_bpf_push Geliang Tang
2026-09-13 18:18   ` Matthieu Baerts
2026-09-13 10:14 ` [PATCH mptcp-next v5 06/16] mptcp: implement psock_update_sk_prot for sockmap Geliang Tang
2026-09-13 10:46   ` sashiko-bot
2026-09-13 18:22   ` Matthieu Baerts
2026-09-13 10:14 ` [PATCH mptcp-next v5 07/16] mptcp: add sock_map_update BPF helper Geliang Tang
2026-09-13 10:30   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 08/16] selftests/bpf: enable MPTCP support in sockmap tests Geliang Tang
2026-09-13 10:33   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 09/16] mptcp: implement read_skb for sockmap stream verdict Geliang Tang
2026-09-13 10:40   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 10/16] bpf: export and generalize tcp_bpf_ioctl Geliang Tang
2026-09-13 10:28   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 11/16] mptcp: add TCP_REPAIR sockopt support Geliang Tang
2026-09-13 10:38   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 12/16] selftests/bpf: add MPTCP coverage to sockmap_basic Geliang Tang
2026-09-13 10:30   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 13/16] mptcp: add sk_is_msk() helper and use it in sockmap Geliang Tang
2026-09-13 10:48   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 14/16] mptcp: add SO_ATTACH_REUSEPORT_EBPF support Geliang Tang
2026-09-13 10:14 ` [PATCH mptcp-next v5 15/16] mptcp: add sk_select_reuseport BPF helper Geliang Tang
2026-09-13 10:48   ` sashiko-bot
2026-09-13 10:14 ` [PATCH mptcp-next v5 16/16] selftests/bpf: add MPTCP coverage to sockmap_listen Geliang Tang
2026-09-13 10:45   ` sashiko-bot [this message]
2026-09-13 11:24 ` [PATCH mptcp-next v5 00/16] MPTCP sockmap support MPTCP CI
2026-09-13 11:43 ` 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=20260913104520.9D6941F000FF@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.