Re: [PATCH v2 3/3] kasan: delete CONFIG_KASAN_MODULE_TEST

From: Andrey Konovalov
Date: Sun Oct 13 2024 - 12:03:54 EST


On Sun, Oct 13, 2024 at 3:02 PM Sabyrzhan Tasbolatov
<snovitoll@xxxxxxxxx> wrote:
>
> diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
> index d7de44f5339..52fdd6b5ef6 100644
> --- a/Documentation/dev-tools/kasan.rst
> +++ b/Documentation/dev-tools/kasan.rst
> @@ -511,17 +511,12 @@ Tests
> ~~~~~
>
> There are KASAN tests that allow verifying that KASAN works and can detect
> -certain types of memory corruptions. The tests consist of two parts:
> +certain types of memory corruptions.
>
> -1. Tests that are integrated with the KUnit Test Framework. Enabled with
> +Tests that are integrated with the KUnit Test Framework. Enabled with
> ``CONFIG_KASAN_KUNIT_TEST``. These tests can be run and partially verified
> automatically in a few different ways; see the instructions below.
>
> -2. Tests that are currently incompatible with KUnit. Enabled with
> -``CONFIG_KASAN_MODULE_TEST`` and can only be run as a module. These tests can
> -only be verified manually by loading the kernel module and inspecting the
> -kernel log for KASAN reports.
> -
> Each KUnit-compatible KASAN test prints one of multiple KASAN reports if an
> error is detected. Then the test prints its number and status.

Let's reword these parts even more, please see the attached file.
diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index d7de44f5339d4..83c777bc96881 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst
@@ -511,19 +511,14 @@ Tests
~~~~~

There are KASAN tests that allow verifying that KASAN works and can detect
-certain types of memory corruptions. The tests consist of two parts:
+certain types of memory corruptions.

-1. Tests that are integrated with the KUnit Test Framework. Enabled with
-``CONFIG_KASAN_KUNIT_TEST``. These tests can be run and partially verified
+All KASAN tests are integrated with the KUnit Test Framework and can be enabled
+via ``CONFIG_KASAN_KUNIT_TEST``. The tests can be run and partially verified
automatically in a few different ways; see the instructions below.

-2. Tests that are currently incompatible with KUnit. Enabled with
-``CONFIG_KASAN_MODULE_TEST`` and can only be run as a module. These tests can
-only be verified manually by loading the kernel module and inspecting the
-kernel log for KASAN reports.
-
-Each KUnit-compatible KASAN test prints one of multiple KASAN reports if an
-error is detected. Then the test prints its number and status.
+Each KASAN test prints one of multiple KASAN reports if an error is detected.
+Then the test prints its number and status.

When a test passes::

@@ -541,7 +536,6 @@ When a test fails due to a missing KASAN report::
KASAN failure expected in "kfree_sensitive(ptr)", but none occurred
not ok 28 - kmalloc_double_kzfree

-
At the end the cumulative status of all KASAN tests is printed. On success::

ok 1 - kasan
@@ -550,16 +544,16 @@ Or, if one of the tests failed::

not ok 1 - kasan

-There are a few ways to run KUnit-compatible KASAN tests.
+There are a few ways to run the KASAN tests.

1. Loadable module

- With ``CONFIG_KUNIT`` enabled, KASAN-KUnit tests can be built as a loadable
- module and run by loading ``kasan_test.ko`` with ``insmod`` or ``modprobe``.
+ With ``CONFIG_KUNIT`` enabled, the tests can be built as a loadable module
+ and run by loading ``kasan_test.ko`` with ``insmod`` or ``modprobe``.

2. Built-In

- With ``CONFIG_KUNIT`` built-in, KASAN-KUnit tests can be built-in as well.
+ With ``CONFIG_KUNIT`` built-in, the tests can be built-in as well.
In this case, the tests will run at boot as a late-init call.

3. Using kunit_tool