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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 17 Jul 2014 12:59:11 -0500
From:	Alex Elder <elder@...aro.org>
To:	akpm@...ux-foundation.org
Cc:	kay@...y.org, pmladek@...e.cz, bp@...e.de, john.stultz@...aro.org,
	jack@...e.cz, linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] printk: stop actually recording LOG_PREFIX

Whenever log_store() sees a LOG_PREFIX flag it marks the previous
log entry (if there is one) with LOG_NEWLINE, which (also) produces
the desired effect.

There's therefore no need to record LOG_PREFIX in log records.

If no log entries contain LOG_PREFIX, devkmsg_read() and
msg_print_text() don't need to check for it.

Signed-off-by: Alex Elder <elder@...aro.org>
---
 kernel/printk/printk.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 6b72a77..df38b5e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -432,8 +432,11 @@ static int log_store(int facility, int level,
 	 * If we're forcing a new log record, update the flags for
 	 * the previous one to mark it complete.
 	 */
-	if (flags & LOG_PREFIX && log_last_msg)
-		log_last_msg->flags |= LOG_NEWLINE;
+	if (flags & LOG_PREFIX) {
+		if (log_last_msg)
+			log_last_msg->flags |= LOG_NEWLINE;
+		flags &= ~LOG_PREFIX;
+	}
 
 	msg = (struct printk_log *)(log_buf + log_next_idx);
 	memcpy(log_text(msg), text, text_len);
@@ -633,7 +636,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
 	 * a record that should be merged with one or more earlier records.
 	 * And a '-' indicates a "normal" self-contained single record.
 	 */
-	if (!(user->prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX))
+	if (!(user->prev & LOG_NEWLINE))
 		cont = '+';
 	else if (!(msg->flags & LOG_NEWLINE))
 		cont = 'c';
@@ -1020,7 +1023,7 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
 	bool newline = true;
 	size_t len = 0;
 
-	if (!(prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX))
+	if (!(prev & LOG_NEWLINE))
 		prefix = false;
 
 	if (!(msg->flags & LOG_NEWLINE))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ