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:   Fri, 8 Sep 2017 12:18:01 +0200
From:   Pavel Machek <pavel@....cz>
To:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:     Joe Perches <joe@...ches.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Petr Mladek <pmladek@...e.com>, Jan Kara <jack@...e.cz>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jiri Slaby <jslaby@...e.com>, Andreas Mohr <andi@...as.de>,
        Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: printk: what is going on with additional newlines?

On Wed 2017-08-30 14:37:34, Sergey Senozhatsky wrote:
> On (08/29/17 19:58), Joe Perches wrote:
> > > > 
> > > > Why?
> > > > 
> > > > What's wrong with a simple printk?
> > > > It'd still do a log_store.
> > > 
> > > sure, it will. but in separate logbuf entries, and between two
> > > consequent printk calls on the same CPU a lot of stuff can happen:
> > 
> > I think you don't quite understand how this would work.
> > The idea is that the entire concatenated bit would be emitted
> > in one go.
> 
> may be :)
> 
> I was thinking about the way to make it work in similar way with
> printk-safe/printk-nmi. basically seq buffer should hold both
> continuation and "normal" lines, IMHO. when we emit the buffer
> we do something like this
> 
> 	/* Print line by line. */
> 	while (c < end) {
> 		if (*c == '\n') {
> 			printk_safe_flush_line(start, c - start + 1);
> 			start = ++c;
> 			header = true;
> 			continue;
> 		}
> 
> 		/* Handle continuous lines or missing new line. */
> 		if ((c + 1 < end) && printk_get_level(c)) {
> 			if (header) {
> 				c = printk_skip_level(c);
> 				continue;
> 			}
> 
> 			printk_safe_flush_line(start, c - start);
> 			start = c++;
> 			header = true;
> 			continue;
> 		}
> 
> 		header = false;
> 		c++;
> 	}
> 
> except that instead of printk_safe_flush_line() we will call log_store()
> and the whole loop will be under logbuf_lock.
> 
> for that to work, we need API to require header/loglevel etc for every
> message. so the use case can look like this:
> 
> 	init_printk_buffer(&buf);
> 	print_line(&buf, KERN_ERR "Oops....\n");
> 
> 	print_line(&buf, KERN_ERR "continuation line: foo");
> 	print_line(&buf, KERN_CONT "bar");
> 	print_line(&buf, KERN_CONT "baz\n");
> 	...
> 
> 	print_line(&buf, KERN_ERR "....\n");
> 	...
> 	print_line(&buf, KERN_ERR "--- end of oops ---\n");
> 	emit_printk_buffer(&buf);
> 
> so that not only concatenated continuation lines will be handled,
> but also more complex things. like backtraces or whatever someone
> might want to handle.

For oopses... please don't. It is quite important that Oops goes out
"as soon as possible". I have seen oopses cut in half, etc... They are
still quite helpful.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ