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-next>] [day] [month] [year] [list]
Message-ID: <20200825153338.17061-1-vincent.whitchurch@axis.com>
Date:   Tue, 25 Aug 2020 17:33:36 +0200
From:   Vincent Whitchurch <vincent.whitchurch@...s.com>
To:     <jbaron@...mai.com>, <rostedt@...dmis.org>, <mingo@...hat.com>
CC:     <kernel@...s.com>, <corbet@....net>, <pmladek@...e.com>,
        <sergey.senozhatsky@...il.com>, <john.ogness@...utronix.de>,
        <linux-kernel@...r.kernel.org>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>
Subject: [PATCH v3 0/2] Dynamic debug trace support

v3:
 - Split flag rename to a separate patch
 - Rename event to printk:dyndbg

v2:
 - Remove stack buffer and use code similar to __ftrace_trace_stack()
 - Use an event with the same class as printk:console

Vincent Whitchurch (2):
  dynamic debug: split enable and printk flags
  dynamic debug: allow printing to trace event

 .../admin-guide/dynamic-debug-howto.rst       |   1 +
 include/linux/dynamic_debug.h                 |  11 +-
 include/trace/events/printk.h                 |  12 +-
 lib/dynamic_debug.c                           | 161 ++++++++++++++----
 4 files changed, 151 insertions(+), 34 deletions(-)

Range-diff:
-:  ------------ > 1:  2564b3dbbb04 dynamic debug: split enable and printk flags
1:  7bd3fb553503 ! 2:  90291c35d751 dynamic debug: allow printing to trace event
    @@ Commit message
         debug do it.
     
         Add an "x" flag to make the dynamic debug call site print to a new
    -    printk:dynamic trace event.  The trace event can be emitted instead of
    -    or in addition to the printk().
    +    printk:dyndbg trace event.  The trace event can be emitted instead of or
    +    in addition to the printk().
     
         The print buffer is statically allocated and managed using code borrowed
         from __ftrace_trace_stack() and is limited to 256 bytes (four of these
    @@ Documentation/admin-guide/dynamic-debug-howto.rst: of the characters::
      The flags are::
      
        p    enables the pr_debug() callsite.
    -+  x    enables trace to the printk:dynamic event
    ++  x    enables trace to the printk:dyndbg event
        f    Include the function name in the printed message
        l    Include line number in the printed message
        m    Include module name in the printed message
     
      ## include/linux/dynamic_debug.h ##
     @@ include/linux/dynamic_debug.h: struct _ddebug {
    - 	 * writes commands to <debugfs>/dynamic_debug/control
    - 	 */
    - #define _DPRINTK_FLAGS_NONE	0
    --#define _DPRINTK_FLAGS_PRINT	(1<<0) /* printk() a message using the format */
    -+#define _DPRINTK_FLAGS_PRINTK	(1<<0) /* printk() a message using the format */
    - #define _DPRINTK_FLAGS_INCL_MODNAME	(1<<1)
      #define _DPRINTK_FLAGS_INCL_FUNCNAME	(1<<2)
      #define _DPRINTK_FLAGS_INCL_LINENO	(1<<3)
      #define _DPRINTK_FLAGS_INCL_TID		(1<<4)
    +-#define _DPRINTK_FLAGS_ENABLE		_DPRINTK_FLAGS_PRINTK
     +#define _DPRINTK_FLAGS_TRACE		(1<<5)
    -+#define _DPRINTK_FLAGS_PRINT		(_DPRINTK_FLAGS_PRINTK | \
    ++#define _DPRINTK_FLAGS_ENABLE		(_DPRINTK_FLAGS_PRINTK | \
     +					 _DPRINTK_FLAGS_TRACE)
      #if defined DEBUG
    --#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
    -+#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK
    + #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINTK
      #else
    - #define _DPRINTK_FLAGS_DEFAULT 0
    - #endif
     
      ## include/trace/events/printk.h ##
     @@
    @@ include/trace/events/printk.h: TRACE_EVENT(console,
     +	TP_ARGS(text, len)
     +);
     +
    -+DEFINE_EVENT(printk, dynamic,
    ++DEFINE_EVENT(printk, dyndbg,
     +	TP_PROTO(const char *text, size_t len),
     +	TP_ARGS(text, len)
     +);
    @@ lib/dynamic_debug.c
      
      #include <rdma/ib_verbs.h>
      
    -@@ lib/dynamic_debug.c: static inline const char *trim_prefix(const char *path)
    - }
    - 
    - static struct { unsigned flag:8; char opt_char; } opt_array[] = {
    --	{ _DPRINTK_FLAGS_PRINT, 'p' },
    -+	{ _DPRINTK_FLAGS_PRINTK, 'p' },
    - 	{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
    +@@ lib/dynamic_debug.c: static struct { unsigned flag:8; char opt_char; } opt_array[] = {
      	{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
      	{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
      	{ _DPRINTK_FLAGS_INCL_TID, 't' },
    @@ lib/dynamic_debug.c: static char *dynamic_emit_prefix(const struct _ddebug *desc
     +	buf = this_cpu_ptr(dynamic_trace_bufs.bufs) + bufidx;
     +
     +	len = vscnprintf(buf->buf, sizeof(buf->buf), fmt, args);
    -+	trace_dynamic(buf->buf, len);
    ++	trace_dyndbg(buf->buf, len);
     +
     +out:
     +	/* As above. */
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ