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:   Thu, 25 Jun 2020 09:13:17 +0800
From:   Nicolas Boichat <drinkcat@...omium.org>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     lkml <linux-kernel@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        Peter Zijlstra <peterz@...radead.org>,
        Vinod Koul <vkoul@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Tiezhu Yang <yangtiezhu@...ngson.cn>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Guilherme G . Piccoli" <gpiccoli@...onical.com>,
        Will Deacon <will@...nel.org>,
        Douglas Anderson <dianders@...omium.org>,
        Guenter Roeck <groeck@...omium.org>
Subject: Re: [PATCH] kernel/trace: Add TRACING_ALLOW_PRINTK config option

On Wed, Jun 24, 2020 at 9:57 PM Jason Gunthorpe <jgg@...pe.ca> wrote:
>
> On Wed, Jun 24, 2020 at 04:45:24PM +0800, Nicolas Boichat wrote:
> > trace_printk is only meant as a debugging tool, and should never be
> > compiled into production code without source code changes, as
> > indicated by the warning that shows up on boot if any trace_printk
> > is called:
> >  **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
> >  **                                                      **
> >  ** trace_printk() being used. Allocating extra memory.  **
> >  **                                                      **
> >  ** This means that this is a DEBUG kernel and it is     **
> >  ** unsafe for production use.                           **
> >
> > If this option is set to n, the kernel will generate a build-time
> > error if trace_printk is used.
> >
> > Signed-off-by: Nicolas Boichat <drinkcat@...omium.org>
> >  include/linux/kernel.h | 17 ++++++++++++++++-
> >  kernel/trace/Kconfig   |  9 +++++++++
> >  2 files changed, 25 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 196607aaf653082..b6addc6ba669e85 100644
> > +++ b/include/linux/kernel.h
> > @@ -721,10 +721,15 @@ do {                                                                    \
> >  #define trace_printk(fmt, ...)                               \
> >  do {                                                 \
> >       char _______STR[] = __stringify((__VA_ARGS__)); \
> > +                                                     \
> > +     __static_assert(                                \
> > +             IS_ENABLED(CONFIG_TRACING_ALLOW_PRINTK),\
> > +             "trace_printk called, please enable CONFIG_TRACING_ALLOW_PRINTK."); \
> > +                                                     \
>
> Why __static_assert not normal static_assert?

Oh, I misread the macro code (and didn't read the comment above in
include/linux/build_bug.h). static_assert would be just fine.

>
> Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ