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: <5351f56289add68eee2aa5288f82a313c2b9f664.1701993656.git.jim.cromie@gmail.com>
Date:   Thu,  7 Dec 2023 17:15:11 -0700
From:   Jim Cromie <jim.cromie@...il.com>
To:     lb@...ihalf.com, linux-kernel@...r.kernel.org
Cc:     akpm@...ux-foundation.org, bleung@...gle.com, contact@...rsion.fr,
        daniel@...ll.ch, dianders@...omium.org, groeck@...gle.com,
        jbaron@...mai.com, jim.cromie@...il.com, john.ogness@...utronix.de,
        keescook@...omium.org, pmladek@...e.com, ppaalanen@...il.com,
        rostedt@...dmis.org, seanpaul@...omium.org,
        sergey.senozhatsky@...il.com, upstream@...ihalf.com,
        vincent.whitchurch@...s.com, yanivt@...gle.com,
        gregkh@...uxfoundation.org
Subject: [re: PATCH v2 00/15 -  08/11] dyndbg: split multi-query strings with %

Multi-query strings have long allowed:

  modprobe drm dyndbg="class DRM_UT_CORE +p; class DRM_UT_KMS +p"
  modprobe drm dyndbg=<<EOX
     class DRM_UT_CORE +pmf
     class DRM_UT_KMS  +pmf
  EOX

More recently, the need for quoting was avoided by treating a comma
like a space/token-terminator:

  modprobe drm dyndbg=class,DRM_UT_CORE,+p\;class,DRM_UT_KMS,+p

But that leaves unfinished business; that semi-colon needs escaping,
and thats not robust to further string interpolation.  In particular,
it fails when passed to vng (virtme-ng).

So this patch adds '%' to the existing ';' and '\n' multi-cmd
separators, which is more shell-friendly, and avoids quoting and
escaping hassles.

  modprobe drm dyndbg=class,DRM_UT_CORE,+p%class,DRM_UT_KMS,+p

NOTE: it does alter/break this (ill conceived) search:

[root@v6 lx]# ddcmd format %s +p
[   38.170998] dyndbg: read 13 bytes from userspace
[   38.171542] dyndbg: query 0: <format > on module: <*>
[   38.172011] dyndbg: bad flag-op f, at start of format
[   38.172487] dyndbg: flags parse failed
[   38.172839] dyndbg: query 1: <s +p> on module: <*>
[   38.173285] dyndbg: expecting pairs of match-spec <value>
[   38.173791] dyndbg: query parse failed
[   38.174141] dyndbg: processed 2 queries, with 0 matches, 2 errs
bash: echo: write error: Invalid argument

In trade for that minor format selection limitation, we get to do:

  vng -v --user root -p 4 \
      -a dynamic_debug.verbose=3 \
      -a drm.debug=0x15 \
      -a i915.dyndbg=class,DRM_UT_CORE,+pfmlt_%class,DRM_UT_KMS,+pfml
  modprobe drm
  modprobe i915

NOTES/TLDR:

In this example, using both drm.debug & drm.dyndbg is mostly for
testing.  Using drm.debug is preferred, because the drivers all
explicitly depend on that input/control-point, so settings there are
propagated to drivers.

But more to the point, drm.dyndbg explicitly limits the query to drm.
In fact, you could pass a module wildcard in the above, and achieve
the same thing:

  vng -v --user root -p 4 \
      -a dynamic_debug.verbose=3 \
      -a \*.dyndbg=class,DRM_UT_CORE,+pfmlt_%class,DRM_UT_KMS,+pfm%class,DRM_UT_ATOMIC,+pf

':' would be a more natural multi-cmd separator, but is reserved
for +T:<trace_buf> to designate separate tracebuf instances.

If '%' is distasteful, the backup plan is ",_,", since that would
never appear in a useful <format "$foo"> cmd.

Signed-off-by: Jim Cromie <jim.cromie@...il.com>
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index c974f6e19ca1..0ca3ba9e2032 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -963,7 +963,7 @@ static int ddebug_exec_queries(char *query, const char *modname)
 	int i, errs = 0, exitcode = 0, rc, nfound = 0;
 
 	for (i = 0; query; query = split) {
-		split = strpbrk(query, ";\n");
+		split = strpbrk(query, "%;\n");
 		if (split)
 			*split++ = '\0';
 
-- 
2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ