From: Jiri Slaby <jirislaby@kernel.org>
To: Jiri Kosina <jikos@kernel.org>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kasan: distinguish kasan report from generic BUG()
Date: Wed, 24 Nov 2021 19:04:02 +0100 [thread overview]
Message-ID: <d42117da-f6a4-053b-c498-5686cc06aca4@kernel.org> (raw)
In-Reply-To: <nycvar.YFH.7.76.2111241839590.16505@cbobk.fhfr.pm>
On 24. 11. 21, 18:41, Jiri Kosina wrote:
> From: Jiri Kosina <jkosina@suse.cz>
>
> The typical KASAN report always begins with
>
> BUG: KASAN: ....
>
> in kernel log. That 'BUG:' prefix creates a false impression that it's an
> actual BUG() codepath being executed, and as such things like
> 'panic_on_oops' etc. would work on it as expected; but that's obviously
> not the case.
>
> Switch the order of prefixes to make this distinction clear and avoid
> confusion.
Thinking about it more in the scope of panic_on_oops above: wouldn't it
make more sense to emit "KASAN: WARNING:" instead? All that provided the
fact the code explicitly does "if (panic_on_warn) { panic(); }"?
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
> mm/kasan/report.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 0bc10f452f7e..ead714c844e9 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -86,7 +86,7 @@ __setup("kasan_multi_shot", kasan_set_multi_shot);
>
> static void print_error_description(struct kasan_access_info *info)
> {
> - pr_err("BUG: KASAN: %s in %pS\n",
> + pr_err("KASAN: BUG: %s in %pS\n",
> kasan_get_bug_type(info), (void *)info->ip);
> if (info->access_size)
> pr_err("%s of size %zu at addr %px by task %s/%d\n",
> @@ -366,7 +366,7 @@ void kasan_report_invalid_free(void *object, unsigned long ip)
> #endif /* IS_ENABLED(CONFIG_KUNIT) */
>
> start_report(&flags);
> - pr_err("BUG: KASAN: double-free or invalid-free in %pS\n", (void *)ip);
> + pr_err("KASAN: BUG: double-free or invalid-free in %pS\n", (void *)ip);
> kasan_print_tags(tag, object);
> pr_err("\n");
> print_address_description(object, tag);
> @@ -386,7 +386,7 @@ void kasan_report_async(void)
> #endif /* IS_ENABLED(CONFIG_KUNIT) */
>
> start_report(&flags);
> - pr_err("BUG: KASAN: invalid-access\n");
> + pr_err("KASAN: BUG: invalid-access\n");
> pr_err("Asynchronous mode enabled: no access details available\n");
> pr_err("\n");
> dump_stack_lvl(KERN_ERR);
>
>
--
js
suse labs
next prev parent reply other threads:[~2021-11-24 18:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 17:41 [PATCH] kasan: distinguish kasan report from generic BUG() Jiri Kosina
2021-11-24 18:04 ` Jiri Slaby [this message]
2021-11-24 18:06 ` Marco Elver
2021-11-25 7:15 ` Dmitry Vyukov
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=d42117da-f6a4-053b-c498-5686cc06aca4@kernel.org \
--to=jirislaby@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=jikos@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@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).