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>] [day] [month] [year] [list]
Message-ID: <20251025160905.3857885-168-sashal@kernel.org>
Date: Sat, 25 Oct 2025 11:56:39 -0400
From: Sasha Levin <sashal@...nel.org>
To: patches@...ts.linux.dev,
	stable@...r.kernel.org
Cc: Alessandro Zanni <alessandro.zanni87@...il.com>,
	Simon Horman <horms@...nel.org>,
	Jakub Kicinski <kuba@...nel.org>,
	Sasha Levin <sashal@...nel.org>,
	davem@...emloft.net,
	edumazet@...gle.com,
	pabeni@...hat.com,
	netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 6.17] selftest: net: Fix error message if empty variable

From: Alessandro Zanni <alessandro.zanni87@...il.com>

[ Upstream commit 81dcfdd21dbd7067068c7c341ee448c3f0d6f115 ]

Fix to avoid cases where the `res` shell variable is
empty in script comparisons.
The comparison has been modified into string comparison to
handle other possible values the variable could assume.

The issue can be reproduced with the command:
make kselftest TARGETS=net

It solves the error:
./tfo_passive.sh: line 98: [: -eq: unary operator expected

Signed-off-by: Alessandro Zanni <alessandro.zanni87@...il.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Link: https://patch.msgid.link/20250925132832.9828-1-alessandro.zanni87@gmail.com
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---

LLM Generated explanations, may be completely bogus:

YES
- `tools/testing/selftests/net/tfo_passive.sh:95-101` now quotes `res`
  and switches to a string comparison, eliminating the `[: -eq: unary
  operator expected` error that surfaces when the output file is empty
  during `make kselftest TARGETS=net`; without the fix the harness stops
  before it can report the real problem.
- The test still fails only when the passive TFO socket actually returns
  an invalid NAPI ID, because the server helper continues to emit the
  decimal string produced in `tools/testing/selftests/net/tfo.c:80-85`,
  so legitimate `"0"` results are caught exactly as before while other
  values (including blanks) no longer crash the script.
- This is a one-line, self-contained shell fix with no kernel-side
  impact and no new feature work; once commit `137e7b5cceda2` (which
  introduced the test) exists in a stable tree, backporting is trivial
  and restores the test’s usefulness.
- Risk of regression is essentially nil: the change follows standard
  shell best practices (quoting and string equality) and only affects
  the selftest infrastructure, improving reliability without touching
  runtime behaviour.

 tools/testing/selftests/net/tfo_passive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/tfo_passive.sh b/tools/testing/selftests/net/tfo_passive.sh
index 80bf11fdc0462..a4550511830a9 100755
--- a/tools/testing/selftests/net/tfo_passive.sh
+++ b/tools/testing/selftests/net/tfo_passive.sh
@@ -95,7 +95,7 @@ wait
 res=$(cat $out_file)
 rm $out_file
 
-if [ $res -eq 0 ]; then
+if [ "$res" = "0" ]; then
 	echo "got invalid NAPI ID from passive TFO socket"
 	cleanup_ns
 	exit 1
-- 
2.51.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ