netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures
@ 2025-04-07 18:26 Matthieu Baerts (NGI0)
  2025-04-07 18:26 ` [PATCH net 1/2] " Matthieu Baerts (NGI0)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-04-07 18:26 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
  Cc: netdev, linux-kernel, linux-kselftest, Matthieu Baerts (NGI0),
	stable

Recently, during a debugging session using local MPTCP connections, I
noticed MPJoinAckHMacFailure was strangely not zero on the server side.

The first patch fixes this issue -- present since v5.9 -- and the second
one validates it in the selftests.

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Matthieu Baerts (NGI0) (2):
      mptcp: only inc MPJoinAckHMacFailure for HMAC failures
      selftests: mptcp: validate MPJoin HMacFailure counters

 net/mptcp/subflow.c                             |  8 ++++++--
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
---
base-commit: 61f96e684edd28ca40555ec49ea1555df31ba619
change-id: 20250407-net-mptcp-hmac-failure-mib-66f599305ff3

Best regards,
-- 
Matthieu Baerts (NGI0) <matttbe@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures
  2025-04-07 18:26 [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures Matthieu Baerts (NGI0)
@ 2025-04-07 18:26 ` Matthieu Baerts (NGI0)
  2025-04-08 16:49   ` Simon Horman
  2025-04-07 18:26 ` [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters Matthieu Baerts (NGI0)
  2025-04-08 23:24 ` [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-04-07 18:26 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
  Cc: netdev, linux-kernel, linux-kselftest, Matthieu Baerts (NGI0),
	stable

Recently, during a debugging session using local MPTCP connections, I
noticed MPJoinAckHMacFailure was not zero on the server side. The
counter was in fact incremented when the PM rejected new subflows,
because the 'subflow' limit was reached.

The fix is easy, simply dissociating the two cases: only the HMAC
validation check should increase MPTCP_MIB_JOINACKMAC counter.

Fixes: 4cf8b7e48a09 ("subflow: introduce and use mptcp_can_accept_new_subflow()")
Cc: stable@vger.kernel.org
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/subflow.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 409bd415ef1d190d5599658d01323ad8c8a9be93..24c2de1891bdf31dfe04ef2077113563aad0e666 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -899,13 +899,17 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 				goto dispose_child;
 			}
 
-			if (!subflow_hmac_valid(req, &mp_opt) ||
-			    !mptcp_can_accept_new_subflow(subflow_req->msk)) {
+			if (!subflow_hmac_valid(req, &mp_opt)) {
 				SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
 				subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
 				goto dispose_child;
 			}
 
+			if (!mptcp_can_accept_new_subflow(owner)) {
+				subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
+				goto dispose_child;
+			}
+
 			/* move the msk reference ownership to the subflow */
 			subflow_req->msk = NULL;
 			ctx->conn = (struct sock *)owner;

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters
  2025-04-07 18:26 [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures Matthieu Baerts (NGI0)
  2025-04-07 18:26 ` [PATCH net 1/2] " Matthieu Baerts (NGI0)
@ 2025-04-07 18:26 ` Matthieu Baerts (NGI0)
  2025-04-08 16:50   ` Simon Horman
  2025-04-08 23:24 ` [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-04-07 18:26 UTC (permalink / raw)
  To: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
  Cc: netdev, linux-kernel, linux-kselftest, Matthieu Baerts (NGI0)

The parent commit fixes an issue around these counters where one of them
-- MPJoinAckHMacFailure -- was wrongly incremented in some cases.

This makes sure the counter is always 0. It should be incremented only
in case of corruption, or a wrong implementation, which should not be
the case in these selftests.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 tools/testing/selftests/net/mptcp/mptcp_join.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 13a3b68181ee14eb628a858e5738094c3c936b74..befa66f5a366bb738f8e6d6d84677f5c07488720 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1441,6 +1441,15 @@ chk_join_nr()
 		fi
 	fi
 
+	count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinSynAckHMacFailure")
+	if [ -z "$count" ]; then
+		rc=${KSFT_SKIP}
+	elif [ "$count" != "0" ]; then
+		rc=${KSFT_FAIL}
+		print_check "synack HMAC"
+		fail_test "got $count JOIN[s] synack HMAC failure expected 0"
+	fi
+
 	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckRx")
 	if [ -z "$count" ]; then
 		rc=${KSFT_SKIP}
@@ -1450,6 +1459,15 @@ chk_join_nr()
 		fail_test "got $count JOIN[s] ack rx expected $ack_nr"
 	fi
 
+	count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinAckHMacFailure")
+	if [ -z "$count" ]; then
+		rc=${KSFT_SKIP}
+	elif [ "$count" != "0" ]; then
+		rc=${KSFT_FAIL}
+		print_check "ack HMAC"
+		fail_test "got $count JOIN[s] ack HMAC failure expected 0"
+	fi
+
 	print_results "join Rx" ${rc}
 
 	join_syn_tx="${join_syn_tx:-${syn_nr}}" \

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 1/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures
  2025-04-07 18:26 ` [PATCH net 1/2] " Matthieu Baerts (NGI0)
@ 2025-04-08 16:49   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-04-08 16:49 UTC (permalink / raw)
  To: Matthieu Baerts (NGI0)
  Cc: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, netdev, linux-kernel,
	linux-kselftest, stable

On Mon, Apr 07, 2025 at 08:26:32PM +0200, Matthieu Baerts (NGI0) wrote:
> Recently, during a debugging session using local MPTCP connections, I
> noticed MPJoinAckHMacFailure was not zero on the server side. The
> counter was in fact incremented when the PM rejected new subflows,
> because the 'subflow' limit was reached.
> 
> The fix is easy, simply dissociating the two cases: only the HMAC
> validation check should increase MPTCP_MIB_JOINACKMAC counter.
> 
> Fixes: 4cf8b7e48a09 ("subflow: introduce and use mptcp_can_accept_new_subflow()")
> Cc: stable@vger.kernel.org
> Reviewed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters
  2025-04-07 18:26 ` [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters Matthieu Baerts (NGI0)
@ 2025-04-08 16:50   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-04-08 16:50 UTC (permalink / raw)
  To: Matthieu Baerts (NGI0)
  Cc: mptcp, Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Shuah Khan, netdev, linux-kernel,
	linux-kselftest

On Mon, Apr 07, 2025 at 08:26:33PM +0200, Matthieu Baerts (NGI0) wrote:
> The parent commit fixes an issue around these counters where one of them
> -- MPJoinAckHMacFailure -- was wrongly incremented in some cases.
> 
> This makes sure the counter is always 0. It should be incremented only
> in case of corruption, or a wrong implementation, which should not be
> the case in these selftests.
> 
> Reviewed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures
  2025-04-07 18:26 [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures Matthieu Baerts (NGI0)
  2025-04-07 18:26 ` [PATCH net 1/2] " Matthieu Baerts (NGI0)
  2025-04-07 18:26 ` [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters Matthieu Baerts (NGI0)
@ 2025-04-08 23:24 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-08 23:24 UTC (permalink / raw)
  To: Matthieu Baerts
  Cc: mptcp, martineau, geliang, davem, edumazet, kuba, pabeni, horms,
	shuah, netdev, linux-kernel, linux-kselftest, stable

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 07 Apr 2025 20:26:31 +0200 you wrote:
> Recently, during a debugging session using local MPTCP connections, I
> noticed MPJoinAckHMacFailure was strangely not zero on the server side.
> 
> The first patch fixes this issue -- present since v5.9 -- and the second
> one validates it in the selftests.
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> 
> [...]

Here is the summary with links:
  - [net,1/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures
    https://git.kernel.org/netdev/net/c/21c02e8272bc
  - [net,2/2] selftests: mptcp: validate MPJoin HMacFailure counters
    https://git.kernel.org/netdev/net/c/6767698cf9c1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-08 23:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 18:26 [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures Matthieu Baerts (NGI0)
2025-04-07 18:26 ` [PATCH net 1/2] " Matthieu Baerts (NGI0)
2025-04-08 16:49   ` Simon Horman
2025-04-07 18:26 ` [PATCH net 2/2] selftests: mptcp: validate MPJoin HMacFailure counters Matthieu Baerts (NGI0)
2025-04-08 16:50   ` Simon Horman
2025-04-08 23:24 ` [PATCH net 0/2] mptcp: only inc MPJoinAckHMacFailure for HMAC failures patchwork-bot+netdevbpf

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).