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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  6 Oct 2021 14:47:21 +0300
From:   Leonard Crestez <cdleonard@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>, Shuah Khan <shuah@...nel.org>,
        David Ahern <dsahern@...nel.org>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Ido Schimmel <idosch@...dia.com>,
        Seth David Schoen <schoen@...alty.org>,
        netdev@...r.kernel.org, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 05/11] selftests: net/fcnal: kill_procs via spin instead of sleep

Sleeping for one second after a kill is not necessary and adds up quite
quickly. Replace with a fast loop spinning until pidof returns nothing.

Signed-off-by: Leonard Crestez <cdleonard@...il.com>
---
 tools/testing/selftests/net/fcnal-test.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/fcnal-test.sh b/tools/testing/selftests/net/fcnal-test.sh
index 0bd60cd3bc06..b7fda51deb3f 100755
--- a/tools/testing/selftests/net/fcnal-test.sh
+++ b/tools/testing/selftests/net/fcnal-test.sh
@@ -176,12 +176,19 @@ show_hint()
 	fi
 }
 
 kill_procs()
 {
-	killall nettest ping ping6 >/dev/null 2>&1
-	sleep 1
+	local pids
+	while true; do
+		pids=$(pidof nettest ping ping6)
+		if [[ -z $pids ]]; then
+			break
+		fi
+		kill $pids
+		sleep 0.01
+	done
 }
 
 do_run_cmd()
 {
 	local cmd="$*"
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ