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: <CAMuHMdVX+2tRjCabqVNR9HcnWE+EU0bR55KAW9bbD=GBEoE-=w@mail.gmail.com>
Date:   Tue, 25 Jun 2019 12:59:57 +0200
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "Tobin C . Harding" <me@...in.cc>, Joe Perches <joe@...ches.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Michal Hocko <mhocko@...e.cz>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 07/10] vsprintf: Consolidate handling of unknown
 pointer specifiers

Hi Petr,

On Wed, Apr 17, 2019 at 1:56 PM Petr Mladek <pmladek@...e.com> wrote:
> There are few printk formats that make sense only with two or more
> specifiers. Also some specifiers make sense only when a kernel feature
> is enabled.
>
> The handling of unknown specifiers is inconsistent and not helpful.
> Using WARN() looks like an overkill for this type of error. pr_warn()
> is not good either. It would by handled via printk_safe buffer and
> it might be hard to match it with the problematic string.
>
> A reasonable compromise seems to be writing the unknown format specifier
> into the original string with a question mark, for example (%pC?).
> It should be self-explaining enough. Note that it is in brackets
> to follow the (null) style.
>
> Note that it introduces a warning about that test_hashed() function
> is unused. It is going to be used again by a later patch.
>
> Signed-off-by: Petr Mladek <pmladek@...e.com>

> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1697,7 +1700,10 @@ static noinline_for_stack
>  char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
>             const char *fmt)
>  {
> -       if (!IS_ENABLED(CONFIG_HAVE_CLK) || !clk)
> +       if (!IS_ENABLED(CONFIG_HAVE_CLK))
> +               return string_nocheck(buf, end, "(%pC?)", spec);

This one is OK, as there is no clock support compiled in.

> +
> +       if (!clk)
>                 return string(buf, end, NULL, spec);
>
>         switch (fmt[1]) {
> @@ -1706,7 +1712,7 @@ char *clock(char *buf, char *end, struct clk *clk, struct printf_spec spec,
>  #ifdef CONFIG_COMMON_CLK
>                 return string(buf, end, __clk_get_name(clk), spec);
>  #else
> -               return ptr_to_id(buf, end, clk, spec);
> +               return string_nocheck(buf, end, "(%pC?)", spec);

What's the reason behind this change? This is not an error case,
but for printing the clock pointer as a distinguishable ID when using
the legacy clock framework, which does not store names with clocks.

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ