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: <20220107052942.1349447-6-jim.cromie@gmail.com>
Date:   Thu,  6 Jan 2022 22:29:28 -0700
From:   Jim Cromie <jim.cromie@...il.com>
To:     jbaron@...mai.com, gregkh@...uxfoundation.org,
        linux@...musvillemoes.dk, rostedt@...dmis.org,
        mathieu.desnoyers@...icios.com, daniel.vetter@...ll.ch,
        seanpaul@...omium.org, robdclark@...il.com,
        dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
        intel-gvt-dev@...ts.freedesktop.org,
        intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc:     quic_saipraka@...cinc.com, will@...nel.org,
        catalin.marinas@....com, quic_psodagud@...cinc.com, maz@...nel.org,
        arnd@...db.de, linux-arm-kernel@...ts.infradead.org,
        linux-arm-msm@...r.kernel.org, mingo@...hat.com,
        jim.cromie@...il.com
Subject: [PATCH v11 05/19] dyndbg: add desc, dev fields to event record

commit:HEAD~1 added pr_debug(), dev_dbg() params to the new events,
but didn't actually capture the params.  Do that now; add the other
TP_* parts: __fields, fast-assign, and printk elements for the
desccriptor and device params.

The message capture part is copied from printk:console, it gets the
whole message, including dyndbg's prefixing: the dev_name() etc, the
optional module:function:line decorations, and the trailing newline
(which is trimmed).

dyndbg->trace-events must be enabled on both sides:

  in tracefs:	echo 1 > /sys/kernel/tracing/events/dyndbg/enable
  in dyndbg:	echo module drm +T > /proc/dynamic_debug/control

This is good; it gives 2 orthogonal cuts at trace traffic, dyndbg can
enable callsites indvidually, tracefs can (in principle) filter and
trigger on the incoming event stream.

ATM, TP_print adds "__entry->desc->{modname,function}", which is
redundant with +Tmf enabled callsites.

RFC

Perhaps the whole decorations/prefix should be excluded from the event
capture ?  Vincent's skip-past-KERN_DEBUG trick could be extended to
skip part or all of the prefix, and leave the "decorating" of events
solely to TP_printk.  Whats the right separation of concerns ?

NB: __entry->desc is a pointer into kernel .data, a pretty stable
reference, at least while the kernel is running.

Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
 include/trace/events/dyndbg.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/trace/events/dyndbg.h b/include/trace/events/dyndbg.h
index 82620b10e968..2ac296cb451c 100644
--- a/include/trace/events/dyndbg.h
+++ b/include/trace/events/dyndbg.h
@@ -14,10 +14,12 @@ TRACE_EVENT(prdbg,
 	TP_ARGS(desc, text, len),
 
 	TP_STRUCT__entry(
+		__field(const struct _ddebug *, desc)
 		__dynamic_array(char, msg, len + 1)
 	),
 
 	TP_fast_assign(
+		__entry->desc = desc;
 		/*
 		 * Each trace entry is printed in a new line.
 		 * If the msg finishes with '\n', cut it off
@@ -30,8 +32,8 @@ TRACE_EVENT(prdbg,
 		__get_str(msg)[len] = 0;
 	),
 
-	TP_printk("%s", __get_str(msg))
-
+	TP_printk("%s.%s %s", __entry->desc->modname,
+		  __entry->desc->function, __get_str(msg))
 );
 
 /* capture dev_dbg() callsite descriptor, device, and message */
@@ -42,10 +44,14 @@ TRACE_EVENT(devdbg,
 	TP_ARGS(desc, dev, text, len),
 
 	TP_STRUCT__entry(
+		__field(const struct _ddebug *, desc)
+		__field(const struct device *, dev)
 		__dynamic_array(char, msg, len + 1)
 	),
 
 	TP_fast_assign(
+		__entry->desc = desc;
+		__entry->dev = (struct device *) dev;
 		/*
 		 * Each trace entry is printed in a new line.
 		 * If the msg finishes with '\n', cut it off
@@ -58,7 +64,8 @@ TRACE_EVENT(devdbg,
 		__get_str(msg)[len] = 0;
 	),
 
-	TP_printk("%s", __get_str(msg))
+	TP_printk("%s.%s %s", __entry->desc->modname,
+		  __entry->desc->function, __get_str(msg))
 );
 
 #endif /* _TRACE_DYNDBG_H */
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ