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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 28 May 2020 08:33:37 +0900
From:   Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Dmitry Vyukov <dvyukov@...gle.com>,
        Ondrej Mosnacek <omosnace@...hat.com>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] twist: allow converting pr_devel()/pr_debug() into
 printk(KERN_DEBUG)

On 2020/05/28 0:55, Petr Mladek wrote:
>>> Well, it would be possible to call vsprintf() with NULL buffer. It is
>>> normally used to calculate the length of the message before it is
>>> printed. But it also does all the accesses without printing anything.
>>
>> OK. I think that redirecting pr_debug() to vsnprintf(NULL, 0) will be
>> better than modifying dynamic_debug path, for
> 
> It might get more complicated if you would actually want to see
> pr_debug() messages for a selected module in the fuzzer.

I don't expect that automated testing can afford selectively enabling
DYNAMIC_DEBUG_BRANCH(id) conditions. But we could evaluate all arguments
by calling snprintf(NULL, 0) if the condition to call printk() is false.

> vsprintf(NULL, ) can be called for pr_debug() messages in
> vprintk_store(). It will be again only a single place for
> all printk() wrappers.

I couldn't catch what you mean. The problem of pr_debug() is that
vprintk_store() might not be called because of

  #define no_printk(fmt, ...)                             \
  ({                                                      \
          if (0)                                          \
                  printk(fmt, ##__VA_ARGS__);             \
          0;                                              \
  })

  #define pr_debug(fmt, ...) \
          no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)

or

  #define __dynamic_func_call(id, fmt, func, ...) do {    \
          DEFINE_DYNAMIC_DEBUG_METADATA(id, fmt);         \
          if (DYNAMIC_DEBUG_BRANCH(id))                   \
                  func(&id, ##__VA_ARGS__);               \
  } while (0)

  #define _dynamic_func_call(fmt, func, ...)                              \
          __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)

  #define dynamic_pr_debug(fmt, ...)                              \
          _dynamic_func_call(fmt, __dynamic_pr_debug,             \
                             pr_fmt(fmt), ##__VA_ARGS__)

  #define pr_debug(fmt, ...) \
          dynamic_pr_debug(fmt, ##__VA_ARGS__)

. Maybe we can append

          else if (IS_BUILTIN(CONFIG_TWIST_ALWAYS_EVALUATE_DEBUG_PRINTK)) \
                  snprintf(NULL, 0, fmt, ##__VA_ARGS__);  \

to no_printk() and __dynamic_func_call().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ