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: <20200922153816.5883-2-john.ogness@linutronix.de>
Date:   Tue, 22 Sep 2020 17:44:12 +0206
From:   John Ogness <john.ogness@...utronix.de>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: [PATCH printk 1/5] printk: get new seq before enabling interrupts

After copying all records to the dynamic ringbuffer, setup_log_buf()
checks to see if any records were dropped during the switch. However,
it needs to check before enabling interrupts since new records could
arrive in an interrupt, thus causing setup_log_buf() to erroneously
think that it had dropped messages.

Signed-off-by: John Ogness <john.ogness@...utronix.de>
---
 kernel/printk/printk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 1fe3d0cb2fe0..00bc1fce3299 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1181,12 +1181,12 @@ void __init setup_log_buf(int early)
 	 */
 	prb = &printk_rb_dynamic;
 
+	seq = prb_next_seq(&printk_rb_static) - seq;
+
 	logbuf_unlock_irqrestore(flags);
 
-	if (seq != prb_next_seq(&printk_rb_static)) {
-		pr_err("dropped %llu messages\n",
-		       prb_next_seq(&printk_rb_static) - seq);
-	}
+	if (seq)
+		pr_err("dropped %llu messages\n", seq);
 
 	pr_info("log_buf_len: %u bytes\n", log_buf_len);
 	pr_info("early log buf free: %u(%u%%)\n",
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ