Re: [PATCH v6 6/44] kmsan: add ReST documentation

From: Bagas Sanjaya
Date: Mon Sep 05 2022 - 23:10:55 EST


On Mon, Sep 05, 2022 at 02:24:14PM +0200, Alexander Potapenko wrote:
> +Here is an example of a KMSAN report::
> +
> + =====================================================
> + BUG: KMSAN: uninit-value in test_uninit_kmsan_check_memory+0x1be/0x380 [kmsan_test]
> + test_uninit_kmsan_check_memory+0x1be/0x380 mm/kmsan/kmsan_test.c:273
> + kunit_run_case_internal lib/kunit/test.c:333
> + kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374
> + kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28
> + kthread+0x721/0x850 kernel/kthread.c:327
> + ret_from_fork+0x1f/0x30 ??:?
> +
> + Uninit was stored to memory at:
> + do_uninit_local_array+0xfa/0x110 mm/kmsan/kmsan_test.c:260
> + test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271
> + kunit_run_case_internal lib/kunit/test.c:333
> + kunit_try_run_case+0x206/0x420 lib/kunit/test.c:374
> + kunit_generic_run_threadfn_adapter+0x6d/0xc0 lib/kunit/try-catch.c:28
> + kthread+0x721/0x850 kernel/kthread.c:327
> + ret_from_fork+0x1f/0x30 ??:?
> +
> + Local variable uninit created at:
> + do_uninit_local_array+0x4a/0x110 mm/kmsan/kmsan_test.c:256
> + test_uninit_kmsan_check_memory+0x1a2/0x380 mm/kmsan/kmsan_test.c:271
> +
> + Bytes 4-7 of 8 are uninitialized
> + Memory access of size 8 starts at ffff888083fe3da0
> +
> + CPU: 0 PID: 6731 Comm: kunit_try_catch Tainted: G B E 5.16.0-rc3+ #104
> + Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
> + =====================================================

Are these table markers in the code block above part of kmsan output?

> +A use of uninitialized value ``v`` is reported by KMSAN in the following cases:
> + - in a condition, e.g. ``if (v) { ... }``;
> + - in an indexing or pointer dereferencing, e.g. ``array[v]`` or ``*v``;
> + - when it is copied to userspace or hardware, e.g. ``copy_to_user(..., &v, ...)``;
> + - when it is passed as an argument to a function, and
> + ``CONFIG_KMSAN_CHECK_PARAM_RETVAL`` is enabled (see below).

The sentence before the list above is rendered as definition list term
instead, so I add the blank line separator:

---- >8 ----

diff --git a/Documentation/dev-tools/kmsan.rst b/Documentation/dev-tools/kmsan.rst
index 2a53a801198cbf..55fa82212eb255 100644
--- a/Documentation/dev-tools/kmsan.rst
+++ b/Documentation/dev-tools/kmsan.rst
@@ -67,6 +67,7 @@ uninitialized in the local variable, as well as the stack where the value was
copied to another memory location before use.

A use of uninitialized value ``v`` is reported by KMSAN in the following cases:
+
- in a condition, e.g. ``if (v) { ... }``;
- in an indexing or pointer dereferencing, e.g. ``array[v]`` or ``*v``;
- when it is copied to userspace or hardware, e.g. ``copy_to_user(..., &v, ...)``;

Thanks.

--
An old man doll... just what I always wanted! - Clara

Attachment: signature.asc
Description: PGP signature