From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: BUG and WARN kernel log levels
Date: Mon, 15 Aug 2016 12:00:14 -0700 [thread overview]
Message-ID: <1471287614.4075.85.camel@perches.com> (raw)
In-Reply-To: <CAGXu5jJQzRLgzKAUx74PHRO6fuU1PqFRQebmV=3kADFPN_fiaw@mail.gmail.com>
On Mon, 2016-08-15 at 11:53 -0700, Kees Cook wrote:
> Hi,
>
> So, I noticed that asm-gemeric/bug.h defines BUG() without a log level:
>
> #ifndef HAVE_ARCH_BUG
> #define BUG() do { \
> printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
>
> Seems like it should have one?
>
> Also, I think we might want to examine WARN() a bit... it doesn't have
> a log level either, but only a fraction of callers set one:
>
> $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep -v KERN_ | wc -l
> 2735
>
> $ git grep -E 'WARN(_TAINT|)(_RATELIMIT|_ONCE|)\([^\)]' | grep KERN_ | wc -l
> 77
>
> If I'm reading checkpatch.pl correctly, it doesn't warn about missing
> log levels on WARN calls, but I think it should.
>
> How do you think is best to clean this up?
>
> Mainly, I'd like to add a format string to BUG, or introduce a new
> BUGish call that takes a format...
I once suggested something similar awhile ago.
https://lkml.org/lkml/2008/7/8/261
I think it's best to remove any KERN_<LEVEL> from the use of
all the WARN variants and add it to the WARN definitions.
Same with BUG.
next prev parent reply other threads:[~2016-08-15 19:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-15 18:53 BUG and WARN kernel log levels Kees Cook
2016-08-15 19:00 ` Joe Perches [this message]
2016-08-15 20:28 ` Kees Cook
2016-08-15 20:39 ` Joe Perches
2016-08-17 16:36 ` Joe Perches
2016-08-17 21:19 ` Kees Cook
2016-08-17 22:49 ` Joe Perches
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=1471287614.4075.85.camel@perches.com \
--to=joe@perches.com \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
/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