[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c0f6a95b0fa59ce0ef502f4ea11522141e3c8faf.1615498565.git.andreyknvl@google.com>
Date: Thu, 11 Mar 2021 22:37:22 +0100
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Alexander Potapenko <glider@...gle.com>,
Marco Elver <elver@...gle.com>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Dmitry Vyukov <dvyukov@...gle.com>, kasan-dev@...glegroups.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: [PATCH 10/11] kasan: docs: update ignoring accesses section
Update the "Ignoring accesses" section in KASAN documentation:
- Mention kasan_disable/enable_current().
- Mention kasan_reset_tag()/page_kasan_tag_reset().
- A punctuation clean-up.
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
---
Documentation/dev-tools/kasan.rst | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/Documentation/dev-tools/kasan.rst b/Documentation/dev-tools/kasan.rst
index 2b61d90e136f..6628b133c9ad 100644
--- a/Documentation/dev-tools/kasan.rst
+++ b/Documentation/dev-tools/kasan.rst
@@ -368,7 +368,7 @@ Ignoring accesses
~~~~~~~~~~~~~~~~~
Software KASAN modes use compiler instrumentation to insert validity checks.
-Such instrumentation might be incompatible with some part of the kernel, and
+Such instrumentation might be incompatible with some parts of the kernel, and
therefore needs to be disabled. To disable instrumentation for specific files
or directories, add a line similar to the following to the respective kernel
Makefile:
@@ -381,6 +381,19 @@ Makefile:
KASAN_SANITIZE := n
+Other parts of the kernel might access metadata for allocated objects. Normally,
+KASAN detects and reports such accesses, but in certain cases (e.g., in memory
+allocators) these accesses are valid. Disabling instrumentation for memory
+allocators files helps with accesses that happen directly in that code for
+software KASAN modes. But it does not help when the accesses happen indirectly
+(through generic function calls) or with the hardware tag-based mode that does
+not use compiler instrumentation.
+
+To disable KASAN reports in a certain part of the kernel code:
+
+- For software modes, add a
+ ``kasan_disable_current()``/``kasan_enable_current()`` critical section.
+- For tag-based modes, use ``kasan_reset_tag()`` or ``page_kasan_tag_reset()``.
Tests
~~~~~
--
2.31.0.rc2.261.g7f71774620-goog
Powered by blists - more mailing lists