From: "Jiayuan Chen" <jiayuan.chen@linux.dev>
To: "Matthieu Baerts" <matttbe@kernel.org>
Cc: "Mat Martineau" <martineau@kernel.org>,
"Geliang Tang" <geliang@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Davide Caratti" <dcaratti@redhat.com>,
netdev@vger.kernel.org, mptcp@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v1] mptcp: fix incorrect IPv4/IPv6 check
Date: Wed, 15 Oct 2025 14:16:31 +0000 [thread overview]
Message-ID: <a0a2b87119a06c5ffaa51427a0964a05534fe6f1@linux.dev> (raw)
In-Reply-To: <f046fdda-3bad-4f7f-8587-dca30d183f82@kernel.org>
October 14, 2025 at 23:27, "Matthieu Baerts" <matttbe@kernel.org mailto:matttbe@kernel.org?to=%22Matthieu%20Baerts%22%20%3Cmatttbe%40kernel.org%3E > wrote:
>
> Hi Jiayuan,
>
> Thank you for sharing this patch!
>
> On 14/10/2025 14:26, Jiayuan Chen wrote:
>
> >
> > When MPTCP falls back to normal TCP, it needs to reset proto_ops. However,
> > for sockmap and TLS, they have their own custom proto_ops, so simply
> > checking sk->sk_prot is insufficient.
> >
> > For example, an IPv6 request might incorrectly follow the IPv4 code path,
> > leading to kernel panic.
> >
> Did you experiment issues, or is it a supposition? If yes, do you have
> traces containing such panics (or just a WARN()?), and ideally the
> userspace code that was leading to this?
>
Thank you, Matthieu, for your suggestions. I spent some time revisiting the MPTCP logic.
Now I need to describe how sockmap/skmsg works to explain its conflict with MPTCP:
1. skmsg works by replacing sk_data_ready, recvmsg, sendmsg operations and implementing
fast socket-level forwarding logic
2. Users can obtain file descriptors through userspace socket()/accept() interfaces, then
call BPF syscall to perform these replacements.
3. Users can also use the bpf_sock_hash_update helper (in sockops programs) to replace
handlers when TCP connections enter ESTABLISHED state (BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB or BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB)
For MPTCP to work with sockmap, I believe we need to address the following points
(please correct me if I have any conceptual misunderstandings about MPTCP):
1. From client perspective: When a user connects to a server via socket(), the kernel
creates one master sk and at least two subflow sk's. Since the master sk doesn't participate
in the three-way handshake, in the sockops flow we can only access the subflow sk's.
In this case, we need to replace the handlers of mptcp_subflow_ctx(sk)->conn rather
than the subflow sk itself.
2. From server perspective: In BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB, the sk is the MP_CAPABLE
subflow sk, so similar to the client perspective, we need to replace the handlers of
mptcp_subflow_ctx(sk)->conn.
If the above description is correct, then my current patch is incorrect. I should focus on
handling the sockmap handler replacement flow properly instead.
Of course, this would require comprehensive selftests to validate.
Returning to the initial issue, the panic occurred on kernel 6.1, but when I tested with the
latest upstream test environment, it only triggered a WARN().
I suspect there have been significant changes in MPTCP during this period.
next prev parent reply other threads:[~2025-10-15 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 12:26 [PATCH net-next v1] mptcp: fix incorrect IPv4/IPv6 check Jiayuan Chen
2025-10-14 15:27 ` Matthieu Baerts
2025-10-15 14:16 ` Jiayuan Chen [this message]
2025-10-23 14:00 ` Matthieu Baerts
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=a0a2b87119a06c5ffaa51427a0964a05534fe6f1@linux.dev \
--to=jiayuan.chen@linux.dev \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).