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: <20240220192235.2953484-3-kuba@kernel.org>
Date: Tue, 20 Feb 2024 11:22:26 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
	edumazet@...gle.com,
	pabeni@...hat.com,
	shuah@...nel.org,
	linux-kselftest@...r.kernel.org,
	mic@...ikod.net,
	linux-security-module@...r.kernel.org,
	keescook@...omium.org,
	jakub@...udflare.com,
	Jakub Kicinski <kuba@...nel.org>,
	luto@...capital.net,
	wad@...omium.org
Subject: [PATCH net-next v3 02/11] selftests: kselftest_harness: use KSFT_* exit codes

Now that we no longer need low exit codes to communicate
assertion steps - use normal KSFT exit codes.

Acked-by: Kees Cook <keescook@...omium.org>
Tested-by: Jakub Sitnicki <jakub@...udflare.com>
Signed-off-by: Jakub Kicinski <kuba@...nel.org>
---
CC: keescook@...omium.org
CC: luto@...capital.net
CC: wad@...omium.org
CC: shuah@...nel.org
CC: mic@...ikod.net
CC: linux-kselftest@...r.kernel.org
CC: linux-security-module@...r.kernel.org
---
 tools/testing/selftests/kselftest_harness.h | 13 ++++++-------
 tools/testing/selftests/landlock/common.h   | 10 +++++-----
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index 98bdedf9a53a..618b41eac749 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -874,7 +874,7 @@ static inline void __test_check_assert(struct __test_metadata *t)
 {
 	if (t->aborted) {
 		if (t->no_print)
-			_exit(1);
+			_exit(KSFT_FAIL);
 		abort();
 	}
 }
@@ -937,7 +937,7 @@ void __wait_for_test(struct __test_metadata *t)
 		fprintf(TH_LOG_STREAM,
 			"# %s: Test terminated by timeout\n", t->name);
 	} else if (WIFEXITED(status)) {
-		if (WEXITSTATUS(status) == 255) {
+		if (WEXITSTATUS(status) == KSFT_SKIP) {
 			/* SKIP */
 			t->passed = 1;
 			t->skip = 1;
@@ -950,7 +950,7 @@ void __wait_for_test(struct __test_metadata *t)
 		} else {
 			switch (WEXITSTATUS(status)) {
 			/* Success */
-			case 0:
+			case KSFT_PASS:
 				t->passed = 1;
 				break;
 			/* Other failure, assume step report. */
@@ -1132,12 +1132,11 @@ void __run_test(struct __fixture_metadata *f,
 		setpgrp();
 		t->fn(t, variant);
 		if (t->skip)
-			_exit(255);
-		/* Pass is exit 0 */
+			_exit(KSFT_SKIP);
 		if (t->passed)
-			_exit(0);
+			_exit(KSFT_PASS);
 		/* Something else happened. */
-		_exit(1);
+		_exit(KSFT_FAIL);
 	} else {
 		__wait_for_test(t);
 	}
diff --git a/tools/testing/selftests/landlock/common.h b/tools/testing/selftests/landlock/common.h
index c15e22abdca6..f5b40399a538 100644
--- a/tools/testing/selftests/landlock/common.h
+++ b/tools/testing/selftests/landlock/common.h
@@ -47,10 +47,10 @@
 			_metadata->no_print = 1; \
 			fixture_name##_##test_name##_child(_metadata, self, variant); \
 			if (_metadata->skip) \
-				_exit(255); \
+				_exit(KSFT_SKIP); \
 			if (_metadata->passed) \
-				_exit(0); \
-			_exit(1); \
+				_exit(KSFT_PASS); \
+			_exit(KSFT_FAIL); \
 		} \
 		if (child != waitpid(child, &status, 0)) \
 			abort(); \
@@ -60,10 +60,10 @@
 			return; \
 		} \
 		switch (WEXITSTATUS(status)) { \
-		case 0: \
+		case KSFT_PASS: \
 			_metadata->passed = 1; \
 			break; \
-		case 255: \
+		case KSFT_SKIP: \
 			_metadata->passed = 1; \
 			_metadata->skip = 1; \
 			break; \
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ