[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190416211922.d3c9c6987f0b992da343be52@linux-foundation.org>
Date: Tue, 16 Apr 2019 21:19:22 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Feng Tang <feng.tang@...el.com>
Cc: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Borislav Petkov <bp@...e.de>
Subject: Re: [PATCH v2] panic: add an option to replay all the printk
message in buffer
On Wed, 10 Apr 2019 23:37:18 +0800 Feng Tang <feng.tang@...el.com> wrote:
> Currently on panic, kernel will lower the loglevel and print out
> new printk msg only with console_flush_on_panic().
>
> Add an option for users to configure the "panic_print" to see
> all dmesg in buffer, some of which they may have never seen due
> to the loglevel setting, which will help debugging too.
>
> Thanks to Petr Mladek as somes codes come directly from the sample
> code in his review comments.
CONFIG_PRINTK=n:
kernel/printk/printk.c: In function console_unlock:
kernel/printk/printk.c:2419:11: warning: __builtin_memcpy writing 27 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
len += sprintf(text + len,
^~~~~~~~~~~~~~~~~~~
"Replaying the entire log:\n");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
because LOG_LINE_MAX=0 and PREFIX_MAX=0.
Which is interesting. The pre-existing
len = sprintf(text,
"** %llu printk messages dropped **\n",
log_first_seq - console_seq);
in console_unlock() has the same issue, but the compiler doesn't seem
to want to warn.
(Also, using sprintf() is a bit lame for the new message - could use
strlcpy()).
I'll drop the patch for now - we don't want that warning to come out.
console_unlock() needs some fixing for the CONFIG_PRINTK=n case.
Powered by blists - more mailing lists