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: <20240210235009.2405808-35-ukaszb@chromium.org>
Date: Sun, 11 Feb 2024 00:50:04 +0100
From: Łukasz Bartosik <ukaszb@...omium.org>
To: Jason Baron <jbaron@...mai.com>,
	Jim Cromie <jim.cromie@...il.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Kees Cook <keescook@...omium.org>,
	Douglas Anderson <dianders@...omium.org>
Cc: Guenter Roeck <groeck@...gle.com>,
	Yaniv Tzoreff <yanivt@...gle.com>,
	Benson Leung <bleung@...gle.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Vincent Whitchurch <vincent.whitchurch@...s.com>,
	Pekka Paalanen <ppaalanen@...il.com>,
	Sean Paul <seanpaul@...omium.org>,
	Daniel Vetter <daniel@...ll.ch>,
	Simon Ser <contact@...rsion.fr>,
	John Ogness <john.ogness@...utronix.de>,
	Petr Mladek <pmladek@...e.com>,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	linux-kernel@...r.kernel.org,
	upstream@...ihalf.com
Subject: [PATCH v4 34/39] dyndbg-test: add test which verifies flags and dst

Add test which verifies different combinations of flags
and trace destination.

Signed-off-by: Łukasz Bartosik <ukaszb@...omium.org>
---
 .../dynamic_debug/dyndbg_selftest.sh          | 98 +++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index f8b81e8a3bd6..4a0340d2c3e8 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -246,6 +246,103 @@ function test_percent_splitting {
     ifrmmod test_dynamic_debug
 }
 
+# test verifies different combinations of flags and trace destination
+function test_flags {
+    echo -e "${GREEN}# TEST_FLAGS ${NC}"
+
+    modprobe test_dynamic_debug dyndbg=+Tlm
+    check_match_ct =Tml 5 -v
+
+    ddcmd open selftest
+    check_trace_instance_dir selftest 1
+    is_trace_instance_opened selftest
+
+    # invalid combinations of flags and trace destination
+    ddcmd module test_dynamic_debug =Tm:0 fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =Tm:0. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =T:m.:0 fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =T:m.:0. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:0lT fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:0lT. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:0.lm:0 fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:0.lmT. fail
+    check_err_msg "Invalid argument"
+
+    ddcmd module test_dynamic_debug =Tm:selftest fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =Tm:selftest. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =T:m.:selftest fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =T:m.:selftest. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:selftestlT fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:selftestlT. fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:selftest.lm:0 fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =:selftest.lmT fail
+    check_err_msg "Invalid argument"
+
+    ddcmd module test_dynamic_debug =Tl.m fail
+    check_err_msg "Invalid argument"
+    ddcmd module test_dynamic_debug =T.lm fail
+    check_err_msg "Invalid argument"
+
+    # valid combinations of flags and trace destination
+    ddcmd module test_dynamic_debug =p
+    check_match_ct =p 5 -v
+    ddcmd module test_dynamic_debug =T
+    check_match_ct =T:selftest 5 -v
+    ddcmd module test_dynamic_debug =_
+    check_match_ct =:selftest 5 -v
+
+    ddcmd module test_dynamic_debug =T:0
+    check_match_ct =T 5 -v
+    ddcmd module test_dynamic_debug -_
+    check_match_ct =T 5 -v
+    ddcmd module test_dynamic_debug =T:0.mf
+    check_match_ct =Tmf 5 -v
+    ddcmd module test_dynamic_debug =T:selftest
+    check_match_ct =T:selftest 5 -v
+    ddcmd module test_dynamic_debug =T:selftest.mf
+    check_match_ct =T:selftest.mf 5 -v
+    ddcmd module test_dynamic_debug =_:selftest
+    check_match_ct =:selftest 5 -v
+
+    ddcmd module test_dynamic_debug =:0
+    ddcmd module test_dynamic_debug =:selftest
+    check_match_ct =:selftest 5 -v
+    ddcmd module test_dynamic_debug =p:selftest
+    check_match_ct =p:selftest 5 -v
+    ddcmd module test_dynamic_debug +_
+    check_match_ct =p:selftest 5 -v
+
+    ddcmd module test_dynamic_debug =T:selftest.mlf
+    ddcmd module test_dynamic_debug =:0
+    check_match_ct =Tmfl 5 -v
+    ddcmd module test_dynamic_debug =:selftest
+    check_match_ct =T:selftest.mfl 5 -v
+    ddcmd module test_dynamic_debug =:0
+    check_match_ct =Tmfl 5 -v
+    ddcmd module test_dynamic_debug =_:selftest
+    check_match_ct =:selftest 5 -v
+
+    ddcmd module test_dynamic_debug =:0.
+
+    ddcmd close selftest
+    is_trace_instance_closed selftest
+    ifrmmod test_dynamic_debug
+}
+
 function test_actual_trace {
     echo -e "${GREEN}# TEST_ACTUAL_TRACE ${NC}"
     ddcmd =_
@@ -692,6 +789,7 @@ tests_list=(
     basic_tests
     comma_terminator_tests
     test_percent_splitting
+    test_flags
     test_actual_trace
     cycle_tests_normal
     cycle_not_best_practices
-- 
2.43.0.687.g38aa6559b0-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ