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: <8e3e44492c986f691a778322e3eaf483e1734e90.1687344643.git.falcon@tinylab.org>
Date:   Wed, 21 Jun 2023 20:57:41 +0800
From:   Zhangjin Wu <falcon@...ylab.org>
To:     w@....eu
Cc:     thomas@...ch.de, arnd@...db.de, falcon@...ylab.org,
        linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: [PATCH v1 04/17] selftests/nolibc: fix up kernel parameters support

kernel parameters allow pass two types of strings, one type is like
'noapic', another type is like 'panic=5', the first type is passed as
arguments of the init program, the second type is passed as environment
variables of the init program.

when users pass kernel parameters like this:

    noapic NOLIBC_TEST=syscall

our nolibc-test program will ignore the NOLIBC_TEST environment
variable.

Let's verify the first type (from arguments), if it is invalid, get the
test setting from NOLIBC_TEST environment variable instead.

Signed-off-by: Zhangjin Wu <falcon@...ylab.org>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index d43116553288..ebec948ec808 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -951,6 +951,7 @@ int main(int argc, char **argv, char **envp)
 	int ret = 0;
 	int err;
 	int idx;
+	int len, valid = 0;
 	char *test;
 
 	environ = envp;
@@ -969,7 +970,19 @@ int main(int argc, char **argv, char **envp)
 	 *    syscall:5-15[:.*],stdlib:8-10
 	 */
 	test = argv[1];
-	if (!test)
+
+	/* verify the test setting from argv[1] */
+	if (test) {
+		for (idx = 0; test_names[idx].name; idx++) {
+			len = strlen(test_names[idx].name);
+			if (strncmp(test, test_names[idx].name, len) == 0) {
+				valid = 1;
+				break;
+			}
+		}
+	}
+
+	if (!valid)
 		test = getenv("NOLIBC_TEST");
 
 	if (test) {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ