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]
Date:   Sat, 9 Dec 2023 01:32:02 +0100
From:   Łukasz Bartosik <lb@...ihalf.com>
To:     Jim Cromie <jim.cromie@...il.com>
Cc:     linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
        bleung@...gle.com, contact@...rsion.fr, daniel@...ll.ch,
        dianders@...omium.org, groeck@...gle.com, jbaron@...mai.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: [re: PATCH v2 00/15 - 08/11] dyndbg: split multi-query strings
 with %

pt., 8 gru 2023 o 01:15 Jim Cromie <jim.cromie@...il.com> napisał(a):
>
> 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.
>

What if we use a different character for passing trace instance name
to the T flag, for example "-", +T-trace_buf
and then use ":" instead of "%" as a separator ?



> 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