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

From: Andrey Konovalov
Date: Tue Jun 20 2023 - 06:58:13 EST


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.

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

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.

Thanks!