linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Feng Tang <feng.tang@intel.com>
Cc: Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
	Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH v2] panic: add an option to replay all the printk message in buffer
Date: Tue, 16 Apr 2019 21:19:22 -0700	[thread overview]
Message-ID: <20190416211922.d3c9c6987f0b992da343be52@linux-foundation.org> (raw)
In-Reply-To: <20190410153718.22905-1-feng.tang@intel.com>

On Wed, 10 Apr 2019 23:37:18 +0800 Feng Tang <feng.tang@intel.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.


  reply	other threads:[~2019-04-17  4:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 15:37 [PATCH v2] panic: add an option to replay all the printk message in buffer Feng Tang
2019-04-17  4:19 ` Andrew Morton [this message]
2019-04-17  6:48   ` Feng Tang
2019-04-17  9:18     ` Petr Mladek
2019-04-17  9:46       ` Sergey Senozhatsky
2019-04-17 10:50         ` Sergey Senozhatsky
2019-04-17 12:24           ` Petr Mladek
2019-04-17 15:18             ` Feng Tang
2019-04-18  0:00               ` Sergey Senozhatsky
2019-04-18  7:45                 ` Petr Mladek
2019-04-18  9:00                   ` Feng Tang
2019-04-18 11:01                     ` Petr Mladek
2019-04-19  2:08                       ` Feng Tang
2019-04-18 10:50                   ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416211922.d3c9c6987f0b992da343be52@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=feng.tang@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).