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]
Message-ID: <wlflavm4wt3focsl6w4ylu2p2itwz7jl3hbcnczuyi5mfew7nu@rd6wflle5gjt>
Date: Wed, 12 Nov 2025 12:15:26 +0100
From: Stefano Garzarella <sgarzare@...hat.com>
To: Bobby Eshleman <bobbyeshleman@...il.com>
Cc: Shuah Khan <shuah@...nel.org>, virtualization@...ts.linux.dev, 
	netdev@...r.kernel.org, linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Simon Horman <horms@...nel.org>, Bobby Eshleman <bobbyeshleman@...a.com>
Subject: Re: [PATCH net-next v4 02/12] selftests/vsock: make
 wait_for_listener() work even if pipefail is on

On Sat, Nov 08, 2025 at 08:00:53AM -0800, Bobby Eshleman wrote:
>From: Bobby Eshleman <bobbyeshleman@...a.com>
>
>Rewrite wait_for_listener()'s pattern matching to avoid tripping the
>if-condition when pipefail is on.
>
>awk doesn't gracefully handle SIGPIPE with a non-zero exit code, so grep
>exiting upon finding a match causes false-positives when the pipefail
>option is used (grep exits, SIGPIPE emits, and awk complains with a
>non-zero exit code). Instead, move all of the pattern matching into awk
>so that SIGPIPE cannot happen and the correct exit code is returned.
>
>Signed-off-by: Bobby Eshleman <bobbyeshleman@...a.com>
>---
>Changes in v2:
>- use awk-only tcp port lookup
>- remove fixes tag because this problem is only introduced when a later
>  patch enables pipefail for other reasons (not yet in tree)
>---
> tools/testing/selftests/vsock/vmtest.sh | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Stefano Garzarella <sgarzare@...hat.com>

>
>diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh
>index bc16b13cdbe3..01ce16523afb 100755
>--- a/tools/testing/selftests/vsock/vmtest.sh
>+++ b/tools/testing/selftests/vsock/vmtest.sh
>@@ -251,9 +251,11 @@ wait_for_listener()
>
> 	# for tcp protocol additionally check the socket state
> 	[ "${protocol}" = "tcp" ] && pattern="${pattern}0A"
>+
> 	for i in $(seq "${max_intervals}"); do
>-		if awk '{print $2" "$4}' /proc/net/"${protocol}"* | \
>-		   grep -q "${pattern}"; then
>+		if awk -v pattern="${pattern}" \
>+			'BEGIN {rc=1} $2" "$4 ~ pattern {rc=0} END {exit rc}' \
>+			/proc/net/"${protocol}"*; then
> 			break
> 		fi
> 		sleep "${interval}"
>
>-- 
>2.47.3
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ