* Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
2026-12-04 5:11 [PATCH net] mptcp: pm: preserve the port when removing ID 0 Kyuwon Cho
@ 2026-12-04 6:38 ` MPTCP CI
2026-12-04 11:05 ` Matthieu Baerts
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: MPTCP CI @ 2026-12-04 6:38 UTC (permalink / raw)
To: Kyuwon Cho; +Cc: mptcp
Hi Kyuwon,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Perf: Unstable: regression:sched-serverlim(2) validation:sched-loss ⚠️ (1 improvements, 69 new outliers to review)
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/47276039899
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/22ce2f2f24fa
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1231487
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
2026-12-04 5:11 [PATCH net] mptcp: pm: preserve the port when removing ID 0 Kyuwon Cho
2026-12-04 6:38 ` MPTCP CI
@ 2026-12-04 11:05 ` Matthieu Baerts
2026-12-05 1:47 ` Kyuwon Cho
2026-12-05 5:11 ` sashiko-bot
2026-12-05 5:48 ` netdev-bot+sashiko
3 siblings, 1 reply; 6+ messages in thread
From: Matthieu Baerts @ 2026-12-04 11:05 UTC (permalink / raw)
To: Kyuwon Cho
Cc: Mat Martineau, Geliang Tang, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Kalpan Jani, netdev, mptcp
Hi Kyuwon,
Thank you for sharing this patch.
On 04/12/2026 06:11, Kyuwon Cho wrote:
> The ID 0 removal path copies the MPTCP socket's local address, then clears
> its port before looking for a pending ADD_ADDR. An ID 0 ADD_ADDR that was
> announced with a port is stored with that port
I think the root cause of your issue is there: an ID 0 ADD_ADDR
shouldn't be announced with a port: the ID0 is a bit special: it is
linked to the initial subflow IP address and port. It should then use
the "default" port (set to 0 then), the one linked to the msk, so the
initial one.
> so removal misses the
> entry. A later announcement of the same address finds the stale entry and
> warns:
>
> WARNING: net/mptcp/pm.c:451 at mptcp_pm_announced_alloc
> RIP: 0010:mptcp_pm_announced_alloc (net/mptcp/pm.c:451)
> Call Trace:
> mptcp_pm_create_subflow_or_signal_addr (net/mptcp/pm_kernel.c:377)
> mptcp_pm_nl_add_addr_doit
> (net/mptcp/pm_kernel.c:983 net/mptcp/pm_kernel.c:1049)
> genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)
>
> Use the port supplied with the removal request. Portless removals continue
> to use zero, while port-specific entries can now be found and removed.
>
> Fixes: 2ac7d6e62076 ("mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0")
I started working on a fix when this patch was sent upstream. I was
doing that:
================================= 8< =================================
diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
index d3014bf57bf3..cd9df9f56d96 100644
--- a/net/mptcp/pm_kernel.c
+++ b/net/mptcp/pm_kernel.c
@@ -314,6 +314,7 @@ static void mptcp_mpc_endpoint_setup(struct mptcp_sock *msk)
pernet = pm_nl_get_pernet_from_msk(msk);
mptcp_local_address((struct sock_common *)msk->first, &mpc_addr);
+ mpc_addr.port = 0; /* entries for ID0 don't have a specific port */
rcu_read_lock();
entry = __lookup_addr(pernet, &mpc_addr);
if (entry) {
@@ -368,7 +369,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
/* Special case for ID0: set the correct ID */
endp_id = local.addr.id;
- if (endp_id == msk->mpc_endpoint_id)
+ if (endp_id == msk->mpc_endpoint_id && local.addr.port == 0)
local.addr.id = 0;
/* If the alloc fails, we are on memory pressure, not worth
@@ -409,7 +410,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
__clear_bit(local.addr.id, msk->pm.id_avail_bitmap);
/* Special case for ID0: set the correct ID */
- if (local.addr.id == msk->mpc_endpoint_id)
+ if (local.addr.id == msk->mpc_endpoint_id && !local.addr.port)
local.addr.id = 0;
else /* local_addr_used is not decr for ID 0 */
msk->pm.local_addr_used++;
@@ -975,6 +976,7 @@ static int mptcp_nl_add_subflow_or_signal_addr(struct net *net,
/* if the endp linked to the init sf is re-added with a != ID */
mptcp_local_address((struct sock_common *)msk, &mpc_addr);
+ mpc_addr.port = 0; /* entries for ID0 don't have a port */
lock_sock(sk);
spin_lock_bh(&msk->pm.lock);
================================= 8< =================================
Could that help for your case? (Note: not tested, it might break
selftests / packetdrill tests: you might want to validate the whole
test suite with: https://github.com/multipath-tcp/mptcp-upstream-virtme-docker)
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
2026-12-04 11:05 ` Matthieu Baerts
@ 2026-12-05 1:47 ` Kyuwon Cho
0 siblings, 0 replies; 6+ messages in thread
From: Kyuwon Cho @ 2026-12-05 1:47 UTC (permalink / raw)
To: Matthieu Baerts
Cc: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
Kalpan Jani, MPTCP CI, netdev, mptcp
On Fri, Dec 04, 2026 at 12:05:09PM +0100, Matthieu Baerts wrote:
> I think the root cause of your issue is there: an ID 0 ADD_ADDR
> shouldn't be announced with a port
>
> Could that help for your case?
Yes. Your changes address the root cause by keeping a nonzero-port endpoint
from being reclassified as ID 0 and by normalizing the MPC endpoint lookups.
My patch instead makes removal tolerate a port-specific ID 0 entry that
should not have been created.
I will rework v2 around your approach and run the full MPTCP selftest and
packetdrill suites in addition to the reproducer.
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
2026-12-04 5:11 [PATCH net] mptcp: pm: preserve the port when removing ID 0 Kyuwon Cho
2026-12-04 6:38 ` MPTCP CI
2026-12-04 11:05 ` Matthieu Baerts
@ 2026-12-05 5:11 ` sashiko-bot
2026-12-05 5:48 ` netdev-bot+sashiko
3 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-12-05 5:11 UTC (permalink / raw)
To: Kyuwon Cho; +Cc: mptcp
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: port mismatch in mptcp_nl_remove_id_zero_address()
anno_list lookup
--
commit ad23222f28ecec43f6d6673d450540a7b1eb5a74
Author: Kyuwon Cho <kyuwon.cho@skku.edu>
mptcp: pm: preserve the port when removing ID 0
This commit changes mptcp_nl_remove_id_zero_address() to copy addr->port
instead of clearing anno_addr.port before calling
mptcp_pm_announced_remove().
> diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
> index 47c6ccb0a29e4..ec49e9f2a730d 100644
> --- a/net/mptcp/pm_kernel.c
> +++ b/net/mptcp/pm_kernel.c
> @@ -1163,7 +1163,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,
> lock_sock(sk);
> /* Drop a possibly pending ADD_ADDR for this address. */
> anno_addr = msk_local;
> - anno_addr.port = 0;
> + anno_addr.port = addr->port;
> announced = mptcp_pm_announced_remove(msk, &anno_addr);
> spin_lock_bh(&msk->pm.lock);
> if (announced)
[Severity: Medium]
Can copying addr->port here still miss pending ID 0 entries in
msk->pm.anno_list when the removal request's port differs from the
announced endpoint's port?
mptcp_pm_announced_lookup() always compares ports strictly, while
mptcp_nl_remove_id_zero_address() matches msk for both addr->port == 0
and addr->port == msk_local.port.
If a portless signal endpoint was announced with port 0 and userspace
deletes ID 0 with msk_local.port, this introduces a regression where
mptcp_pm_announced_remove() misses the port-0 entry that it previously
removed.
Conversely, a portless deletion (addr->port == 0) still misses an ID 0
entry announced with msk_local.port. Both portless and port-specific
signal endpoints for the same IP can also coexist as ID 0 entries in
anno_list, so a single lookup can remove at most one of them.
When an entry is missed, msk->pm.add_addr_signaled is leaked, the stale
timer keeps retransmitting, and __mark_subflow_endp_available(msk, 0)
re-enables the endpoint so re-announcing it hits
WARN_ON_ONCE(mptcp_pm_is_kernel(msk)) in mptcp_pm_announced_alloc().
Removing pending anno_list entries by ID 0 (or checking both port 0 and
msk_local.port) would handle all three cases.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179633974213.577499.3953204420789445318@skku.edu?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] mptcp: pm: preserve the port when removing ID 0
2026-12-04 5:11 [PATCH net] mptcp: pm: preserve the port when removing ID 0 Kyuwon Cho
` (2 preceding siblings ...)
2026-12-05 5:11 ` sashiko-bot
@ 2026-12-05 5:48 ` netdev-bot+sashiko
3 siblings, 0 replies; 6+ messages in thread
From: netdev-bot+sashiko @ 2026-12-05 5:48 UTC (permalink / raw)
To: kyuwon.cho
Cc: matttbe, martineau, geliang, davem, edumazet, kuba, pabeni,
willemb, horms, kalpan.jani, netdev, mptcp
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch does not reliably fix the stale ID 0 ADD_ADDR entry
and its WARN, and it breaks a removal form that used to work.
--
mptcp: pm: preserve the port when removing ID 0
This patch changes mptcp_nl_remove_id_zero_address() so the pending
ADD_ADDR lookup key uses the port from the removal request. Before, the
port was always forced to zero. The goal is to find and drop ID 0
announcements that were made with a port, which avoids a WARN in
mptcp_pm_announced_alloc() when the address is announced again.
> diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
> index f7396628490e3..99bc851408a45 100644
> --- a/net/mptcp/pm_kernel.c
> +++ b/net/mptcp/pm_kernel.c
> @@ -1151,7 +1151,7 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,
> lock_sock(sk);
> /* Drop a possibly pending ADD_ADDR for this address. */
> anno_addr = msk_local;
> - anno_addr.port = 0;
> + anno_addr.port = addr->port;
> announced = mptcp_pm_announced_remove(msk, &anno_addr);
[Severity: High]
Doesn't this key still depend on how the removal request is written,
rather than on how the ID 0 entry was stored?
The ID 0 anno_list entry takes its port from the pernet endpoint behind
msk->mpc_endpoint_id. select_signal_address() copies entry->addr. Then
mptcp_pm_create_subflow_or_signal_addr() only rewrites the id to 0
before it calls mptcp_pm_announced_alloc().
mptcp_pm_announced_lookup() always compares ports:
if (mptcp_addresses_equal(&entry->addr, addr, true))
return entry;
The msk filter earlier in this function ignores the port when the
request has none:
if (!mptcp_addresses_equal(&msk_local, addr, addr->port))
goto next;
So the lookup only finds the entry if userspace repeats the endpoint's
exact port in the delete request.
Case 1: the ID 0 endpoint is "A port P signal". P has to equal
msk_local.port, as mptcp_nl_add_subflow_or_signal_addr() requires.
A portless "del id 0 A" passes the filter, builds the key {A, 0}, and
misses the {A, P} entry. The function still goes on to run:
mptcp_pm_remove_addr(msk, &list);
mptcp_pm_rm_subflow(msk, &list);
__mark_subflow_endp_available(msk, 0);
The entry stays on anno_list and add_addr_signaled is not decremented.
When the next signal endpoint is added, select_signal_address() can pick
A:P again, and mptcp_pm_announced_alloc() hits:
if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk)))
return false;
Isn't that the same splat quoted in the commit message? The commit
message says "Portless removals continue to use zero", but that looks
like the case that still fails.
Case 2: the ID 0 endpoint is a portless "A signal". It is matched to
the msk's local address A:Q by address only. After it is announced
again, the entry is stored as {A, 0}.
A "del id 0 A port Q" request passes the filter, because Q equals
msk_local.port. It now builds the key {A, Q}, which misses {A, 0}.
Before this patch the port was forced to 0 and the entry was found.
Commit 2ac7d6e62076 relied on that behaviour. Is this a regression for
that form of the request? The commit message doesn't mention the change.
There may also be a side effect when a separate, non-ID 0 endpoint A:Q
and a portless ID 0 endpoint A exist on the same msk. Could the
port-qualified request remove the anno entry of endpoint A:Q instead?
That would decrement add_addr_signaled without a matching RM_ADDR for
that id. It isn't clear whether this state can be reached.
The non-zero ID path, mptcp_nl_remove_subflow_and_signal_addr(), uses
the stored endpoint's address and port for its lookup. Would it be more
robust to do the same here? Some options:
- match the anno_list entry on entry->addr.id == 0
- use the port of the pernet endpoint for msk->mpc_endpoint_id
- match on the address only, with use_port=false
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179633974213.577499.3953204420789445318%40skku.edu
^ permalink raw reply [flat|nested] 6+ messages in thread