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-37-ukaszb@chromium.org>
Date: Sun, 11 Feb 2024 00:50:06 +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 36/39] dyndbg-test: add test for label keyword

From: Jim Cromie <jim.cromie@...il.com>

Test the use of the label keyword by selecting, labelling, and
re-labelling a handful of prdbgs:

4 in module/params.c -> param_log
  these are labelled and enabled prior to modprobe test_dynamic_debug
  trace output to the instance is verified

4 in test-dynamic-debug -> param_log also
  2 class'd, 2 un-class'd

After modprobe, all param_log labels are relabelled to new_out, then
doprints reruns the prdbgs, generating new trace output to the new_out
instance.

Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
 .../dynamic_debug/dyndbg_selftest.sh          | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
index ae386e4de6a4..c6d428a58889 100755
--- a/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
+++ b/tools/testing/selftests/dynamic_debug/dyndbg_selftest.sh
@@ -859,6 +859,69 @@ function setup_env_for_tests {
     echo
 }
 
+function test_labelling {
+    echo -e "${GREEN}# TEST_SITE_LABELLING - ${NC}"
+    ifrmmod test_dynamic_debug
+    ddcmd =_
+
+    # trace params processing of the modprobe
+    ddcmd open,param_log%module,params,+T:param_log.tmfs
+    check_match_ct =T:param_log 4 -r -v
+
+    # modprobe with params.  This uses the default_dest :param_log
+    modprobe test_dynamic_debug \
+	     dyndbg=class,D2_CORE,+Tmf%class,D2_KMS,+Tmf%class,D2_ATOMIC,+pmT
+
+    # check the trace for params processing during modprobe, with the expected prefixes
+    search_trace_name param_log 5 "params:parse_args:kernel/params.c: doing test_dynamic_debug"
+    search_trace_name param_log 4 "params:parse_one:kernel/params.c: doing test_dynamic_debug"
+
+    # and for the enabled test-module's pr-debugs
+    search_trace_name param_log 3 "test_dynamic_debug:do_cats: test_dd: D2_CORE msg"
+    search_trace_name param_log 2 "test_dynamic_debug:do_cats: test_dd: D2_KMS msg"
+    search_trace_name param_log 1 "test_dynamic_debug: test_dd: D2_ATOMIC msg"
+
+    # now change the labelled sites, by using the existing label
+    ddcmd open new_out
+    ddcmd label param_log +T:new_out	# redirect unclassed
+    check_match_ct =T:new_out 4	-r	# the module params prdbgs got moved
+    check_match_ct =T:param_log 2 -r	# CORE, KMS remain
+    ddcmd label param_log class D2_CORE +T:new_out	# must name class to change it
+    ddcmd label param_log class D2_KMS  +T:new_out	# case for class D2_* (wildcard) ??
+    check_match_ct =T:param_log 0
+    check_match_ct =T:new_out 6	-r	# all are redirected
+    check_match_ct =T:new_out.mfst 4	# module/params.c prdbgs still have the flags
+
+    doprints
+    search_trace_name new_out 2 "test_dynamic_debug:do_cats: test_dd: D2_CORE msg"
+    search_trace_name new_out 1 "test_dynamic_debug:do_cats: test_dd: D2_KMS msg"
+
+    check_match_ct =T.new_out 6 -r -v
+    check_match_ct =T: 6 -r -v
+
+    # its not enough to turn off T
+    ddcmd -T
+    ddcmd class D2_CORE -T % class D2_KMS -T
+    check_match_ct =T 0
+    check_match_ct =:new_out 6 -r -v
+
+    # must un-label prdbgs to close the label
+    ddcmd label new_out +:0
+    ddcmd label new_out class D2_CORE +:0
+    ddcmd label new_out class D2_KMS +:0
+    ddcmd close new_out
+
+    check_match_ct =T:param_log 0	# ok, but
+    check_match_ct :param_log 1 -r -v	# pick up the D2_ATOMIC
+    ddcmd label param_log class D2_ATOMIC +:0
+    ddcmd close param_log		# now it closes wo -EBUSY
+
+    ifrmmod test_dynamic_debug
+
+    del_trace_instance_dir param_log 1
+    del_trace_instance_dir new_out 1
+}
+
 tests_list=(
     basic_tests
     comma_terminator_tests
@@ -878,6 +941,8 @@ tests_list=(
 
     test_private_trace_overlong_name
 
+    test_labelling
+
     # works, takes 30 sec
     test_private_trace_fill_trace_index
 )
-- 
2.43.0.687.g38aa6559b0-goog


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ