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: <20170828102830.GA403@jagdpanzerIV.localdomain>
Date:   Mon, 28 Aug 2017 19:28:30 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Pavel Machek <pavel@....cz>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>, 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@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Subject: Re: printk: what is going on with additional newlines?

On (08/28/17 11:05), Pavel Machek wrote:
> Hi!
> 
> In 4.13-rc, printk("foo"); printk("bar"); seems to produce
> foo\nbar. That's... quite surprising/unwelcome. What is going on
> there? Are timestamps responsible?

well, one thing we know for sure it is not related to this patch set  ;)


does any of the below patches fix the problem for you?

basically it sets up the rule -- if we don't have LOG_NEWLINE lflags
then we enforce LOG_CONT.

---

@@ -1721,9 +1723,13 @@ asmlinkage int vprintk_emit(int facility, int level,
 	text_len = vscnprintf(text, sizeof(textbuf), fmt, args);
 
 	/* mark and strip a trailing newline */
-	if (text_len && text[text_len-1] == '\n') {
-		text_len--;
-		lflags |= LOG_NEWLINE;
+	if (text_len) {
+		if (text[text_len-1] == '\n') {
+			text_len--;
+			lflags |= LOG_NEWLINE;
+		} else {
+			lflags |= LOG_CONT;
+		}
 	}
 
 	/* strip kernel syslog prefix and extract log level or control flags */


---


=== 8< === 8< ===


or... an alternative "solution"

---

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fc47863f629c..5fd567abc5e6 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1670,7 +1670,9 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c
 	 * write from the same process, try to add it to the buffer.
 	 */
 	if (cont.len) {
-		if (cont.owner == current && (lflags & LOG_CONT)) {
+		if (cont.owner == current &&
+				((lflags & LOG_CONT) ||
+				 !(lflags & LOG_NEWLINE))) {
 			if (cont_add(facility, level, lflags, text, text_len))
 				return text_len;
 		}


---

	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ