MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH v2 mptcp-net 0/2] mptcp: fix another deadlock issue
@ 2024-02-21 15:32 Paolo Abeni
  2024-02-21 15:32 ` [PATCH v2 mptcp-net 1/2] mptcp: fix possible deadlock in subflow diag Paolo Abeni
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-21 15:32 UTC (permalink / raw)
  To: mptcp

Eric reported and diagnosed another possible deadlock problem with
the MPTCP diag code. The first patch address the issue, and the second
adds self-test coverage for the relevant codepath, to get lockdep help
to catch future similar issues.

following-up with the netdev fiasco, sending on mptcp only

v1 -> v2:
 - fix (avoid) feature detection in patch 2/2 (Matttbe)

Paolo Abeni (2):
  mptcp: fix possible deadlock in subflow diag
  selftests: mptcp: explicitly trigger the listener diag code-path

 net/mptcp/diag.c                          |  3 +++
 tools/testing/selftests/net/mptcp/diag.sh | 24 +++++++++++++++++++++++
 2 files changed, 27 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH v3 mptcp-net 2/2] selftests: mptcp: explicitly trigger the listener diag code-path
@ 2024-02-21 18:22 Paolo Abeni
  2024-02-21 19:14 ` selftests: mptcp: explicitly trigger the listener diag code-path: Tests Results MPTCP CI
  2024-02-22 10:22 ` MPTCP CI
  0 siblings, 2 replies; 8+ messages in thread
From: Paolo Abeni @ 2024-02-21 18:22 UTC (permalink / raw)
  To: mptcp

The mptcp diag interface already experienced a few locking bugs
that lockdep and appropriate coverage have detected in advance.

Let's add a test-case triggering the relevant code path, to prevent
similar issues in the future.

Be careful to cope with very slow environments.

Note that we don't need an explicit timeout on the mptcp_connect
subprocess to cope with eventual bug/hang-up as the final cleanup
terminating the child processes will take care of that.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
v2 -> v3:
 - longer wait timeout
 - run all subprocesses in  background
 - wait for tcp ports after starting all listeners
 all the above should produce a lot of resilience wrt slow env.
---
 tools/testing/selftests/net/mptcp/diag.sh | 30 ++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 60a7009ce1b5..3896bb84ebf1 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -20,7 +20,7 @@ flush_pids()
 
 	ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null
 
-	for _ in $(seq 10); do
+	for _ in $(seq $((timeout_poll * 10))); do
 		[ -z "$(ip netns pids "${ns}")" ] && break
 		sleep 0.1
 	done
@@ -81,6 +81,15 @@ chk_msk_nr()
 	__chk_msk_nr "grep -c token:" "$@"
 }
 
+chk_listener_nr()
+{
+	local expected=$1
+	local msg="$2"
+
+	__chk_nr "ss -inmlHMON $ns | wc -l" "$expected" "$msg - mptcp" 0
+	__chk_nr "ss -inmlHtON $ns | wc -l" "$expected" "$msg - subflows"
+}
+
 wait_msk_nr()
 {
 	local condition="grep -c token:"
@@ -279,5 +288,24 @@ flush_pids
 chk_msk_inuse 0 "many->0"
 chk_msk_cestab 0 "many->0"
 
+chk_listener_nr 0 "no listener sockets"
+NR_SERVERS=100
+for I in $(seq 1 $NR_SERVERS); do
+	ip netns exec $ns ./mptcp_connect -p $((I + 20001)) \
+		-t ${timeout_poll} -l 0.0.0.0 2>&1 >/dev/null &
+done
+
+for I in $(seq 1 $NR_SERVERS); do
+	mptcp_lib_wait_local_port_listen $ns $((I + 20001))
+done
+
+chk_listener_nr $NR_SERVERS "many listener sockets"
+
+# gracefull termination
+for I in $(seq 1 $NR_SERVERS); do
+	echo a | ip netns exec $ns ./mptcp_connect -p $((I + 20001)) 127.0.0.1 2>&1 >/dev/null &
+done
+flush_pids
+
 mptcp_lib_result_print_all_tap
 exit $ret
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH net 2/2] selftests: mptcp: explicitly trigger the listener diag code-path
@ 2024-02-21 11:46 Paolo Abeni
  2024-02-21 12:43 ` selftests: mptcp: explicitly trigger the listener diag code-path: Tests Results MPTCP CI
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Abeni @ 2024-02-21 11:46 UTC (permalink / raw)
  To: netdev
  Cc: Matthieu Baerts, Mat Martineau, Geliang Tang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Shuah Khan, mptcp, linux-kernel

The mptcp diag interface already experienced a few locking bugs
that lockdep and appropriate coverage have detected in advance.

Let's add a test-case triggering the relevant code path, to prevent
similar issues in the future.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 tools/testing/selftests/net/mptcp/diag.sh | 30 +++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh
index 60a7009ce1b5..3ab584b38566 100755
--- a/tools/testing/selftests/net/mptcp/diag.sh
+++ b/tools/testing/selftests/net/mptcp/diag.sh
@@ -81,6 +81,21 @@ chk_msk_nr()
 	__chk_msk_nr "grep -c token:" "$@"
 }
 
+chk_listener_nr()
+{
+	local expected=$1
+	local msg="$2"
+
+	if [ $expected -gt 0 ] && \
+	   ! mptcp_lib_kallsyms_has "mptcp_diag_dump_listeners"; then
+		printf "%-50s%s\n" "$msg - mptcp" "[ skip ]"
+		mptcp_lib_result_skip "many listener sockets"
+	else
+		__chk_nr "ss -inmlHMON $ns | wc -l" "$expected" "$msg - mptcp"
+	fi
+	__chk_nr "ss -inmlHtON $ns | wc -l" "$expected" "$msg - subflows"
+}
+
 wait_msk_nr()
 {
 	local condition="grep -c token:"
@@ -279,5 +294,20 @@ flush_pids
 chk_msk_inuse 0 "many->0"
 chk_msk_cestab 0 "many->0"
 
+chk_listener_nr 0 "no listener sockets"
+NR_SERVERS=100
+for I in $(seq 1 $NR_SERVERS); do
+	ip netns exec $ns ./mptcp_connect -p $((I + 20001)) -l 0.0.0.0 2>&1 >/dev/null &
+	mptcp_lib_wait_local_port_listen $ns $((I + 20001))
+done
+
+chk_listener_nr $NR_SERVERS "many listener sockets"
+
+# gracefull termination
+for I in $(seq 1 $NR_SERVERS); do
+	echo a | ip netns exec $ns ./mptcp_connect -p $((I + 20001)) 127.0.0.1 2>&1 >/dev/null
+done
+flush_pids
+
 mptcp_lib_result_print_all_tap
 exit $ret
-- 
2.43.0


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

end of thread, other threads:[~2024-02-22 10:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 15:32 [PATCH v2 mptcp-net 0/2] mptcp: fix another deadlock issue Paolo Abeni
2024-02-21 15:32 ` [PATCH v2 mptcp-net 1/2] mptcp: fix possible deadlock in subflow diag Paolo Abeni
2024-02-21 15:32 ` [PATCH v2 mptcp-net 2/2] selftests: mptcp: explicitly trigger the listener diag code-path Paolo Abeni
2024-02-21 16:22   ` selftests: mptcp: explicitly trigger the listener diag code-path: Tests Results MPTCP CI
2024-02-21 15:40 ` [PATCH v2 mptcp-net 0/2] mptcp: fix another deadlock issue Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2024-02-21 18:22 [PATCH v3 mptcp-net 2/2] selftests: mptcp: explicitly trigger the listener diag code-path Paolo Abeni
2024-02-21 19:14 ` selftests: mptcp: explicitly trigger the listener diag code-path: Tests Results MPTCP CI
2024-02-22 10:22 ` MPTCP CI
2024-02-21 11:46 [PATCH net 2/2] selftests: mptcp: explicitly trigger the listener diag code-path Paolo Abeni
2024-02-21 12:43 ` selftests: mptcp: explicitly trigger the listener diag code-path: Tests Results MPTCP CI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox