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: <20180530075105.GA12230@jagdpanzerIV>
Date:   Wed, 30 May 2018 16:51:05 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [PATCH] printk: drop in_nmi check from
 printk_safe_flush_on_panic()

On (05/30/18 09:24), Petr Mladek wrote:
> Acked-by: Petr Mladek <pmladek@...e.com>

Thanks.

> Just to be sure. IMHO, it is not worth nominating this patch for
> stable. It is not a regression fix. I see it as a continuous
> improving of the handling in various corner cases. And I see this
> as a distant corner case.

Yep, agreed.

***

A random thought [not suggesting anything]:

Given that we call printk() before SMP stop and that some of
smp_send_stop() call printk(), may be we can switch panic()
to printk_safe() mode and return it back to normal printk()
mode right before printk_safe_flush_on_panic(). So all possible
printk()-s that can happen in between (printk_safe_enter()
printk_safe_exit()) will not access the logbuf spin lock, yet
we still will try to flush all per-CPU buffers a bit later.

It probably doesn't sound like a very good/solid idea, just
wondering what will people say.

Very schematically,

---

diff --git a/kernel/panic.c b/kernel/panic.c
index 42e487488554..98a0493a59d3 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -148,6 +148,7 @@ void panic(const char *fmt, ...)
 	 * after setting panic_cpu) from invoking panic() again.
 	 */
 	local_irq_disable();
+	__printk_safe_enter();
 
 	/*
 	 * It's possible to come here directly from a panic-assertion and
@@ -217,6 +218,7 @@ void panic(const char *fmt, ...)
 	 */
 	atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
 
+	__printk_safe_exit();
 	/* Call flush even twice. It tries harder with a single online CPU */
 	printk_safe_flush_on_panic();
 	kmsg_dump(KMSG_DUMP_PANIC);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ