LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrey Konovalov <andreyknvl@google.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev@googlegroups.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Andrey Konovalov <andreyknvl@google.com>
Subject: [PATCH 10/11] kasan: docs: update ignoring accesses section
Date: Thu, 11 Mar 2021 22:37:22 +0100	[thread overview]
Message-ID: <c0f6a95b0fa59ce0ef502f4ea11522141e3c8faf.1615498565.git.andreyknvl@google.com> (raw)
In-Reply-To: <f6efb2f36fc1f40eb22df027e6bc956cac71745e.1615498565.git.andreyknvl@google.com>

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@google.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


  parent reply	other threads:[~2021-03-11 21:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 21:37 [PATCH 01/11] kasan: docs: clean up sections Andrey Konovalov
2021-03-11 21:37 ` [PATCH 02/11] kasan: docs: update overview section Andrey Konovalov
2021-03-12 10:17   ` Marco Elver
2021-03-12 13:51     ` Andrey Konovalov
2021-03-11 21:37 ` [PATCH 03/11] kasan: docs: update usage section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 04/11] kasan: docs: update error reports section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 05/11] kasan: docs: update boot parameters section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 06/11] kasan: docs: update GENERIC implementation details section Andrey Konovalov
2021-03-11 21:37 ` [PATCH 07/11] kasan: docs: update SW_TAGS " Andrey Konovalov
2021-03-11 21:37 ` [PATCH 08/11] kasan: docs: update HW_TAGS " Andrey Konovalov
2021-03-11 21:37 ` [PATCH 09/11] kasan: docs: update shadow memory section Andrey Konovalov
2021-03-12 10:52   ` Marco Elver
2021-03-12 13:52     ` Andrey Konovalov
2021-03-11 21:37 ` Andrey Konovalov [this message]
2021-03-12 11:02   ` [PATCH 10/11] kasan: docs: update ignoring accesses section Marco Elver
2021-03-12 14:07     ` Andrey Konovalov
2021-03-11 21:37 ` [PATCH 11/11] kasan: docs: update tests section Andrey Konovalov
2021-03-12 10:47   ` Marco Elver
2021-03-12 13:53     ` Andrey Konovalov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0f6a95b0fa59ce0ef502f4ea11522141e3c8faf.1615498565.git.andreyknvl@google.com \
    --to=andreyknvl@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --subject='Re: [PATCH 10/11] kasan: docs: update ignoring accesses section' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).