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: <20200924085445.GK6442@alley>
Date:   Thu, 24 Sep 2020 10:54:45 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc:     John Ogness <john.ogness@...utronix.de>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk 3/5] printk: use buffer pool for sprint buffers

On Thu 2020-09-24 15:17:46, Sergey Senozhatsky wrote:
> On (20/09/22 17:44), John Ogness wrote:
> > +/*
> > + * The sprint buffers are used with interrupts disabled, so each CPU
> > + * only requires 2 buffers: for non-NMI and NMI contexts. Recursive
> > + * printk() calls are handled by the safe buffers.
> > + */
> > +#define SPRINT_CTX_DEPTH 2
> > +
> > +/* Static sprint buffers for early boot (only 1 CPU). */
> > +static DECLARE_BITMAP(sprint_static_textbuf_map, SPRINT_CTX_DEPTH);
> > +static char sprint_static_textbuf[SPRINT_CTX_DEPTH * LOG_LINE_MAX];
> > +
> > +/* Dynamically allocated sprint buffers. */
> > +static unsigned int sprint_dynamic_textbuf_count;
> > +static unsigned long *sprint_dynamic_textbuf_map;
> > +static char *sprint_dynamic_textbuf;
> 
> Just a question:
> 
> Can dynamic_textbuf be a PER_CPU array of five textbuf[1024] buffers
> (for normal printk, nmi, hard irq, soft irq and one extra buffer for
> recursive printk calls)?

That would be my preferred fallback when the approach with
vsprintf(NULL, ) is not acceptable for some reasons.

But I still think that calling vsprintf(NULL, ) is the most trivial
and good enough solution.

IMHO, the solution with per-CPU buffers is not that trivial, for
example:

  What if recursive printk() is interrupted by NMI and it causes
  yet another recursion?

  Is one level of recursion enough?

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ