lkml.org 
[lkml]   [2017]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT PULL] printk for 4.13
On Mon, Jul 3, 2017 at 7:24 AM, Petr Mladek <pmladek@suse.com> wrote:
>
> - Store printk() messages into the main log buffer directly even in NMI
> when the lock is available. It is the best effort to print even large
> chunk of text. It is handy, for example, when all ftrace messages
> are printed during the system panic in NMI.

No, this is entirely buggered.

You can't just do

raw_spin_is_locked(&logbuf_lock)

to test whether you can get the logbuf_lock and then call vprintk_default().

It's not just about deadlock avoidance, the code will call things like
down_trylock() on the console semaphore, and that operation is
fundamentally not NMI-safe. The semaphore count is literally protected
by a irq-safe (BUT NOT NMI-SAFE!) semaphore spinlock.

So now you can instead deadlock just on the internal console semaphore
spinlock (ie somebody is doing "console_lock()", NMI comes in, *BOOM*.

Maybe I'm missing something, but I'm skipping this pull request as
"completely broken".

Linus

\
 
 \ /
  Last update: 2017-07-05 20:24    [W:1.040 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site