Re: [PATCH] mm/kasan: move kasan.fault to mm/kasan/report.c
From: Marco Elver <elver@google.com>
Date: 2021-07-12 16:44:15
Also in:
linux-mm, lkml
Subsystem:
documentation, documentation process, kasan, the rest · Maintainers:
Jonathan Corbet, Andrey Ryabinin, Linus Torvalds
On Mon, Jul 12, 2021 at 11:16PM +0800, 'Woody Lin' via kasan-dev wrote:
quoted hunk ↗ jump to hunk
Move the boot parameter 'kasan.fault' from hw_tags.c to report.c, so it can support all KASAN modes - generic, and both tag-based. Signed-off-by: Woody Lin <redacted> --- Documentation/dev-tools/kasan.rst | 2 ++ mm/kasan/hw_tags.c | 43 ------------------------------- mm/kasan/report.c | 29 ++++++++++++++++++--- 3 files changed, 28 insertions(+), 46 deletions(-)diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst index 83ec4a556c19..ab8e27d45632 100644 --- a/Documentation/dev-tools/kasan.rst +++ b/Documentation/dev-tools/kasan.rst@@ -203,6 +203,8 @@ boot parameters that allow disabling KASAN or controlling its features. report or also panic the kernel (default: ``report``). The panic happens even if ``kasan_multi_shot`` is enabled. + Note: The boot parameter 'kasan.fault' is supported by all KASAN modes.
This documentation change seems hacked on. Could we change it like this:
diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index 83ec4a556c19..21dc03bc10a4 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst@@ -181,9 +181,16 @@ By default, KASAN prints a bug report only for the first invalid memory access. With ``kasan_multi_shot``, KASAN prints a report on every invalid access. This effectively disables ``panic_on_warn`` for KASAN reports. +Alternatively, independent of ``panic_on_warn`` the ``kasan.fault=`` boot +parameter can be used to control panic and reporting behaviour: + +- ``kasan.fault=report`` or ``=panic`` controls whether to only print a KASAN + report or also panic the kernel (default: ``report``). The panic happens even + if ``kasan_multi_shot`` is enabled. + Hardware tag-based KASAN mode (see the section about various modes below) is intended for use in production as a security mitigation. Therefore, it supports -boot parameters that allow disabling KASAN or controlling its features. +additional boot parameters that allow disabling KASAN or controlling features: - ``kasan=off`` or ``=on`` controls whether KASAN is enabled (default: ``on``).
@@ -199,10 +206,6 @@ boot parameters that allow disabling KASAN or controlling its features. - ``kasan.stacktrace=off`` or ``=on`` disables or enables alloc and free stack traces collection (default: ``on``). -- ``kasan.fault=report`` or ``=panic`` controls whether to only print a KASAN - report or also panic the kernel (default: ``report``). The panic happens even - if ``kasan_multi_shot`` is enabled. - Implementation details ----------------------
[...]
-/* Whether to panic or print a report and disable tag checking on fault. */ -bool kasan_flag_panic __ro_after_init;
There's also an extern declaration in kasan.h, which should be removed. Thanks, -- Marco