On Wed, Sep 23, 2026 at 4:47 PM <[email protected]> wrote:
>
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
> to consider:
> - [Medium] dyndbg: UAPI break for boot parameters containing unquoted @
> --
>
> commit a948e5ac96c252adcbc1059b7607e6fa7aab2b9d
> Author: Jim Cromie <[email protected]>
>
> dyndbg: split multi-query strings with @
>
> This commit adds '@' to the existing ';' and '\n' separators for dynamic debug
> queries. This provides a more shell-friendly delimiter, reducing the need for
> quoting and escaping.
>
> > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> > index 6482fd28def46..636a88994a774 100644
> > --- a/lib/dynamic_debug.c
> > +++ b/lib/dynamic_debug.c
>
> [ ... ]
>
> > @@ -622,6 +622,30 @@ static int ddebug_exec_query(char *query_string, const 
> > char *modname)
> >       return nfound;
> >  }
> >
> > +/*
> > + * Split multi-query string on delimiters (@, ;, \n), ignoring delimiters
> > + * that appear inside single or double quoted strings.
> > + */
> > +static char *ddebug_find_delimiter(char *str, const char *delims)
> > +{
> > +     bool in_quote = false;
> > +     char quote_char = 0;
> > +
> > +     for (; *str; str++) {
> > +             if (*str == '"' || *str == '\'') {
> > +                     if (!in_quote) {
> > +                             in_quote = true;
> > +                             quote_char = *str;
> > +                     } else if (*str == quote_char) {
> > +                             in_quote = false;
> > +                     }
> > +             } else if (!in_quote && strchr(delims, *str)) {
>
> [Severity: Medium]
> Does this cause a regression for boot parameters with an unquoted '@' symbol?
>
> When a user provides a kernel parameter like dyndbg="format i2c@1000 +p",
> parse_args() strips the outer double-quotes before passing the unquoted
> string down.
>
> Once ddebug_exec_queries() passes the string to ddebug_find_delimiter(), it
> will prematurely split the string at the '@' because in_quote is false,
> producing invalid queries like 'format i2c' and '1000 +p', both of which
> fail to parse.
>
> Could this break existing boot parameters or modprobe configurations that
> rely on the '@' symbol in format strings (e.g., matching device tree nodes)?
>

0. next_arg() in kernel/params.c strips only the outermost pair of
   quotes enclosing the parameter value. It leaves inner single quotes
   or escaped quotes completely intact.

1. ddebug_find_delimiter() was written specifically to track both single
   and double quotes (' and "). A boot argument containing '@' in a
   format string protects it by passing inner single quotes:
     dyndbg="format 'i2c@1000' +p"

2. Previously, dynamic debug split multi-queries on ";\n" using
   strpbrk(), which had zero quote awareness and split on ';' even when
   enclosed in quotes. ddebug_find_delimiter() is strictly more robust
   than the baseline parser by preserving quoted delimiters while giving
   users an unescaped '@' alternative to shell-sensitive ';'.



> > +                     return str;
> > +             }
> > +     }
> > +     return NULL;
> > +}
>
> --
> Sashiko AI review · 
> https://sashiko.dev/#/patchset/[email protected]?part=31

Reply via email to