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, 15 Jul 2016 18:59:01 +0200
From:	Petr Mladek <pmladek@...e.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:	Jiri Kosina <jkosina@...e.com>, Jan Kara <jack@...e.com>,
	Tejun Heo <tj@...nel.org>,
	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
	Byungchul Park <byungchul.park@....com>,
	linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>
Subject: [PATCH POC 3/4] printk: Flush the cont buffer after the other lines

The cont buffer is not longer blocked until the rest of
the line is stored. Instead, the remaining part of the line
is printed from the ring buffer in the normal cycle.

Therefore console_cont_flush() always prints only
the very last line and it makes sense to call it
after the main cycle.

Note that it is safe to modify exclusive_console
and console_locked variables without the logbuf_lock.
They both are primary synchronized by the console_sem.
---
 kernel/printk/printk.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 7d93ac263006..a920cc36c24e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2258,9 +2258,6 @@ again:
 		return;
 	}
 
-	/* flush buffered message fragment immediately to console */
-	console_cont_flush(text, sizeof(text));
-
 	for (;;) {
 		struct printk_log *msg;
 		size_t ext_len = 0;
@@ -2334,14 +2331,17 @@ again:
 		if (do_cond_resched)
 			cond_resched();
 	}
-	console_locked = 0;
+
+	raw_spin_unlock(&logbuf_lock);
+
+	/* flush buffered message fragment immediately to console */
+	console_cont_flush(text, sizeof(text));
 
 	/* Release the exclusive_console once it is used */
 	if (unlikely(exclusive_console))
 		exclusive_console = NULL;
 
-	raw_spin_unlock(&logbuf_lock);
-
+	console_locked = 0;
 	up_console_sem();
 
 	/*
-- 
1.8.5.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ