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, 1 Dec 2016 10:08:48 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jan Kara <jack@...e.cz>, Tejun Heo <tj@...nel.org>,
        Calvin Owens <calvinowens@...com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Laura Abbott <labbott@...hat.com>,
        Andy Lutomirski <luto@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        linux-kernel@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Subject: Re: [RFC][PATCHv4 3/6] printk: introduce per-cpu safe_print seq
 buffer

On (11/24/16 17:58), Petr Mladek wrote:
[..]
> > +#ifdef CONFIG_PRINTK
> > +
> > +#define PRINTK_SAFE_CONTEXT_MASK	0x7fffffff
> > +#define PRINTK_SAFE_NMI_CONTEXT_MASK	0x80000000
> 
> What about shorter name PRINTK_NMI_CONTEXT_MASK?

ok.

> > diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c
> > index 1f66163..af74d9c 100644
> > --- a/kernel/printk/printk_safe.c
> > +++ b/kernel/printk/printk_safe.c
> > @@ -50,27 +49,26 @@ struct printk_safe_seq_buf {
> >  	struct irq_work		work;	/* IRQ work that flushes the buffer */
> >  	unsigned char		buffer[SAFE_LOG_BUF_LEN];
> >  };
> > +
> > +static DEFINE_PER_CPU(struct printk_safe_seq_buf, safe_print_seq);
> > +static DEFINE_PER_CPU(int, printk_safe_context);
> 
> I would personally use the short name "printk_context". It is a generic
> value. Zero value means that it is a normal context. Also there is
> an idea to add KDB context that would use its own vprintk_kdb()
> implementation and will not use the printk_safe buffer.

ok.

> > -	if (len >= sizeof(s->buffer)) {
> > -		atomic_inc(&nmi_message_lost);
> > -		return 0;
> > -	}
> > +	if (len >= sizeof(s->buffer))
> > +		return -E2BIG;
> 
> E2BIG means "argument list too long" and does not fit much here.
> I would suggest to use -ENOSPC. It is not ideal either but it fits
> slightly better.

ok.

> > +/*
> > + * Lockless printk(), to avoid deadlocks should the printk() recurse
> > + * into itself. It uses a per-CPU buffer to store the message, just like
> > + * NMI.
> > + */
> > +static int vprintk_safe(const char *fmt, va_list args)
> > +{
> > +	struct printk_safe_seq_buf *s = this_cpu_ptr(&safe_print_seq);
> > +
> > +	return printk_safe_log_store(s, fmt, args);
> 
> We should return zero if printk_safe_log_store() returns an error.
> I know that it will get fixed in the next patch. But we should do
> some minimum sanity check here because of bisection.

ok.

	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ