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 v4 5/5] selftests/bpf: Update sockmap tests for MPTCP
Date: Mon, 24 Aug 2026 07:21:51 +0000	[thread overview]
Message-ID: <20260824072152.1D0711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <1cb449fc7531df4bade69ee95cbbe217db85c1cb.1787554581.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Medium] Incomplete test conversion for `test_sockmap_with_mptcp` that contradicts the commit message.

Pre-existing issues:
- [High] Unchecked `skb_pull()` in `mptcp_read_skb()` causes a kernel panic if the partial read offset exceeds the linear data length.
--

--- Patch [5]: [PATCH mptcp-next v4 5/5] selftests/bpf: Update sockmap tests for MPTCP ---
commit a45d03b16d520c3cfcda9a50c975aef36b416a66
Author: Geliang Tang <geliang@kernel.org>

selftests/bpf: Update sockmap tests for MPTCP

This commit updates sockmap tests to reflect new MPTCP support. It allows
MPTCP sockets in sockmap and adjusts the test expectations. It also adds
explicit map updates for server_fd1 and server_fd2 since sockops fires on TCP
subflows which return -EOPNOTSUPP for MPTCP connections.

> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index d77c9f8c53c75..4f8727dbcbfd0 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
[ ... ]
> @@ -500,30 +500,36 @@ static void test_subflow(void)
[ ... ]
>  	server_fd1 = accept(listen_fd, NULL, 0);
> +	err = bpf_map_update_elem(bpf_map__fd(skel->maps.sock_map),
> +				  &zero, &server_fd1, BPF_NOEXIST);
> +	if (!ASSERT_OK(err, "sockmap:add server_fd1"))
> +		goto end;
> +
>  	skel->bss->sk_index = 1;
>  	client_fd2 = connect_to_fd_opts(listen_fd, NULL);
> -	if (!ASSERT_OK_FD(client_fd2, "sockmap-fb:connect_to_fd"))
> +	if (!ASSERT_OK_FD(client_fd2, "sockmap:connect_to_fd"))
>  		goto end;
>  
>  	server_fd2 = accept(listen_fd, NULL, 0);

[Severity: Medium]
Does this code miss the changes for client_fd2 and server_fd2 that were
mentioned in the commit message?

The commit message states:
"Add server_fd1 and server_fd2 to the sockmap explicitly from userspace via
bpf_map_update_elem() instead of relying on the sockops program."

However, that map update appears to be missing here for server_fd2.

Additionally, client_fd2 is still created using connect_to_fd_opts() with
NULL options, creating a TCP fallback socket rather than an MPTCP socket.
Should client_fd2 also be converted to use connect_to_fd(listen_fd, 0) to
fully test the MPTCP support for the second socket pair?


[Severity: High]
This is a pre-existing issue, but can the unchecked skb_pull() in
mptcp_read_skb() located in net/mptcp/protocol.c cause a kernel panic?

If a user creates an MPTCP socket, receives a packet where the payload is
stored in page fragments, reads a partial amount of data, and then attaches
the socket to a sockmap, mptcp_read_skb() can be invoked.

net/mptcp/protocol.c:mptcp_read_skb() {
    ...
        if (offset)
            skb_pull(skb, offset);
    ...
}

If the partial read offset exceeds the linear data length, the skb_pull() call
without prior bounds checking will trigger a BUG() inside __skb_pull(). Should
this offset be validated against the available linear region before pulling?

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

  reply	other threads:[~2026-08-24  7:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  7:09 [PATCH mptcp-next v4 0/5] implement psock_update_sk_prot Geliang Tang
2026-08-24  7:09 ` [PATCH mptcp-next v4 1/5] mptcp: implement .splice_eof Geliang Tang
2026-08-24  7:09 ` [PATCH mptcp-next v4 2/5] selftests: mptcp: connect: trigger splice_eof Geliang Tang
2026-08-24  7:09 ` [PATCH mptcp-next v4 3/5] mptcp: implement read_skb for sockmap stream verdict Geliang Tang
2026-08-24  7:31   ` sashiko-bot
2026-08-24  7:09 ` [PATCH mptcp-next v4 4/5] mptcp: implement psock_update_sk_prot Geliang Tang
2026-08-24  7:32   ` sashiko-bot
2026-08-24  7:09 ` [PATCH mptcp-next v4 5/5] selftests/bpf: Update sockmap tests for MPTCP Geliang Tang
2026-08-24  7:21   ` sashiko-bot [this message]
2026-08-24  8:40 ` [PATCH mptcp-next v4 0/5] implement psock_update_sk_prot 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=20260824072152.1D0711F000E9@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.