Re: [PATCH] kasan: add support for kasan.fault=panic_on_write

From: Marco Elver
Date: Tue Jun 20 2023 - 07:33:40 EST


On Tue, 20 Jun 2023 at 12:57, Andrey Konovalov <andreyknvl@xxxxxxxxx> wrote:
>
> On Wed, Jun 14, 2023 at 11:52 AM Marco Elver <elver@xxxxxxxxxx> wrote:
> >
> > @@ -597,7 +614,11 @@ void kasan_report_async(void)
> > pr_err("Asynchronous fault: no details available\n");
> > pr_err("\n");
> > dump_stack_lvl(KERN_ERR);
> > - end_report(&flags, NULL);
> > + /*
> > + * Conservatively set is_write=true, because no details are available.
> > + * In this mode, kasan.fault=panic_on_write is like kasan.fault=panic.
> > + */
> > + end_report(&flags, NULL, true);
>
> Hi Marco,
>
> When asymm mode is enabled, kasan_report_async should only be called
> for read accesses. I think we could check the mode and panic
> accordingly.

How do we check the mode, and how do we prove it's only called for
read accesses?

> Please also update the documentation to describe the flag behavior wrt
> async/asymm modes.

Will do.

> On a related note, it looks like we have a typo in KASAN
> documentation: it states that asymm mode detects reads synchronously,
> and writes - asynchronously. Should be the reverse.

This says the documentation is correct, and it's actually called for
writes: https://docs.kernel.org/arm64/memory-tagging-extension.html#tag-check-faults

Who is right?