linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Dmitry Vyukov <dvyukov@google.com>,
	akpm@linux-foundation.org, glider@google.com
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kasan: support panic_on_warn
Date: Mon, 17 Oct 2016 11:13:42 +0300	[thread overview]
Message-ID: <2b39f90e-2c67-fafb-dc48-f642c62bead6@virtuozzo.com> (raw)
In-Reply-To: <1476465002-2728-1-git-send-email-dvyukov@google.com>



On 10/14/2016 08:10 PM, Dmitry Vyukov wrote:
> If user sets panic_on_warn, he wants kernel to panic if there is
> anything barely wrong with the kernel. KASAN-detected errors
> are definitely not less benign than an arbitrary kernel WARNING.
> 
> Panic after KASAN errors if panic_on_warn is set.
> 
> We use this for continuous fuzzing where we want kernel to stop
> and reboot on any error.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Cc: kasan-dev@googlegroups.com
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Alexander Potapenko <glider@google.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  mm/kasan/report.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 24c1211..ca0bd48 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -133,6 +133,10 @@ static void kasan_end_report(unsigned long *flags)
>  	pr_err("==================================================================\n");
>  	add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE);
>  	spin_unlock_irqrestore(&report_lock, *flags);
> +	if (panic_on_warn) {
> +		panic_on_warn = 0;

Why we need to reset panic_on_warn?
I assume this was copied from __warn(). AFAIU in __warn() this protects from recursion:
 __warn() -> painc() ->__warn() -> panic() -> ...
which is possible if WARN_ON() triggered in panic().
But KASAN is protected from such recursion via kasan_disable_current().

> +		panic("panic_on_warn set ...\n");
> +	}
>  	kasan_enable_current();
>  }
>  
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-10-17  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 17:10 [PATCH] kasan: support panic_on_warn Dmitry Vyukov
2016-10-17  8:13 ` Andrey Ryabinin [this message]
2016-10-17  8:18   ` Dmitry Vyukov
2016-10-17  8:39     ` Andrey Ryabinin
2016-10-17  8:59       ` Dmitry Vyukov
  -- strict thread matches above, loose matches on Subject: below --
2016-10-17  8:57 Dmitry Vyukov
2016-10-17  8:58 ` Andrey Ryabinin

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=2b39f90e-2c67-fafb-dc48-f642c62bead6@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).