lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <53a7e56424756ef35434bc15a90b256bcf724651.1707407012.git.pabeni@redhat.com>
Date: Thu,  8 Feb 2024 16:45:34 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Shuah Khan <shuah@...nel.org>,
	Willem de Bruijn <willemb@...gle.com>,
	Vinicius Costa Gomes <vinicius.gomes@...el.com>,
	linux-kselftest@...r.kernel.org
Subject: [PATCH net] selftests: net: wait for receiver startup in so_txtime.sh

The mentioned test is failing in slow environments:

  # SO_TXTIME ipv4 clock monotonic
  # ./so_txtime: recv: timeout: Resource temporarily unavailable
  not ok 1 selftests: net: so_txtime.sh # exit=1

The receiver is started in background and the sender could end-up
transmitting the packet before the receiver is ready, so that the
later recv times out.

Address the issue explcitly waiting for the socket being bound to
the relevant port.

Fixes: af5136f95045 ("selftests/net: SO_TXTIME with ETF and FQ")
Signed-off-by: Paolo Abeni <pabeni@...hat.com>
---
Note that to really cope with slow env the mentioned self-tests also
need net-next commit c41dfb0dfbec ("selftests/net: ignore timing
errors in so_txtime if KSFT_MACHINE_SLOW"), so this could be applied to
net-next, too
---
 tools/testing/selftests/net/so_txtime.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/net/so_txtime.sh b/tools/testing/selftests/net/so_txtime.sh
index 3f06f4d286a9..ade0e5755099 100755
--- a/tools/testing/selftests/net/so_txtime.sh
+++ b/tools/testing/selftests/net/so_txtime.sh
@@ -5,6 +5,8 @@
 
 set -e
 
+source net_helper.sh
+
 readonly DEV="veth0"
 readonly BIN="./so_txtime"
 
@@ -51,13 +53,16 @@ do_test() {
 	local readonly CLOCK="$2"
 	local readonly TXARGS="$3"
 	local readonly RXARGS="$4"
+	local PROTO
 
 	if [[ "${IP}" == "4" ]]; then
 		local readonly SADDR="${SADDR4}"
 		local readonly DADDR="${DADDR4}"
+		PROTO=udp
 	elif [[ "${IP}" == "6" ]]; then
 		local readonly SADDR="${SADDR6}"
 		local readonly DADDR="${DADDR6}"
+		PROTO=udp6
 	else
 		echo "Invalid IP version ${IP}"
 		exit 1
@@ -65,6 +70,7 @@ do_test() {
 
 	local readonly START="$(date +%s%N --date="+ 0.1 seconds")"
 	ip netns exec "${NS2}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${RXARGS}" -r &
+	wait_local_port_listen "${NS2}" 8000 "${PROTO}"
 	ip netns exec "${NS1}" "${BIN}" -"${IP}" -c "${CLOCK}" -t "${START}" -S "${SADDR}" -D "${DADDR}" "${TXARGS}"
 	wait "$!"
 }
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ