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  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:   Tue, 29 Aug 2017 18:52:39 -0700
From:   Joe Perches <joe@...ches.com>
To:     Steven Rostedt <rostedt@...dmis.org>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Pavel Machek <pavel@....cz>,
        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 Tue, 2017-08-29 at 21:10 -0400, Steven Rostedt wrote:
> On Wed, 30 Aug 2017 10:03:48 +0900
> Sergey Senozhatsky <sergey.senozhatsky.work@...il.com> wrote:
> 
> > Hello,
> > 
> > On (08/29/17 19:50), Steven Rostedt wrote:
> > [..]
> > > > A private buffer has none of those issues.  
> > > 
> > > What about using the seq_buf*() then?
> > > 
> > > 	struct seq_buf s;
> > > 
> > > 	buf = kmalloc(mysize);
> > > 	seq_buf_init(&s, buf, mysize);
> > > 
> > > 	seq_printf(&s,"blah blah %d", bah_blah);
> > > 	[...]
> > > 	seq_printf(&s, "my last print\n");
> > > 
> > > 	printk("%.*s", s.len, s.buffer);
> > > 
> > > 	kfree(buf);  
> > 
> > could do. for a single continuation line printk("%.*s", s.len, s.buffer)
> > this will work perfectly fine. for a more general case - backtraces, dumps,
> > etc. - this requires some tweaks.
> 
> We could simply add a seq_buf_printk() that is implemented in the printk
> proper, to parse the seq_buf buffer properly, and add the timestamps and
> such.

No need.  printk would already add timestamps.

One addition might be to add a bit to initialize
the buffer so that printk("%s", s->buffer) is simpler.
---
diff --git a/include/linux/seq_buf.h b/include/linux/seq_buf.h
index fb7eb9ccb1cd..fb6c9de0ee33 100644
--- a/include/linux/seq_buf.h
+++ b/include/linux/seq_buf.h
@@ -26,6 +26,7 @@ static inline void seq_buf_clear(struct seq_buf *s)
 {
 	s->len = 0;
 	s->readpos = 0;
+	*s->buffer = 0;
 }
 
 static inline void


Powered by blists - more mailing lists