From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v5 13/16] mptcp: add sk_is_msk() helper and use it in sockmap
Date: Sun, 13 Sep 2026 10:48:47 +0000 [thread overview]
Message-ID: <20260913104847.EF1B91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <29ec7b3fc7febc1c8946add34f859c8253d9714f.1789294365.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Dereferencing a NULL function pointer (`sock->ops->peek_len`) when an MPTCP socket is attached to a sockmap or stream parser, causing a kernel panic.
- [High] MPTCP sockets are whitelisted for sockmap and stream parser operations without implementing the necessary BPF protocol hooks, leading to connection stalls, memory exhaustion, or dead code.
--
commit 2158e08c7c84a4a26fae56ddc0a38db5585b51c3
Author: Geliang Tang <geliang@kernel.org>
mptcp: add sk_is_msk() helper and use it in sockmap
This commit introduces the sk_is_msk() helper to identify MPTCP sockets.
It modifies sock_map.c to treat MPTCP sockets identically to TCP sockets
for stream parser linking, redirect checks, and state validation.
> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
> index 3e3e85e3bd54e..e9e0b676aa1ca 100644
> --- a/net/core/sock_map.c
> +++ b/net/core/sock_map.c
> @@ -303,7 +303,7 @@ static int sock_map_link(struct bpf_map *map, struct sock *sk)
>
> write_lock_bh(&sk->sk_callback_lock);
> if (stream_parser && stream_verdict && !psock->saved_data_ready) {
> - if (sk_is_tcp(sk))
> + if (sk_is_tcp(sk) || sk_is_msk(sk))
> ret = sk_psock_init_strp(sk, psock);
[Severity: High]
Does this code expose MPTCP sockets to a NULL pointer dereference?
By enabling stream parser initialization for MPTCP sockets here, we
override the socket operations and expose the stream parser paths.
However, MPTCP sockets do not implement the .peek_len operation
in mptcp_stream_ops.
When an MPTCP socket is attached to a sockmap, its ioctl is overridden
to tcp_bpf_ioctl(), which unconditionally calls it:
net/ipv4/tcp_bpf.c:tcp_bpf_ioctl() {
...
*karg += sk->sk_socket->ops->peek_len(sk->sk_socket);
...
}
Similarly, the stream parser unconditionally calls it when parsing:
net/strparser/strparser.c:strp_peek_len() {
...
return sock->ops->peek_len(sock);
}
Can an unprivileged user trigger a kernel panic by adding an MPTCP socket
to a sockmap and invoking ioctl(SIOCINQ) or receiving partial data?
[Severity: High]
Does this code also cause connection stalls and potential memory exhaustion
by whitelisting MPTCP for sockmap without implementing the required BPF
protocol hooks?
When an MPTCP socket is attached and processing SKBs, mptcp_read_skb()
unlinks the SKB for BPF verdict processing but entirely skips MPTCP's
internal consumption accounting (msk->bytes_consumed). This causes
mptcp_data_avail() to always return > 0, leading to mptcp_poll() busy-looping
with EPOLLIN at 100% CPU.
Additionally, when a stream parser is attached, sk_psock_init_strp()
skips overriding read_sock for MPTCP:
net/core/skmsg.c:sk_psock_init_strp() {
...
if (sk_is_tcp(sk)) {
psock->strp.cb.read_sock = tcp_bpf_strp_read_sock;
...
}
This forces a fallback to mptcp_read_sock(), which improperly uncharges the
SKB memory from the socket and ACKs the sender while the parser clones the
uncharged data into psock->ingress_msg. This bypasses socket memory limits,
allowing an attacker to stream infinite data and exhaust kernel memory.
Finally, MPTCP fails to provide a custom recvmsg parser for the BPF
configurations in mptcp_bpf_rebuild_protos(), falling back to mapping
mptcp_bpf_recvmsg directly to __tcp_bpf_recvmsg. This completely breaks
sequence tracking when SKB verdicts route data to the psock.
> else
> ret = -EOPNOTSUPP;
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789294365.git.tanggeliang@kylinos.cn?part=13
next prev parent reply other threads:[~2026-09-13 10:48 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 [this message]
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
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=20260913104847.EF1B91F000FF@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.